Question:
how to set path for a java program?
?
2010-09-07 07:26:53 UTC
how to set path for a java program?
Three answers:
?
2010-09-07 08:53:57 UTC
Even though you have installed java on you system you computer does not know where to look for it.

when you run javac command on it says no such command error.



java compiler is in "jdk1.6.0_21\bin" folder(javac.exe is the compiler).



to tell your system to look at this path you have to set environment variable.

Go to Control Panel->System



System properties window will open. go to Advance Tab and click Environment Variable.



Environment variable window will open Click on New button.



Set Variable_name to PATH.

and Variable_value to the path where java is installed for example

C:\Program Files\Java\jdk1.6.0_21\bin



http://javacodespot.blogspot.com/
nik 2706
2010-09-07 07:29:59 UTC
Setting PATH and CLASSPATH

Determining the current values of PATH and CLASSPATH

Unix

Type these commands in a command window:



echo $PATH

echo $CLASSPATH



If you get a blank command line in response to either of these, then that particular variable has no value (it has not yet been set).

Windows

Type these commands in a command window:



echo %PATH%

echo %CLASSPATH%



If you get the message "echo is on" for either of these, then that particular variable has no value (it has not yet been set).

Changing PATH and CLASSPATH

Windows 98

First, try the instructions for "Other Versions of Windows." If you are able to set PATH via the System window, great! Otherwise, you will need to modify a line of text in the c:\autoexec.bat file and restart your computer.



1. Start Notepad (Start > Program Files > Accessories > Notepad)



2. Open c:\autoexec.bat (File > Open, change to the c: folder and look for and open autoexec.bat. If you don't find one, create one.)



3. You might find one or more than one line that starts with "set path". Look for one.



4. If you do not find any lines starting with "set path", then add this new line to the end of the autoexec.bat file:



set path=c:\j2sdk1.4.1_01\bin



(This assumes that you really do have such a folder after you installed Java SDK 1.4. Please verify as needed.)



5. If you already have one or more lines starting with "set path", go to the last one. If it does not currently include "c:\j2sdk1.4.1_01\bin", then add a semicolon to the righthand end of the "set path" expression and then add this:



c:\j2sdk1.4.1_01\bin



6. Save the changes to autoexec.bat.



7. You might find one or more than on line that starts with "set classpath". Look for one.



8. If you do not find any lines starting with "set classpath", exit Notepad and any other programs and restart your computer. Try the java and javac commands again to see if they work now. You can ignore the remaining instructions below.



9. If you already have one or more lines starting with "set classpath", go to the last one. Add this to the righthand end of the "set classpath" expression:



;.



10. Save the changes to autoexec.bat, exit Notepad and any other programs and restart your computer. Try the java and javac commands again.



Other versions of Windows



1. Start your System panel (Start > Settings > Control Panel > System).



2. If you see Advanced or Environment, click those. (If you do not, follow the autoexec.bat instructions for Windows 95 users, above.)



There are two windows on this panel: System variables and User variables. Check whether you have a Set button or a New button.



3. If you see a Set button:

* Do not click the Set button.

* Click on ANY item in the User variables list. The Variable and Value fields are then filled in with whatever item you clicked.

* Replace the expression in the Variable field with the single word PATH.

* Replace the expression in the Value field with the following (where you should use replace "j2sdk1.4.1_01" with whatever directory name is correct for your installation of java):



%path%;c:\j2sdk1.4.1_01\bin



* Click both Set and Apply, in that order.

* Now replace the expression in the Variable field with the single word CLASSPATH.

* Replace the expression in the Value field with this:



%classpath%;.



* Click both Set and Apply, in that order.

* Exit all windows and programs, especially any command prompt window. Try the java and javac commands again to see if they work now. If they do not, restart your computer and try the java and javac commands again.



4. If you see a New button and not a Set button:

* Click New.

* In the Name field, type PATH.

* In the Value field, type the following (where you should use replace "j2sdk1.4.1_01" with whatever directory name is correct for your installation of java):



%path%;c:\j2sdk1.4.1_01\bin



* Click OK to complete that variable.

* Click in the User variables window.

* Click New and create a variable named CLASSPATH with the following value:



%classpath%;.



* Click OK to complete that variable.

* Exit all windows and programs, especially any command prompt window. Try the java and javac commands again to see if they work now. If they do not, restart your computer and try the java and javac commands again.
?
2016-11-16 19:04:14 UTC
i need to be incorrect, yet do no longer you place the Java direction interior the more desirable... Environmental placing of dwelling house windows? (hit the dwelling house windows-key + pause) (i need to be off.. I only took one Java classification)


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...