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.

running a class which use an external.jar

Thread view: 
wasabii - 19 Sep 2006 18:51 GMT
Hi all,
I have a class called myclass.class which is calling others classes in
external.jar file.

the external.jar and  myClass.class are both in my classpath, however java
is not able to found the jar

1) java myClass  ==> failed
2) java -cp external.jar myClass ==> failed

Note that myClass is not in the external.jar.

Accoring my understanding as both are in my classpath that shoud work
(example 1) right ?

Any idea ?

Thanks for you support,
Charlie
Andrew Thompson - 19 Sep 2006 23:00 GMT
> Hi all,
> I have a class called myclass.class

This should be named MyClass if you are following the usual
naming conventions, but I do not advise *ever* giving a class
such a generic (and stupid) name.

>...which is calling others classes in
> external.jar file.
>
> the external.jar and  myClass.class

Above you stated 'myclass', now it is 'myClass'?  Java is
case sensitive, so stick with the same capitalisation
throughout.

>...are both in my classpath, however java
> is not able to found the jar
>
> 1) java myClass  ==> failed

In this one 'external.jar' is not on the classpath, only the
'current directory', which presumably includes myClass/MyClass

> 2) java -cp external.jar myClass ==> failed

Now 'external.jar' has been put on the classpath, but
the current directory is not.

> Accoring my understanding as both are in my classpath that shoud work
> (example 1) right ?

No.

> Any idea ?

java -cp .;external.jar MyClass

[ BTW - Please always copy/paste your output. ]

Andrew T.
Knute Johnson - 19 Sep 2006 23:01 GMT
> Hi all,
> I have a class called myclass.class which is calling others classes in
[quoted text clipped - 15 lines]
> Thanks for you support,
> Charlie

Charlie:

You probably need .;extenal.jar in your class path.  Take a look at a
paper I just did on Java user class path and let me know if it is any help.

http://rabbitbrush.frazmtn.com/classpath.html

Signature

Knute Johnson
email s/nospam/knute/



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.