Step 1: Type your JAVA Program into any text editor like notepad or Edit (Dos Based Editor).
Step 2: Save your program (filename.java). You should use four characters extension .java just for example
hello.java.
Step 3: Compile your program with the follwing command at dos prompt
where your java compiler exist. in my case c:\jdk folder.
So first of all you have to change the directory
c:\> cd jdk
c:\jdk> cd bin
c:\jdk\bin> JAVAC hello.java
Javac is a java compiler.
if compilation is successfully done, it will create a hello.class file.
If your program contains 3 classes then it automatically creates 3 .class file, each file for each classes.
It is the file which contains byte code.
To run a java program
c:\jdk\bin>java hello
where java is a interpreter and hello is a .class file. And you are done. you have sucessfully compiled and run
your java program.
Most Popular Articles
- How to create picture package in Photoshop
- How to change financial year in Tally
- How to set classic start menu in Windows XP
- Pyramid of stars in C (center aligned)
- Exit function in C
- Create a bacground for your image in Photoshop
- C program to generage a beep sound
- How to create bookmark in Microsoft Word
- How to compile and run JAVA programs
- C program to add subtract multiply and division
- How to format Nokia 6600 mobile phone
- JAVA Applet program for doing simple calculations
- How to Improve Windows Vista performance
- C program to add two given numbers






4 comments:
How do i get jre or jdk to work on vista?
an error has appeared during compilation as cannot read example.java where example.java is the name i have saved the program in notepad.......
may i know how to handle this error
Hi, Sindhu thanx for commenting in my blog. Please tell me where you are saving example.java and how are you compiling the program tell me in deatail then only I will show you the process.
Hi nitin even I'm facing the same problem.I have saved my source file in folder c:\>java
however I can compile the file If I save it the bin folder of the J2sdk.
Is it necessry to always save in the bin folder of the j2sdk to compile??
wat if files are placed in a seperate folder than how to compile??
Post a Comment