I have installed JDK 1.3 in my Windows 7 PC. Now, I can't compile my program. When I write Javac (source file name), an error occurred that 'javac' is not recognized as an internal or external command, operable program or batch file. What can I do now? Please anyone help me.
Compile time error in Java
Hi,
You need to keep your Java file in a right place to compile so that Java compiler can find that path. For this you can use two ways.
First one is you have to keep your Java file in the Java main bin folder. At my computer the location will look like this one C:Program Filessunjavabin. Java compiler can only search files for compile in this folder.
Another option is to add the Java compiler's path to my computer. In this way you can use to compile Java files from anywhere you want. For this just copy the Java compiler's location and add here with my computer properties.
Compile time error in Java
It’s quite clear that you wrongly or did not configure the Java development kit you installed correctly.
You can follow the steps provided below to solve this issue.
-
Gain access to Control Panel on our computer. You can do this by navigating from the start to control panel.
-
Adding Java executable path into the command prompt is necessary so go ahead and open the dialog panel from the system options.
-
From there, choose the environment variables.
-
Using the slider, navigate to the path variable and highlight it.
-
Choose the Edit option.
-
Change variable value to C:UsrLocaljdk1.5.0_0xbin; You can do this by pressing the home key.
-
Exit the panel containing system variables by pressing ok.
-
Do the same for the other panels until you are out of the control panel.
-
Type Java-version into a newly opened command prompt.
-
If the version is displayed, then your installation was a success.
You can now go ahead and compile your Java programs. Have fun.
Compile time error in Java
Javac is used to compile Java programs. Javac will be installed with the JDK and the same can be found in the path where Java is installed. You are getting error while using javac because the OS cannot find where is javac installed.
In order to use javac, either you have to go to the Java path and use Javac or use complete path while using javac.
For example if you have installed java in C:Program FilesJava, then go to this path.
Then try javac test.java
You may also try this.
Prompt> C:Program FilesJavajavac test.java