Results 1 to 4 of 4
Thread: main class not found
- 09-26-2009, 10:42 AM #1
Member
- Join Date
- Sep 2009
- Posts
- 24
- Rep Power
- 0
main class not found
i want to develop jar file of my application..
i have set the main class of jar file in Manifest.txt file
I have created a jar file using command:
jar cf Bluetooth.jar Manifest.txt javaapplication10.Bluetooth.class
(javaapplication10) is the name of package..
after this when i try to execute the jar file using command:
>>java -jar Bluetooth.jar
it is throwing the exception as:
NoClassDefination Found
please let me know what is problem with this.
is i'm missing any step of jar creation?
- 09-30-2009, 07:39 PM #2
quite possibly the class you have placed into the jar file has a dependency on another class that is not included into the jar file.
For example, if I create a jar file that depends on the commons-logging or log4j (has a local reference to the logger component) then my classpath needs to include those third party jar files.
For the jar to run with java -jar, in addition to specifying the Main-Class attribute, you can also set a Class-Path attribute, which should be a relative path to the location of the other dependent jar files.
See also: Adding Classes to the JAR File's Classpath (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files)
- 10-01-2009, 06:57 AM #3
Member
- Join Date
- Sep 2009
- Posts
- 24
- Rep Power
- 0
Thank u very much 4 ur help.
but i'm still having the same problem.
Now I'm having two text files viz., Manifest.txt and Manifest1.txt
contents of Manifest.txt are:
Main-Class: BluetoothServiceDiscovery.class
contents of Manifest1.txt are:
Class-Path: avetanaObex.jar bluecove.jar BlueCoveJSR82.jar
now i've created the jar file using the following command
jar cfv blue.jar Manifest.txt Manifest1.txt BluetoothServiceDiscovery.class
it is creating the jar file properly.by giving the following o/p on command prompt:
added manifest
adding: Manifest.txt(in = 59) (out= 46)(deflated 22%)
adding: Manifest1.txt(in = 60) (out= 54)(deflated 10%)
adding: BluetoothServiceDiscovery.class(in = 11342) (out= 5852)(deflated 48%)
but when i try to run the blue.jar file using following command:
java -jar blue.jar
it's showing the same error:
Failed to load Main-Class manifest attribute from blue.jar
Please let me know what is problem?
- 10-01-2009, 09:05 AM #4
Member
- Join Date
- Sep 2009
- Posts
- 24
- Rep Power
- 0
Similar Threads
-
No Class Def Found Error:
By fithous in forum Java AppletsReplies: 0Last Post: 04-02-2009, 05:30 PM -
No main class found error
By jhering1986 in forum New To JavaReplies: 17Last Post: 03-28-2009, 02:34 AM -
Simple program compiles but main class is not found-- not sure why
By damong in forum New To JavaReplies: 4Last Post: 01-01-2009, 03:58 AM -
xception in thread "main" java.util.NoSuchElementException: No line found
By Tenn in forum New To JavaReplies: 12Last Post: 12-05-2008, 05:37 AM -
No Class Def Found Error:
By wrap23 in forum New To JavaReplies: 9Last Post: 10-02-2008, 04:07 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks