I created a project wich plays simple ivr prompt, then compiled it and made a jar file. but I don't know how to run it.
I tried alternative way: placed .class files in usr/services/simpleProject/classes path and mapped it correctly then it works. But I need to run it with .jar file, any sugessions?
Asked
Active
Viewed 617 times
0

LeXuS
- 19
- 2
- 8
-
`java -jar example.jar` doesn't work? – Dawnkeeper Jan 23 '15 at 10:51
-
Have you got a `manifest` file ? – Héctor Jan 23 '15 at 11:14
-
@Dawnkeeper no it asks main class – LeXuS Jan 23 '15 at 12:25
2 Answers
-1
I believe you did't include a MANIFEST file in your jar. Take a look at Documentation.
Alternatively you can run the jar file as mentioned in this question without specifying the main class.

Community
- 1
- 1

SilenyHobit
- 99
- 3
-
-
has this main class a `public static void main(String[] aargh)` method? – Dawnkeeper Jan 23 '15 at 12:28
-
Can you show us the manifest file contents? Posting the file structure inside your jar wouldn't hurt either. – SilenyHobit Jan 23 '15 at 12:42
-1
Perhaps an example would help!
If Unix-based...
mkdir mypkg
cat > mypkg/MyClass.java
package mypkg;
public class MyClass {
public static void main(String[] args) {
System.out.println("executing main!");
}
}
[give Control-D]
javac mypkg/MyClass.java
cat > manifest.txt
Main-Class: mpkg.MyClass
[give Control-D]
jar cfm MyJar.jar manifest.txt mypkg/*.class
java -jar MyJar.jar
Should yield:
executing main!
If Windows-based...
mkdir mypkg
copy con: mypkg\MyClass.java
package mypkg;
public class MyClass {
public static void main(String[] args) {
System.out.println("executing main!");
}
}
[give Control-Z]
javac mypkg\MyClass.java
copy con: manifest.txt
Main-Class: mpkg.MyClass
[give Control-Z]
jar cfm MyJar.jar manifest.txt mypkg\*.class
java -jar MyJar.jar
Should yield:
executing main!

unigeek
- 2,656
- 27
- 27