我把程序导出jar 但是在main方法中需要一个文件路径 这个如果输入就读取输入路径 如果不输入则动态获取
public static void main(String[] args) {
if (args[0]!=null) {
readZip.upZipFile(args[0]);
}
else {
SimpleDateFormat timeformat = new SimpleDateFormat("yyyyMMdd");
String temptime = timeformat.format(new Date());
StringBuffer sb = new StringBuffer();
sb.append("accessinfo_");
sb.append(temptime);
sb.append(".zip"); readZip.upZipFile("E:\\pro\\data"+sb.toString());
}
}但是现在输入路径是对的 不输入路径就会报错 求大神解决
public static void main(String[] args) {
if (args[0]!=null) {
readZip.upZipFile(args[0]);
}
else {
SimpleDateFormat timeformat = new SimpleDateFormat("yyyyMMdd");
String temptime = timeformat.format(new Date());
StringBuffer sb = new StringBuffer();
sb.append("accessinfo_");
sb.append(temptime);
sb.append(".zip"); readZip.upZipFile("E:\\pro\\data"+sb.toString());
}
}但是现在输入路径是对的 不输入路径就会报错 求大神解决
解决方案 »
- jsp点击左边按钮 在右边空白处显示数据
- debug启动tomcat抛出NoSuchMethodException?
- 出个关于数组的问题。大家来试试
- 网站发布的问题
- checkbox 页面跳转传值
- jsp如何获取url里的参数
- 一个关于多选框和删除工作的问题,急,在线等!
- (请教)关于Java Web 开发的一个细节问题
- 从一个JSP如何给另一个JSP传参数?
- 200分。。。。那里有Programming Jakarta Struts(全) 下载?
- 急!急!急!在线等!项目已启动就报这个错org.springframework.beans.factory.BeanCreationException
- AJAX 的URL因该怎么写才能跳转到servlet
readZip.upZipFile("E:/xx.zip");试试呢。。
可以改成
if (args.length!=0) {
readZip.upZipFile(args[0]);
}