Inspect CLASSPATH inside the JVM

P

ps2rox

Is possible to get the CLASSPATH using Java commands?

Blablabla.getClasspath() or something like this...

Thanks in advance.

Paulo Silvestre Schmitt.
 
F

Ferenc Hechler

Is possible to get the CLASSPATH using Java commands?

Blablabla.getClasspath() or something like this...

Thanks in advance.

Paulo Silvestre Schmitt.
The system-Property "java.class.path" contains the classpath.
Inside a jar this wont work, because the class-path defined
in the manifest is not set.
Perhaps you can find some info from the current ClassLoader?

Best regards,

feri
 
T

Tony Morris

Ferenc Hechler said:
The system-Property "java.class.path" contains the classpath.
Inside a jar this wont work, because the class-path defined
in the manifest is not set.
Perhaps you can find some info from the current ClassLoader?

Best regards,

feri

It will most definitely work - whether or not this meets the objective is
another matter.
Calling System.property("java.class.path") will always return the
java.class.path system property, regardless of any VM invocation properties.
 
F

Ferenc Hechler

Tony said:
Calling System.property("java.class.path") will always return the
java.class.path system property, regardless of any VM invocation properties.
this is true, but if you write a manifest
containing "Class-Path: lib/abc.jar config/" and start the jar using
"java -jar my.jar" the java.class.path property is empty, thogh the
lib/abs.jar is loaded and config-files in config/ are found.
Which means the Jar-File Class-Loader does not only
look in the java.class.path

Best regards,

feri
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top