1. Buka CMD (Command prompt)
2. Pindahkan dir ke direktori / folder tempat kita menyimpan file tersebut
3. Ketik syntax: javac [nama file].java
Untuk lebih jelasnya perhatikan gambar berikut ini:
Untuk me-running program ketik syntax:
java [namaclass]
*tanpa ekstensi .class
Ada cara yang lebih mudah tanpa mengetik syntax. Anda hanya perlu membuat windows batch file [.bat].
4. Klik-kanan file yang akan dicompile
Pada saat di-running, maka akan muncul pesan seperti gambar dibawah ini:
Selamat Mencoba!
Untuk me-running program ketik syntax:
java [namaclass]
*tanpa ekstensi .class
Ada cara yang lebih mudah tanpa mengetik syntax. Anda hanya perlu membuat windows batch file [.bat].
Caranya :
- Buka notepad
- Copy-kan script didalam spoiler coding dibawah
- Save as JAVA Compiler.bat
Coding :
Untuk men-copy tekan view plain dan select all lalu copy [Ctrl+C]
@ECHO OFF REM QBFC Project Options Begin REM HasVersionInfo: Yes REM Companyname: OneWay Corp. REM Productname: 1Y0004 REM Filedescription: For Compile Java File REM Copyrights: Copyright (c) 2011 REM Trademarks: OneWay Corp. (r) REM Originalname: JAVA Compiler.exe REM Comments: Advanced User Only REM Productversion: 1. 0. 0. 0 REM Fileversion: 0. 0. 0. 1 REM Internalname: REM QBFC Project Options End title JAVA Compiler by OneWay if not "%6"=="" goto HELP if not "%5"=="" goto FIVE if not "%4"=="" goto FOUR if not "%3"=="" goto THREE if not "%2"=="" goto TWO if not "%1"=="" goto ONE :HELP echo Drag a Java file and drop it on this batch file echo to compile, deploy, or running that program echo Max. 5 File to process at same time. goto END :ONE CLS echo ************************************************************** echo Processing one file .java . . . echo ************************************************************** CLS echo Compiling File . . . cd /d "%~dp1" echo Note: echo ************************************************************** javac %~nx1 echo ************************************************************** echo Testing program . . . echo Debug: echo ************************************************************** echo. java %~n1 echo. echo ************************************************************** goto END :TWO CLS echo ************************************************************** echo Processing two file .java . . . echo ************************************************************** CLS echo Compiling File . . . cd /d "%~dp1" echo Note: echo ************************************************************** javac %~nx1 echo ************************************************************** echo Testing program . . . echo Debug: echo ************************************************************** echo. java %~n1 echo. echo ************************************************************** goto END :THREE CLS echo ************************************************************** echo Processing rhree file .java . . . echo ************************************************************** CLS echo Compiling File . . . cd /d "%~dp1" echo Note: echo ************************************************************** javac %~nx1 echo ************************************************************** echo Testing program . . . echo Debug: echo ************************************************************** echo. java %~n1 echo. echo ************************************************************** goto END :FOUR CLS echo ************************************************************** echo Processing four file .java . . . echo ************************************************************** CLS echo Compiling File . . . cd /d "%~dp1" echo Note: echo ************************************************************** javac %~nx1 echo ************************************************************** echo Testing program . . . echo Debug: echo ************************************************************** echo. java %~n1 echo. echo ************************************************************** goto END :FIVE CLS echo ************************************************************** echo Processing five file .java . . . echo ************************************************************** CLS echo Compiling File . . . cd /d "%~dp1" echo Note: echo ************************************************************** javac %~nx1 echo ************************************************************** echo Testing program . . . echo Debug: echo ************************************************************** echo. java %~n1 echo. echo ************************************************************** :END PAUSE CLS
Cara compiling :
Cara pertama :
1. Drag file yang akan dicompile (Max. 5 file).
2. Drop file ke batch file yang telah kita buat agar dieksekusi.
3. Program siap dicompile.
Cara kedua:
2. Drop file ke batch file yang telah kita buat agar dieksekusi.
3. Program siap dicompile.
Cara kedua:
1. Jika sudah melakukan langkah 1-3 dibawah, maka anda bisa langsung ke langkah 4.
2. Buat shortcut batch file yang telah kita buat.
3. Copy-kan ke folder SendTo
[untuk Windows 7 biasanya di C:/Users/NamaUser/AppData/Roaming/Microsoft/Windows/SendTo]
div>4. Klik-kanan file yang akan dicompile
5. Send to batch file yang kita buat tadi.
6. Program siap dicompile.
Selamat Mencoba!
0 komentar
Posting Komentar