answersLogoWhite

0


Best Answer

In Windows:

  • Copy the lib path of the java jdk from where it is installed.
  • Open command promt.
  • Type the following command.

set CLASSPATH=

Example:

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

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

Because, the JVM needs to know the location on the machine where it can find all the components it requires to run. Ex: JDK, JARS etc

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How does you set the path of java progrramig?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you set path in java?

1. install JdK 2. include JDK_HOME/bin in your PATH environment variable


What is classpath and path in java?

if you are using the IDE then there is no need to set class path, ant you are using Command prompt to run the java program then you need to set the class path where the class (which is going to be used in your program) is actually located,use the following command:set calsspath=%classpath%;actual_path_of the class;we cancall more than two class by using this command by using separator (,)


Why path and class-path in java?

1))What is the difference between "path" and "classpath"? Ans:: We keep all "executable files"(like .exe files) and "batch files"(like .bat) in path variable. And we keep all jar files and class files in classpath variables. So path is set according to the .exe files & .bat files And classpath is set according to the .jar files & .class files. Operating system tries to find .exe and .bat files in path and JVM tries to find all classes in classpath.


How you check that path is set for java compiler?

Open command window "cmd" from Windows prompt. Type in "javac" in the window. The command should execute giving full usage of javac and its options. If you get an error message saying that "Javac is not a recognized as an internal or external command", than the Path has not been set.


Command use on how to run a java program?

You execute it the same way you would on any other OS. As long as you have the Java Runtime Environment installed and the "java" executable is in your path, from the command line you would simply run: java -cp /path/to/file/here com.some.class.to.run.Here

Related questions

Why it is required to set path and classpath?

to compile and run java program you need to set path and classpath path refers to binary used to compile and run java program i.e. "javac" for compilation and "java" for execution


How do you set java environment variables?

You need to set The CLASSPATH variable which is an argument set on the command-line that tells the Java Virtual Machine where to look for user-defined classes and packages in Java programs. Syntax is java -classpath "path to the packages". Set the PATH variable if you want to be able to conveniently run the Java 2 SDK executables (javac.exe, java.exe, javadoc.exe, etc.) from any directory without having to type the full path of the command. To set the PATH permanently, add the full path of the j2sdk1.4.2_version\bin directory to the PATH variable. -sravyaa


How do you set path in java?

1. install JdK 2. include JDK_HOME/bin in your PATH environment variable


Why does java does not run on Linux?

the short answer is that it does. assuming you have java installed and your path set, it's as easy as javac javafilename.java java javafilename or if you have it as a jar file java -jar jarfilename.jar


What is classpath and path in java?

if you are using the IDE then there is no need to set class path, ant you are using Command prompt to run the java program then you need to set the class path where the class (which is going to be used in your program) is actually located,use the following command:set calsspath=%classpath%;actual_path_of the class;we cancall more than two class by using this command by using separator (,)


How do you set core java class path?

in Windows : specify environment variable as classpath orset classpath="list of directories" e.g. set classpath="C:\java\lib"in Linux export CLASSPATH="your classpath" e.g. export CLASSPATH="/home/java/lib"


What is the name of the command to run a java program?

javausage: java path\FooBar will execute path\FooBar.class


Why path and class-path in java?

1))What is the difference between "path" and "classpath"? Ans:: We keep all "executable files"(like .exe files) and "batch files"(like .bat) in path variable. And we keep all jar files and class files in classpath variables. So path is set according to the .exe files & .bat files And classpath is set according to the .jar files & .class files. Operating system tries to find .exe and .bat files in path and JVM tries to find all classes in classpath.


My runescape Private server DOS batch file won't open?

This may be because you have not either installed your java properly or you haven't set the PATH of your java properly or just simply your java is out of date and needs updating.


How do you change the current directory to 'etcjavabin' and append this path to existing PATH settings?

To change the current directory to /etc/java/bin, use the command "cd /etc/java/bin".To add the above path to the PATH variable, type export PATH="$PATH:/etc/java/bin".To check whether you have successfully added that PATH, type "echo $PATH".To permanently add /etc/java/bin to PATH variable, edit /etc/profile or ~/.bashrc file and add the command, export PATH="$PATH:/etc/java/bin". (NOTE: After adding, you will need to reboot the machine or type "source /etc/profile" or "source ~/.bashrc".


Define set in java?

A Java set is a collection of things that do not contain duplicate elements. Duplicates are prohibited from Java sets.


Can you use Java commands in the Command Prompt e.g. java and javac if you aren't logged in as an admin?

Yes. Just make sure you have the path to the programs in your PATH environment variable.