Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Accessing a JAR File at runtime
I have a Java application and it requires various classes that are contained
in JAR file to run.

When I attempt to run the Java application at the command line with Java
TodoList it returns an error that it cannot find the classes that are
contained in the jar file.

How do I allow the Java app to find the jar file and the classes within it?

Thanks!



Report this thread to moderator Post Follow-up to this message
Old Post
BoomerangThree
09-22-04 08:59 AM


Re: Accessing a JAR File at runtime
Disregard.  java -cp and path to jar file corrected the issue.


"BoomerangThree" <JM@Hotmail.com> wrote in message
news:10l1nirsv1hlpb0@corp.supernews.com...
>I have a Java application and it requires various classes that are
>contained in JAR file to run.
>
> When I attempt to run the Java application at the command line with Java
> TodoList it returns an error that it cannot find the classes that are
> contained in the jar file.
>
> How do I allow the Java app to find the jar file and the classes within
> it?
>
> Thanks!
>



Report this thread to moderator Post Follow-up to this message
Old Post
BoomerangThree
09-22-04 08:59 AM


Re: Accessing a JAR File at runtime
Ok, getting a bit dense at this hour.

Still having trouble getting my java application to find the jar file
napkinlaf.jar:

C:\Program Files\eclipse\workspace\ImportBonds>java ToDoList
Exception in thread "main" java.lang.NoClassDefFoundError:
napkin/NapkinLookAndFeel
at ToDoList.main(ToDoList.java:104)

I have tried placing the napkinlaf.jar in the same dir, and in a dir napkin
with no luck.

Can someone have pity on this poor soul???




"BoomerangThree" <JM@Hotmail.com> wrote in message
news:10l1nirsv1hlpb0@corp.supernews.com...
>I have a Java application and it requires various classes that are
>contained in JAR file to run.
>
> When I attempt to run the Java application at the command line with Java
> TodoList it returns an error that it cannot find the classes that are
> contained in the jar file.
>
> How do I allow the Java app to find the jar file and the classes within
> it?
>
> Thanks!
>



Report this thread to moderator Post Follow-up to this message
Old Post
BoomerangThree
09-22-04 08:59 AM


Re: Accessing a JAR File at runtime
"BoomerangThree" <JM@Hotmail.com> wrote in message news:<10l1p1mee9qj3a8@corp.supernews.com
>...
> Disregard.  java -cp and path to jar file corrected the issue.
>

I am facing a similar problem - the error is as follows:
Failed to load Main-Class manifest attribute from demo.jar

When I double-click the jar file from windows, a dialog window(titled
Virtual Machine Launcher)pops up saying:
Couls not find the main class. Program will exit.

This is happenning with all my jar files(including the demo ones that
come with the SDK).

Could you please give details of the above mentioned method(the exact
command perhaps)? Or is it that something is wrong with my JRE?

Thank you.

Report this thread to moderator Post Follow-up to this message
Old Post
Sambit Mukherjee
09-22-04 02:10 PM


Re: Accessing a JAR File at runtime
On 22 Sep 2004 03:35:49 -0700, Sambit Mukherjee wrote:

> Failed to load Main-Class manifest attribute from demo.jar
>
> When I double-click the jar file from windows, a dialog window(titled
> Virtual Machine Launcher)pops up saying:
> Couls not find the main class. Program will exit.
>
> This is happenning with all my jar files(including the demo ones that
> come with the SDK).

Which of Sun's demos (path/file names) specifically?
Many of Sun's .jars are not appropriate for 'double
click launch'.

Try the Jar you can download from here..
<http://www.physci.org/pc/property.jsp>
It is the 'JTest' link directly below the title
'System Properties'

If that loads OK when you double click it,
it is not a problem with your JRE.

--
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane

Report this thread to moderator Post Follow-up to this message
Old Post
Andrew Thompson
09-22-04 02:10 PM


Re: Accessing a JAR File at runtime
After many tries at the CLASSPATH I finally figured out the syntax.  What I
kept missing was that the path to my additional jar files requires ".;".  So
my batch file to run my app now looks like:

SET CLASSPATH=.;C:\Program  Files\eclipse\workspace\ImportBonds\napk
inlaf.jar
javaw ToDoList



"Sambit Mukherjee" <sambitmukherjee@hotmail.com> wrote in message
news:d6f2b0a1.0409220235.6b5ae249@posting.google.com...
> "BoomerangThree" <JM@Hotmail.com> wrote in message
> news:<10l1p1mee9qj3a8@corp.supernews.com>... 
>
> I am facing a similar problem - the error is as follows:
> Failed to load Main-Class manifest attribute from demo.jar
>
> When I double-click the jar file from windows, a dialog window(titled
> Virtual Machine Launcher)pops up saying:
> Couls not find the main class. Program will exit.
>
> This is happenning with all my jar files(including the demo ones that
> come with the SDK).
>
> Could you please give details of the above mentioned method(the exact
> command perhaps)? Or is it that something is wrong with my JRE?
>
> Thank you.



Report this thread to moderator Post Follow-up to this message
Old Post
BoomerangThree
09-22-04 02:10 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:19 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.