Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

URLyBird: runme.jar

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the Runme class seems to be in a package code.suncertify. That is probably what is causing the error.
 
Santosh Joseph
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 531
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!

 
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic