[J2SE] jar 目前資料夾的所有class
之前找到的 給大家參考
引數 給主要run的class
有錯請指教
import java.io.*;
class jpack
{
public static void main(String args[]) throws Exception {
if(args.length==0)
{
System.out.println("請輸入主類別名稱 !");
System.exit(0);
}
BufferedWriter bw=new BufferedWriter(new FileWriter("manifest"));
bw.write("Main-Class: "+args[0]+"\r\n");
bw.close();
String doc = "";
File file = new File(".");
String[] f = file.list();
for(int i=0;i<f.length;i++)
{
if(f[i]!="jpack.class")
{
doc+=" "+f[i];
System.out.println("已找到 "+f[i]+" !");
}
}
Runtime.getRuntime().exec("jar cvfm "+args[0]+".jar manifest "+doc);
System.out.println("成功建立 "+args[0]+".jar !");
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.228.157.98
推
08/23 22:56, , 1F
08/23 22:56, 1F
推
08/23 22:57, , 2F
08/23 22:57, 2F
→
08/23 23:42, , 3F
08/23 23:42, 3F
噓
08/24 07:45, , 4F
08/24 07:45, 4F
→
08/24 12:32, , 5F
08/24 12:32, 5F