Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

JAR file runtime error caused by CLASSPATH

Thread view: 
PhilBray - 19 Sep 2006 23:57 GMT
Hello,

I am having an absolute nightmare trying to get a JAR file that I built
within Eclipse to run via a double click windows environment. I know
that the problem relates back to my CLASSPATH but I am having no luck
at all resolving the issue.

I have about 15 external JAR files that I need to reference from my JAR
and therefore I need to setup a CLASSPATH that will point to all the
external JAR's. I have tried building a manifest file by hand and I
have tried all the CLASSPATH configuration settings that I can find.
Everytime I keep getting a java.lang.NoClassDefFoundError after running
the following command:

java -jar myjarfile.jar

The NoClassDefFoundError relates to a class that exists within one of
my external JAR files. When I use Eclipse to create the JAR it does not
seem to add any 'Class-Path' attribute to it and when I add it myself
Eclipse complains about invalid header sections e.g.

Manifest-Version: 1.0
Class-Path: lib\external_jar_one.jar
Main-Class: com.myapp.mainclass

Does anybody have an easy step by step approach that I can follow that
will get me where I want to be? I will be forever greatful.

Many thanks in advance,

Phil
hiwa - 20 Sep 2006 01:18 GMT
> Hello,
>
[quoted text clipped - 27 lines]
>
> Phil
If your current directory is PhilB

C:\PhilB> java -jar myjarfile.jar

Then your myjarfile.jar internal structure should be:

comp\myapp\mainclass.class
---and other classes honoring original package structures as above.

And your external_jar_one.jar should be stored as:

C:\PhilB\lib\external_jar_one.jar


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.