0

hey everyone,

i am a new developer using the bluej IDE on mac 10.6. Whenever i use the virtual terminal to execute, it works perfectly. the other day, i attempted to export the file to a JAR file through the programs basic functionality, as JAR files are natively run on macs. Everything works fine, I define the main class, include the source code, it exports with no problem. However, whenever i try to launch it, i get the error message:

"The Java JAR file "Pythagorean.jar" could not be launched. Check the console for possible error messages."

So i tried launching it using the java (file path) command, and i get the following error;

"Exception in thread "main" java.lang.NoClassDefFoundError: /Users/tstacey95/Desktop/Pythagorean/jar
Caused by: java.lang.ClassNotFoundException: .Users.tstacey95.Desktop.Pythagorean.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

Please help, as i am anxious to get the file exported and ready for distribution as a JAR file.

2
Contributors
10
Replies
11
Views
7 Years
Discussion Span
Last Post by NormR1
0

It looks like you left off the -jar option with the java command.
The missing class in the message looks like the path to the jar file:
.Users.tstacey95.Desktop.Pythagorean.jar

For executing jar files use the -jar option on the command line:
java -jar Pythagorean.jar

0

tried that, got the error message:


Exception in thread "main" java.lang.NoSuchMethodError: main

0

Does the jar file contain a manifest file? Does the manifest file have a line with:
Main-Class: ? What follows the Main-Class: ? That should be the name of the class with the main method. If the Main-Class: entry has a class name, does that class have the correctly formatted main method?

0

Does the jar file contain a manifest file? Does the manifest file have a line with:
Main-Class: ? What follows the Main-Class: ? That should be the name of the class with the main method. If the Main-Class: entry has a class name, does that class have the correctly formatted main method?

0

the MANIFEST.MF file is the META-INF folder was as such:

Manifest-Version: 1.0
Class-Path:
Main-Class: Pythagorean

0

yes, it runs perfectly in the virtual terminal. the problem is when i try to export it

0

Please show the ALL of the console with the problem when you try to execute the jar file.

0

ok, strange occurrence. after re-trying the java -jar command, the program launched. however, it will not launch through the JAR launcher method

0

it will not launch through the JAR launcher method

What is the 'JAR launcher method'? Is it an IDE menu item?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.