|
-
Oct 17th, 2005, 10:59 PM
#1
Thread Starter
Frenzied Member
need help...success in compile with .jar, but fail in running
I have a jar file that contains a package. I enter this command and it compiles:
javac -cp "C:\Program Files\Java\jdk1.5.0_05\bin\myPac.jar" app.java
but when I try to run the program by typing this command:
java -cp "C:\Program Files\Java\jdk1.5.0_05\bin\myPac.jar" app
It doesn't run and i get this exception error:
Exception in thread "main" java.lang.NoClassDefFoundError: app
Any ideas?
-
Oct 19th, 2005, 05:43 PM
#2
Frenzied Member
Re: need help...success in compile with .jar, but fail in running
Does the jar file contain a manifest file?
Not sure, but I believe you might have to specify the class file to run in a manifest file.
-
Oct 20th, 2005, 03:15 AM
#3
Re: need help...success in compile with .jar, but fail in running
Does the java command need a -jar switch to run a jar file?
-
Oct 20th, 2005, 05:20 AM
#4
Frenzied Member
Re: need help...success in compile with .jar, but fail in running
Yep, that's another thing you are missing.
Your running should look like this:
java -jar jar-file
But you also need the Main-Class header in the manifest file to indicate the entry point to the app.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|