Hi all,

Is there any way to get the location of the CLASSPATH environment variable within a pragram.

I need to get the location of rt.jar so that I can dynamically load the classes within that jar file using URLClassLoader.

thanks in advance.

Recommended Answers

All 4 Replies

I don't know where the OS keeps its value of the CLASSPATH environment variable.
If you want to get the current value of the CLASSPATH variable, see System Properties:
java.class.path and sun.boot.class.path

Thanks for you help, but I do need the value of the OS CLASSPATH.
Does anyone know any other System properties that would return this.

thanks.

Also look at the System class. It has method(s) to get the environment variables.

Awesome, thanks for your help.

System.getenv("CLASSPATH")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.