Kalo kita udah bikin program java, misal “HalloTony.java” pake notepad:
public static void main(String[ ] args)
dan saya simpan di folder C:\Users\Tony D Susanto\, maka sebenarnya saya sudah bisa meng-compile dan me-run aplikasi java saya tersebut lewat Command line:
C:\Users\Tony D Susanto> \Program Files (x86)\Java\jdk1.6.0_13\bin\javac HalloTony.java
Sayaperlu menuliskan secara tepat dimana file Compiler Java saya (javac) berada.
Agar saya cukup menulis javac namafile
maka saya perlu mendeklarasikan lokasi (path) file compiler and translatter saya tadi di System windows
Control Panel > System > Advanced System Setting > ‘Advance’ tab : ‘Environment Variable’
on system variables..cari text “path“….tambahkan (edit) lokasi path
dalam PC saya lokasinya :
C:\Program Files (x86)\Java\jdk1.6.0_13\bin\;
kini saya cukup menulis
untuk meng-kompile file java saya menhasilkan file baru: “HalloTony.class”
maka file HalloTony.class akan ter-eksekusi menampilkan isinya
Microsoft Windows NT, 2000, and XP – To set the PATH permanently:
- Choose Start, Settings, Control Panel, and double-click System. On Microsoft Windows NT, select the Environment tab; on Microsoft Windows 2000 select the Advanced tab and then Environment Variables. Look for “Path” in the User Variables and System Variables. If you’re not sure where to add the path, add it to the right end of the “Path” in the User Variables. A typical value for PATH is:
Capitalization doesn’t matter. Click “Set”, “OK” or “Apply”.The PATH can be a series of directories separated by semi-colons (;). Microsoft Windows looks for programs in the PATH directories in order, from left to right. You should only have one bin directory for a Java SDK in the path at a time (those following the first are ignored), so if one is already present, you can update it to j2sdk1.4.2_<version>\bin.
- The new path takes effect in each new Command Prompt window you open after setting the PATH variable.
Microsoft Windows 98 – To set the PATH permanently, open the AUTOEXEC.BAT file and add or change the PATH statement as follows:
- Start the system editor. Choose “Start”, “Run” and enter sysedit, then click OK. The system editor starts up with several windows showing. Go to the window that is displaying AUTOEXEC.BAT
- Look for the PATH statement. (If you don’t have one, add one.) If you’re not sure where to add the path, add it to the right end of the PATH. For example, in the following PATH statement, we have added the bin directory at the right end:
Capitalization doesn’t matter. The PATH can be a series of directories separated by semi-colons (;). Microsoft Windows searches for programs in the PATH directories in order, from left to right. You should only have one bin directory for a Java SDK in the path at a time (those following the first are ignored), so if one is already present, you can update it to j2sdk1.4.2_<version>.
- To make the path take effect in the current Command Prompt window, execute the following:
To find out the current value of your PATH, to see if it took effect, at the command prompt, type:
Microsoft Windows ME – To set the PATH permanently:
From the start menu, choose programs, accessories, system tools, and system information. This brings up a window titled “Microsoft Help and Support”. From here, choose the tools menu, then select the system configuration utility. Click the environment tab, select PATH and press the edit button. Now add the SDK to your path as described in step b above. After you’ve added the location of the SDK to your PATH, save the changes and reboot your machine when prompted.
(reference: taken from http://java.sun.com/j2se/1.4.2/install-windows.html)