Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

compilation of java program

Tags:

java

javac

I have JRE 6 in my PC (Windows XP) but when I compile a program in the command prompt it shows javac is not recognised as internal or external command. Which software is needed to compile a Java program?

like image 489
naisergic Avatar asked Oct 18 '10 08:10

naisergic


3 Answers

You need to download and install a JDK, not a JRE.

As a (very rough) explanation, the JRE contains just the Java Virtual Machine, whereas the JDK contains not only the JRE but also the compiler (javac), some debugging tools (javap, jvisualvm, ...), extra libraries and the API documentation.

See also:

  • What is the difference between JRE and JDK?
  • as recommended by dogbane, you can follow the Java Hello World for Windows Tutorial.
like image 185
haylem Avatar answered Oct 20 '22 02:10

haylem


I suggest you run through the steps of the Hello World! Tutorial.

As per the instructions:

  • Download JDK6. (Make sure you download the JDK, not the JRE.)
  • Update the PATH variable to be able to conveniently run the JDK executables such as javac from any directory without having to type the full path of the command
like image 3
dogbane Avatar answered Oct 20 '22 02:10

dogbane


JRE stands for Java Runtime Environment. It allows you to run already compiled java programs. To compile your own programs, you need JDK which stands for Java Development Kit. You can download it at JDK Downloads Page.

like image 1
Nithesh Chandra Avatar answered Oct 20 '22 04:10

Nithesh Chandra