Hello everyone,
I am a beginner Java programmer and need your help in understanding What are Environment
variables?
I do not use any IDE for Java programming at present and use Command Prompt instead

I would like to know about what is a CLASSPATH Variable and Is Classpath variable same as what we set using set path="___" in Command prompt?

I particularly face problems when I try using the user defined packages in Java..

Thank You

Think of environment variables as OS specific variables e.g. JAVA_HOME. In windows you set them using the command set JAVA_HOME="c:/Java" , in *nix, you do it as export JAVA_HOME=/env/java . More info here.

AFAIK, the CLASSPATH environment variable is used by your JVM process to "search" for classes. But I would rather recommend not to mess with environment variables and use the -classpath switch (for both java and javac). This would ensure that all the dependencies are explicitly mentioned.

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.