Hi all,
I have the following Java code. It does what it is meant to do, but I am having problems creating a jar file.
import java.io.*;
public class openfile{
public static void main(String argv[]) {
try {
String line;
Process p = Runtime.getRuntime().exec
("c:\\Users\\user\\Desktop\\"+ "shares.bat /A");
BufferedReader input =
new BufferedReader
(new InputStreamReader(p.getInputStream()));
input.close();
}
catch (Exception err) {
err.printStackTrace();
}
}
}
It compiles no problem, It runs no problem when using java openfile. The problem arises when I try to create a jar file using the following commands:
jar cf MyJar.jar manifest.txt openfile.java openfile.class
However when I try to run the jar using
java -jar MyJar.jar
I get the following error message:
Failed to load Main-Class manifest attribute from MyJar.jar
The text of manifest.txt is as follows:
Main-Class: openfile
Any idea what I am doing wrong?