Saturday, January 30, 2010

Make Java Compiler on DOS(Command Prompt)

1. First thing to do is to download JDK(Java Development Kit). To download this thing visit http://java.sun.com/javase/downloads/widget/jdk6.jsp

2. After downloading JDK. Open your Command Prompt. Find the path where your program is located..
Example:
C:\Documents and Settings\Administrator\Desktop\Fhivz
The name of the folder where my java program save is Fhivz.

Note:To back to your folder type cd.. and to open the next folder cd Fhivz.

3.Next. On the command prompt.Create a .bat file.Example: jcon.bat .To create a .bat file type edit jcon.bat. Inside that file is the following:
@echo off path=c:\progra~1\java\jdk1.6.0_18\bin;c:\windows\system32

Where jdk1.6.0_18 is a version of jdk and it is save in the program file>java folder>jdk version.

Then save the .bat file as jcon.bat. Exit.

4.On your Command Prompt Window. Type jcon.bat.Press Enter

5.Type javac. Press Enter.And it will run like this:

6.Compile your java program. Type javac MyJavaProg.java
If the is no error Run your program by typing java MyJavaProg.

Note:
To compile: javac .java
To run: java
7. Enjoy!!






No comments: