I tried to create jar file using command line that I inserted into java code, but it didn’t work. The java code was like this:
try {
Runtime a = Runtime.getRuntime();
a.exec("cmd cd E:/My data/Final Project/Uji Coba bikin Jar & E: & jar cfm D:/EditingDiniApp.jar META-INF/MANIFEST.MF EditingDini META-INF net org");
} catch (IOException ex) {
Logger.getLogger(JarFactory.class.getName()).log(Level.SEVERE, null, ex);
}
I copied the command into cmd.exe and it worked, but if it embed into java, it won’t work.
Was there anything that I miss to do?
Thanks..
Write the code to create a jar in a file through java code. Name it xxx.bat.
Thread.sleep(5000);
And then use the exec command to execute the bat file. This works for me.
EDIT:
By the way I thought you are doing this for fun. But if you are new to java, I would suggest using Ant. Ant is used for packaging applications , deploying etc etc in java http://ant.apache.org