Setting the Java classpath in Windows through command prompt

Q: How to set path for java in windows through command prompt. I don't want to set path permanently from my computer icon with advanced tab with environment variables . what is command to set path for java

CLASSPATH

In JDK the CLASSPATH contains directories (or JAR files), from where your java compiler/runtime will look for .class files (and some others). For example, "java Hello.class" will not work unless you set the directory (or JAR file) Hello.class is in, into your CLASSPATH.
i.e.classpath  C:\Java\jdk1.6.0_03\lib

For setting CLASSPATH using command prompt

Java class path can be set using either the -classpath option when calling an SDK tool (the preferred method) or by setting the CLASSPATH environment variable. The -classpath option is preferred because you can set it individually for each application without affecting other applications and without other applications modifying its value.

(ii)on command prompt

C:\>set classpath=%classpath;C:\Java\jdk1.6.0_03\lib%

No comments:

Post a Comment

Please Provide your feedback here