• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with jar

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put that in a file called wheretostart.txt
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where does your jar sit, and what is your classpath?
Sometimes just putting the jar file IN the classpath helps.
 
Snylt Master
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic