将java程序打包之后,双击生成的jar文件,老是出现错误提示,用eclipse打包的
cds1 2007-08-28 03:10:50 双击之后老是出现:could not find the main class. Program will exit.
其它程序打包都没有问题,就单单这一个出现问题,我不知道是为什么,麻烦各位高手指点,我也手工打包过,还是不行,程序如下:
package yuebao;
import java.io.*;
import java.text.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class CallRecord
{
public static void main(String[] args)
{
int b=0;
POIFSFileSystem pfs=null;
HSSFWorkbook hwb=null;
try
{
pfs=new POIFSFileSystem(new FileInputStream("CallRecord(Running).xls"));
hwb=new HSSFWorkbook(pfs);
HSSFSheet sheet=hwb.getSheetAt(0);
int rowNum;
int i;
String[] date=new String[3100];
double[] record=new double[3100];
double[] percent=new double[3100];
rowNum = sheet.getLastRowNum();
//System.out.println(rowNum);
for (i = 4; i <= rowNum; i++) {
//System.out.println(sheet.getRow(i).getCell((short)0).getDateCellValue().toLocaleString());
date[i]=sheet.getRow(i).getCell((short)0).getDateCellValue().toLocaleString();
HSSFCell cl=sheet.getRow(i).getCell((short)1);
record[i]=Double.parseDouble(cl.toString().trim());
HSSFCell c2=sheet.getRow(i).getCell((short)2);
percent[i]=Double.parseDouble(c2.toString().trim());
//System.out.println(i+"---"+date[i]+"---"+record[i]+"---"+percent[i]);
}
HSSFWorkbook wb=new HSSFWorkbook();
FileOutputStream fo=new FileOutputStream("callRecord.xls");
HSSFSheet ht=wb.createSheet("彩铃月报");
HSSFRow r1 = ht.createRow((short)0);
HSSFCell c1 = r1.createCell((short)0);
c1=r1.getCell((short)0);
c1.setCellValue("日期1");
HSSFCell c2 = r1.createCell((short)1);
c2=r1.getCell((short)1);
c2.setCellValue("日期2");
HSSFCell c3 = r1.createCell((short)2);
c3=r1.getCell((short)2);
c3.setCellValue("忙时试呼次数");
HSSFCell c4 = r1.createCell((short)3);
c4=r1.getCell((short)3);
c4.setCellValue("忙时应答率");
double[] result1=new double[93];
int start=4;
int end=96;
int n=0;
for(int j=start;j<=end;j++)
{
int m=n++;
result1[m]=0;
//System.out.println(m);
for(int k=0;k<4;k++)
{
result1[m]=result1[m]+record[j+k];
}
//System.out.println("result1["+m+"]:"+result1[m]);
//System.out.println("j:"+j);
if((end-j)==0)
{
b++;
float max=(float)result1[0];
float per=(float)0;
int l1=0;
for(int l=1;l<result1.length;l++)
{
if(max<result1[l])
{
max=(float)result1[l];
l1=l;
}
}
for(int t=0;t<4;t++)
{
per=(float)(per+percent[96*((j/96)-1)+4+l1+t]);
//System.out.println(date[96*((j/96)-1)+4+l1+t]+"---"+record[96*((j/96)-1)+4+l1+t]+"---"+percent[96*((j/96)-1)+4+l1+t]);
}
DecimalFormat df=new DecimalFormat("##.00");
//System.out.println("max-----"+max+"per:"+df.format(per*100/4));
if(end+3<=rowNum){
HSSFRow r2 = ht.createRow((short)b);
HSSFCell hc1 = r2.createCell((short)0);
hc1=r2.getCell((short)0);
hc1.setCellValue(date[96*((j/96)-1)+4+l1]);
HSSFCell hc2 = r2.createCell((short)1);
hc2=r2.getCell((short)1);
String[] s=date[96*((j/96)-1)+4+l1].split(" ");
hc2.setCellValue(s[0]);
HSSFCell hc3 = r2.createCell((short)2);
hc3=r2.getCell((short)2);
hc3.setCellValue(max);
HSSFCell hc4 = r2.createCell((short)3);
hc4=r2.getCell((short)3);
hc4.setCellValue(df.format(per*100/4)+"%");
end=j+96;
}
else
{
break;
}
j=j+3;
//System.out.println("come in");
n=0;
}
}
wb.write(fo);
fo.close();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch(IOException e)
{
e.printStackTrace();
}
}
}