ACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMAC                       ACM Training SessionMACMACMACMACMA...
Page 1 of 2                                              Compile and Run Java file from command line    1. First check if ...
Page 2 of 2    4. Command for taking input from a file        java yourClassName <inputFileName.txt    5. Command for givi...
Upcoming SlideShare
Loading in …5
×

Command line

180 views
130 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
180
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Command line

  1. 1. ACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMAC ACM Training SessionMACMACMACMACMACMACMAC BRAC UNIVERSITYMACMACMACMACMACMACMAC 6/15/2012 MahbubMACMACMACMACMACMACMAC This work is licensed under a Creative Commons Attribution-MACMACMACMACMACMACMAC NonCommercial-ShareAlike 3.0 Unported License.MACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMACMAC
  2. 2. Page 1 of 2 Compile and Run Java file from command line 1. First check if the path of javac is added in the Path (System Variables) or not. To check that  Go to start -> run -> write cmd  Now type javac if you see the following message, then javac is not added in the Path javac is not recognized as an internal or external command, operable program or batch file. For add the path of javac.  Go to C: -> Program Files -> Java -> jdk -> bin  Copy the path  Now Write click on My Computer -> properties -> Advanced -> Environment Variables  From System variables find path and double click  A window will pop up  Now in the Variable value filed paste the path at the end, which you copied previously.  The paths are in the following forms of pattern xxxx;zzzz;zzzz;path_of_javac So make sure you have put a semicolon (;) to separate two paths 2. Command for Compile java file javac yourClassName.java 3. Command for Run java file java yourClassNameS. Mahbub – Uz – Zaman (09301004)
  3. 3. Page 2 of 2 4. Command for taking input from a file java yourClassName <inputFileName.txt 5. Command for giving output to a file java yourClassName >outputFileName.txt 6. All codes javac yourClassName.java java yourClassName <inputFileName.txt>outputFileName.txtFrequently Asked Question 1. How to make batch file  Create a text file and rename it to textFileName.bat  Make sure your Hide Extension option is not checked in, because you might end up with following textFileName.bat.txt So your .bat file will not work 2. How can I edit batch file  Write click the batch file and click edit 3. How can I hold the black screen of cmd for debug javac yourClassName.java java yourClassName <inputFileName.txt>outputFileName.txt pause 4. How can I automatically open the output file javac yourClassName.java java yourClassName <inputFileName.txt>outputFileName.txt start notepad outputFileName.txtS. Mahbub – Uz – Zaman (09301004)

×