[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

CLASSPATH of specifi JAR vs CLASSPATH of directory

Posted on 2001-07-19
8
Medium Priority
?
407 Views
Last Modified: 2013-11-23
Hi !

Suppose I have some JAR file, whcih should be in my CLASSPATH. Is there any difference when I set my CLASSPATH as c:\MYJava\SomeJar.jar or c:\MYJava.

I understand, that with the "directory" way all my JARs at this path would be in CLASSPATH. Is there any other differences ?

Thanks.
0
Comment
Question by:ab11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 3

Expert Comment

by:exorcist
ID: 6298108
No, that's wrong. Jar files are only accessible if you have the specific jar file in your classpath. Just pointing the classpath at the directory where the jar file is is not enough.
0
 
LVL 9

Expert Comment

by:Ovi
ID: 6298113
Nope
0
 

Expert Comment

by:LG_Goundalkar
ID: 6298130
Taht is Wrong.
You have to specify the .jar or .zip file name in the Classpath environment variable setting.
If you specify the directory the classes in the directory will be considered.

Thanks.
LGG
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Expert Comment

by:exorcist
ID: 6298163
I have to correct my post a little.

There is one exception to it. Jar files put into the directory [javadir]/jre/lib/ext/ are all accessible just as if they were in your CLASSPATH.

So instead of changing your CLASSPATH, you can also copy the jar files in this directory.
0
 
LVL 1

Expert Comment

by:tahir_naeem
ID: 6298207
The directory '[javadir]/jre/lib/ext/' is an exception to this rule. Sun declares that this directory should be used for standard extensions (or extensions that might be considered as standard). In all other cases you have to specify the fully qualified path of the .jar file not the parent directory. In other such example is also seen in WAR (web archive) files where you place all library jar files under <app_root>/WEB-INF/lib, they are automatically included in CLASSPATH of the web application.
0
 

Author Comment

by:ab11
ID: 6298265
So, if I summirize:

1. I have to settle the full CLASSPATH for the JAR, including the JAR name.
2. For my standard *.class files I specify the CLASSPATH, which contains the derictory
3. I can put my JAR file in '[javadir]/jre/lib/ext/ and it will be automatically inckuded in my CLASSPATH.

Is this correct ?
0
 
LVL 3

Accepted Solution

by:
exorcist earned 400 total points
ID: 6298282
1. true
2. true
3. the jar is not included in your CLASSPATH (CLASSPATH is an environmental vairable), but you can use it as if it were in your CLASSPATH. So it's basically the same.
0
 

Author Comment

by:ab11
ID: 6299916
Thanks for help of all of you :)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question