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