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 / March 2007

Tip: Looking for answers? Try searching our database.

How to output to the console the current CLASSPATH ?

Thread view: 
Tintin92 - 30 Mar 2007 11:23 GMT
Hello,

How to output to the console the current CLASSPATH ?
A small program console is welcome.

Thanks,

Tintin92
Andrew Thompson - 30 Mar 2007 12:12 GMT
...
> How to output to the console the current CLASSPATH ?

Note that Sun has recommended for quite some
time, that the classpath should be set at
compile or run-time.  As such, if you have
one project compiling, and two executing, there
may be three separate and distinct classpath's.

> A small program console is welcome.

As is large amounts of cash (in small
denominations of non-consecutive serial
numbers).

Andrew T.
Real Gagnon - 30 Mar 2007 12:23 GMT
> How to output to the console the current CLASSPATH ?
> A small program console is welcome.

I believe that

String s = System.getProperty("java.class.path");

should do it.

You can get it with the new RuntimeMXBean too, example at

http://www.rgagnon.com/javadetails/java-0549.html

Bye.
Signature

Real Gagnon  from  Quebec, Canada
* Java, Javascript, VBScript or PowerBuilder snippets
* http://www.rgagnon.com/howto.html
* http://www.rgagnon.com/bigindex.html

rao - 30 Mar 2007 12:30 GMT
here we can specify all the files in the runt time by setting class
path with different files between we have to give semicolon
u can see the path ECHO command
Lew - 30 Mar 2007 14:32 GMT
> here we can specify all the files in the runt time by setting class
> path with different files between we have to give semicolon
> u can see the path ECHO command

"u" is a letter.

Classpath elements are directories, not files. Semicolon is the path delimiter
only for Windows.

A path, such as PATH or CLASSPATH, comprises path elements (directories)
separated by the path separator character (OS dependent).

The "ECHO" command is also OS dependent; in UNIX it's "echo".

Perhaps the OP intended for a Java-based solution to obtain the runtime
classpath, not the envar CLASSPATH?

-- Lew
Thomas Kellerer - 30 Mar 2007 14:42 GMT
> Classpath elements are directories, not files.

Not true.

The classpath definition can contain jar files (and zip files) as well,
not only directories.

Thomas
Lew - 30 Mar 2007 14:49 GMT
>> Classpath elements are directories, not files.
>
> Not true.
>
> The classpath definition can contain jar files (and zip files) as well,
> not only directories.

Yes, you are absolutely correct, and don't forget remote URLs.  I deliberately
omitted that consideration to stay in context with the OP's question.

-- Lew
Lew - 30 Mar 2007 14:50 GMT
>> Classpath elements are directories, not files.
>
> Not true.
>
> The classpath definition can contain jar files (and zip files) as well,
> not only directories.

Yes, you are absolutely correct.

-- Lew
Tintin92 - 30 Mar 2007 13:28 GMT
Thanks Real, for your code and your link.

Tintin92


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.