zaterdag 25 september 2010

Run Java applications command line

These are the steps to run Java programs in the command line in Windows.

1. Check if you have installed the JDK. Run cmd.exe and type java, if there are no values coming out then you should install JDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk6-jsp-136632.html

2. Get the address of the installed JDK, usually it's in the program files folder:
C:\Program Files\Java\jdk1.6.0_21

3. Copy this address and open Environment Variables.
Windows 7:
Configuration Panel, System and Security, System, Advanced System Settings, Environment Variables.
Edit System variable Path, paste at the beginning in the field variable value the path of JDK and then ends with semilicon ;
C:\Program Files\Java\jdk1.6.0_21\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\

4. Restart the computer and go to your Java files, type javac *.java to compile all the Java files in that directory. Then type java filename to run the Java file.

From now on you can run Java programs via the command line.

Geen opmerkingen:

Een reactie posten