To code a Java program you don't need any special software, a simple text is sufficient however to compile and run the program you need to download the Java Run-time Environment (JRE) and Java Development Kit (JDK). First you have to download and install in your system. You can download from http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html .
Download the installation files and by default the files will be installed on C:\\Program Files\Java folder as shown below.
Now open a Notepad program and write your first Hello World program
To compile the program you have to type javac programname.java with extension (eg. javac HelloWorld.java) then you will get HelloWorld.class file in your folder which means your program is ready to use now.to see your output type java programname. (java HelloWorld)
Download the installation files and by default the files will be installed on C:\\Program Files\Java folder as shown below.
Now open a Notepad program and write your first Hello World program
public class HelloWorld { /* This is my first java program. * This will print 'Hello World' as the output */ public static void main(String []args) { System.out.println("Hello World"); // prints Hello World } }Now save the program same as your class name i.e HelloWorld (remember Java is case sensitive so check your case carefully) with the extension Java (HelloWorld.java). Now you have to set path of your java. For this first go to your Java folder located in C:\Program Files, Then open your JDK folder then bin folder and copy the address as shown below. I have saved the Java file in D: so I set path in D:, You have to locate the drive and folder where you have saved the Java file then set the path in that drive or folder.
To compile the program you have to type javac programname.java with extension (eg. javac HelloWorld.java) then you will get HelloWorld.class file in your folder which means your program is ready to use now.to see your output type java programname. (java HelloWorld)


Comments
Post a Comment