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
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.
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