Compile time error in Java

Asked By 0 points N/A Posted on -

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.

Best Answer by RikkiDeardon
Best Answer
Best Answer
Answered By 0 points N/A #124408

Compile time error in Java



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.

Keep your java file in java’s main bin folder Add java compilers path to my computer
Answered By 0 points N/A #124409

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.

  1. Gain access to Control Panel on our computer. You can do this by navigating from the start to control panel.
  2. Adding Java executable path into the command prompt is necessary so go ahead and open the dialog panel from the system options.
  3. From there, choose the environment variables.
  4. Using the slider, navigate to the path variable and highlight it.
  5. Choose the Edit option.
  6. Change variable value to C:UsrLocaljdk1.5.0_0xbin; You can do this by pressing the home key.
  7. Exit the panel containing system variables by pressing ok.
  8. Do the same for the other panels until you are out of the control panel.
  9. Type Java-version into a newly opened command prompt.
  10. If the version is displayed, then your installation was a success.

You can now go ahead and compile your Java programs. Have fun.

Answered By 0 points N/A #124410

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

You may also try this.

Prompt> C:Program FilesJavajavac

Login/Register to Answer

Related Questions