dElmARk Admin
Posts : 92 Join date : 09/04/2012
| Subject: Compiling Java Program Sat Oct 20, 2012 4:42 pm | |
| Before you program java, you need to have jdk file. Download Link: [You must be registered and logged in to see this link.]_____________ - *Compile Using Batch Files:
First Step: Create your own folder
Creating your batch files
Use notepad, notepad , drjava or any java programming software.
Compiler Code: echo off echo compiling %1 c:\(Javac file directory)\javac %1 echo finished compiling %1
________________ Then save as c.bat in your folder
Runner Code:
echo off echo running %1 c:\(Javac file directory)\java %1 echo finished running %1
________________ Then save as r.bat in your folder
NOTE: Sample for the directory c:/progra~1/Java/jdk1.7.0/bin/javac %1 - Compiler c:/progra~1/Java/jdk1.7.0/bin/java %1 - Runner
Set your cmd directory to your folder.
To Compile Cmd >c ProgramName.java
To Run Cmd >r ProgramName
Legends Red = can be changed
- *Compile Using SET PATH(via CMD):
Type this code on cmd Code: SET PATH = %PATH%;c:\Program Files\Java\jdk1.6.0_21\bin
______
To Compile Cmd >javac ProgramName.java
To Run Cmd >java ProgramName
Red = bin directory of your jdk
- *Compile Using SET PATH(non CMD):
Open My Computer > Properties > Advanced System Settings > Environment Variables > Click Path > Edit > add ; at the last > paste the jdk bin directory > ok > ok > ok.
To Compile Cmd >javac ProgramName.java
To Run Cmd >java ProgramName
| |
|