aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLyBird: runme.jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "URLyBird: runme.jar" Watch "URLyBird: runme.jar" New topic
Author

URLyBird: runme.jar

Santosh Joseph
Greenhorn

Joined: Jun 10, 2004
Posts: 7
I'm having a problem with running my application through the jar file:
I get the following error when i run my program.

C:\sun_certification>java -jar runme.jar alone
Exception in thread "main" java.lang.NoClassDefFoundError: suncertify/Runme

The Main-class attribute of my manifest file is: suncertify.Runme

this is the contents of my jar:
C:\sun_certification>jar -tf runme.jar
code/suncertify/db/RecordNotFoundException.class
code/suncertify/db/Data.java
code/suncertify/db/DuplicateKeyException.class
code/suncertify/db/DuplicateKeyException.java
code/suncertify/db/DBAccess.class
code/suncertify/db/SecurityException.java
code/suncertify/db/RecordNotFoundException.java
code/suncertify/db/SecurityException.class
code/suncertify/db/DBAccess.java
code/suncertify/client/URLyBirdClient.java
code/suncertify/client/URLyBirdClient$1.class
code/suncertify/client/URLyBirdClient.class
code/suncertify/server/URLyBirdServer.class
code/suncertify/server/URLyBirdServer.java
code/suncertify/Runme.class
code/suncertify/Runme.java
db-1x3.db
docs/choices.txt
docs/instructions.html
docs/userguide.txt
version.txt
META-INF/MANIFEST.MF

Is my Main-class attribute wrong? The Runme class just checks the command-line argument and lauches the server or client.
thanks in advance.
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
the Runme class seems to be in a package code.suncertify. That is probably what is causing the error.


Anton Golovin (anton.golovin@gmail.com) SCJP, SCJD, SCBCD, SCWCD, OCEJWSD, SCEA/OCMJEA [JEE certs from Sun/Oracle]
Santosh Joseph
Greenhorn

Joined: Jun 10, 2004
Posts: 7
Shouldn't suncertify be the top-level package statement? I know the the DBAccess interface and db exception classes should be suncertify.db (from the instructions), but is there any restriction on where the other code should be packaged? Then I could put the Runme class in the code.suncertify package instead of suncertify.
Anton Golovin
Ranch Hand

Joined: Jul 02, 2004
Posts: 476
Originally posted by Santosh Joseph:
Shouldn't suncertify be the top-level package statement? I know the the DBAccess interface and db exception classes should be suncertify.db (from the instructions), but is there any restriction on where the other code should be packaged? Then I could put the Runme class in the code.suncertify package instead of suncertify.


Hi, Satish!

My specification makes it clear that code must be in code directory. It does not make it very clear where the class files are to be. However, in relation to your question in the thread, the reason your program does not find the file is because it looks for it in the suncertify directory off the main jar directory, but the file is located in the code/suncertify directory.


C:\sun_certification>jar -tf runme.jar
code/suncertify/db/RecordNotFoundException.class
code/suncertify/db/Data.java
code/suncertify/db/DuplicateKeyException.class
code/suncertify/db/DuplicateKeyException.java
code/suncertify/db/DBAccess.class
code/suncertify/db/SecurityException.java
code/suncertify/db/RecordNotFoundException.java
code/suncertify/db/SecurityException.class
code/suncertify/db/DBAccess.java
code/suncertify/client/URLyBirdClient.java
code/suncertify/client/URLyBirdClient$1.class
code/suncertify/client/URLyBirdClient.class
code/suncertify/server/URLyBirdServer.class
code/suncertify/server/URLyBirdServer.java
code/suncertify/Runme.class
code/suncertify/Runme.java
db-1x3.db
docs/choices.txt
docs/instructions.html
docs/userguide.txt
version.txt
META-INF/MANIFEST.MF


It looks for the file suncertify/RunMe, but the runme file is here: code/suncertify/RunMe. There is no way to fix this problem except by moving your class files in the suncertify directory out of the code directory to the same level the code directory is at.

Hope this helps!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URLyBird: runme.jar