I had written a program:
public class SystemShutdown {
public static void main(String[] args) {
try{
for(int i=0;i<10;i++){
Thread.sleep(1000);
}
Process p=Runtime.getRuntime().exec("shutdown -s -t 2700");
}catch(Exception e){}
}
}
I'd compiled and kept the .class
file separate.
Now, I'd write a manifest file as:
Manifest-Version: 1.0
Main-Class: SystemShutdown
And saved with the name MANIFEST.MF
I'd put both (the .class
file and the MANIFEST.MF
file) in same directory.
Now I want to create an Executable Jar
file. For that I'd done:
jar cvfm MyJar.jar *.*
A jar file is created after that.
But when I tries to execute it displays a message Java Exception occured
.
Can anybody help me out? I want to execute this program on the users double click.
Beside of the above scratch can anybody tell me the exact steps to be followed to create an executable jar?
I'm using Windows7 32bit
and jdk7