Hello java ranchers! I've read the topics here about jar and suns tutorial about jar. Doesn't seems to get it right anyway. I've created 2 classfiles in diffrent directory's ( testing protected etc ). The classes compile and it can be run without any compications. When I try too make a jar file it doesn't seems to work.
I've created the jar file like this jar cmf classLoader.txt test.jar chat\test\test.class chat\test1\test1.class in my classLoader.txt file it just say "Main-Class: chat\test1\test1". I have altso tested to just type "Main-class: test1" and "Main-Class: test1.class" and so on. The mainfest.mf seems to be right and the jarfile looks fine , but when I try too run it like this: java -jar test.jar I get an errormessage like this: Exception in thread main. NoClassDefoundError. How come when it runs without jar? Hope you can understand what I meen. Cheers
------------------ Preparing for the Java 2 Certification exam [This message has been edited by Snylt Master (edited July 10, 2001).]
Preparing for the Java 2 Certification exam
Joined: Jul 08, 2001
Put that in a file called wheretostart.txt
Joined: Sep 29, 2000
Where does your jar sit, and what is your classpath? Sometimes just putting the jar file IN the classpath helps.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Jul 07, 2001
I have included the jar file path in my classpath. Ive tried the wheretostart.txt. I dunno why the textfile must be named like this? Seems to me that i can name my testfile anything. All it does is copying the line in the textfile to the line in manifest.mf. Is there another way of making a jar file. I think it is my package declaration wich is wrong. Class test goes in package chat\test. and class test 1 goes in package chat\test1. When compiling I used the following line. javac chat\test\test.java javac chat\test1\test1.java which gave me to classfiles. I've added the following line to autoexec.bat PATH=%PATH%;"C:\Program\Mts";c:\jdk1.3\bin" Can't think of anything else to do. Please help. // Snylt Master