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 / February 2008

Tip: Looking for answers? Try searching our database.

What's the effect in different classpath set?

Thread view: 
525 - 28 Feb 2008 00:38 GMT
when setting the environment variable, one of the steps is to set the
classpath.   Some books use this:  classpath=c:\jdk\lib\tools.jar; c:
\jdk\lib\dt.jar;   Anothers use this:    c:\jdk\lib  .  Q:  Any
different?
Lew - 28 Feb 2008 00:48 GMT
> when setting the environment variable, one of the steps is to set the
> classpath.   Some books use this:  classpath=c:\jdk\lib\tools.jar; c:
> \jdk\lib\dt.jar;   Anothers use this:    c:\jdk\lib  .  Q:  Any
> different?

Neither one works.  The environment variable is 'CLASSPATH', not 'classpath',
and you don't put spaces in it.

Even after correcting those errors, the second form will not pick up the JAR
files, nor is the first form isn't necessary because the JARs in the
$JAVA_HOME/lib/ directory don't need to be part of the classpath explicitly.

In any event, all your questions should be answered by the information in the
documentation:
<http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html>

I strongly recommend that you do not use the CLASSPATH envar, but use the
-classpath (or -cp) option to your Java tools.  CLASSPATH is far too global.

Also, read
<http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html>

Signature

Lew

Arne Vajhøj - 28 Feb 2008 01:20 GMT
>>        Some books use this:  classpath=c:\jdk\lib\tools.jar;
>       nor is the first form isn't necessary because the JARs in the
> $JAVA_HOME/lib/ directory don't need to be part of the classpath
> explicitly.

I don't think tools.jar is in classpath by default.

> I strongly recommend that you do not use the CLASSPATH envar, but use
> the -classpath (or -cp) option to your Java tools.  CLASSPATH is far too
> global.

Very good advice.

Arne
525 - 28 Feb 2008 05:11 GMT
> > when setting the environment variable, one of the steps is to set the
> > classpath.   Some books use this:  classpath=c:\jdk\lib\tools.jar; c:
[quoted text clipped - 20 lines]
> --
> Lew

Thanks!!   Another question is:  Can we ignore the CLASSPATH set if we
use the IDE (like the NetBeans) to program?
Mark Space - 28 Feb 2008 01:06 GMT
> when setting the environment variable, one of the steps is to set the
> classpath.   Some books use this:  classpath=c:\jdk\lib\tools.jar; c:
> \jdk\lib\dt.jar;   Anothers use this:    c:\jdk\lib  .  Q:  Any
> different?

My classpath is:

CLASSPATH='.;C:\Program Files\Java\jre1.6.0_03\lib\ext\QTJava.zip'

c:\jdk in your path may refer to the path to the actual JDK.  On Windows
it should be closer to something like mine.

Hey I just realized that lib\ext should be included by default, right?
So why the heck did QTJava want to add itself to the classpath in that
manner?
Roedy Green - 28 Feb 2008 02:18 GMT
On Wed, 27 Feb 2008 16:38:41 -0800 (PST), 525
<xuemingzhang525@gmail.com> wrote, quoted or indirectly quoted someone
who said :

>when setting the environment variable, one of the steps is to set the
>classpath.   Some books use this:  classpath=c:\jdk\lib\tools.jar; c:
>\jdk\lib\dt.jar;   Anothers use this:    c:\jdk\lib  .  Q:  Any
>different?

Classpath is broken.  It won't looks for jars given just the dir
names.

See http://mindprod.com/jgloss/classpath.html
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


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



©2008 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.