For Programmers: Free Programming Magazines  


Home > Archive > Java Help > September 2004 > Accessing a JAR File at runtime









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Accessing a JAR File at runtime
BoomerangThree

2004-09-22, 3:59 am

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!


BoomerangThree

2004-09-22, 3:59 am

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!
>



BoomerangThree

2004-09-22, 3:59 am

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!
>



Sambit Mukherjee

2004-09-22, 9:10 am

"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.
Andrew Thompson

2004-09-22, 9:10 am

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
BoomerangThree

2004-09-22, 9:10 am

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.



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com