SlideShare a Scribd company logo
ACMACMACMACMACMACMACMA
CMACMACMACMACMACMACMAC
MACMACMACMACMACMACMAC
                       ACM Training Session

MACMACMACMACMACMACMAC   BRAC UNIVERSITY



MACMACMACMACMACMACMAC
                             6/15/2012

                             Mahbub


MACMACMACMACMACMACMAC
     This work is licensed under a Creative Commons Attribution-

MACMACMACMACMACMACMAC
          NonCommercial-ShareAlike 3.0 Unported License.




MACMACMACMACMACMACMAC
MACMACMACMACMACMACMAC
MACMACMACMACMACMACMAC
MACMACMACMACMACMACMAC
MACMACMACMACMACMACMAC
MACMACMACMACMACMACMAC
MACMACMACMACMACMACMAC
MACMACMACMACMACMACMAC
MACMACMACMACMACMACMAC
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 yourClassName




S. Mahbub – Uz – Zaman (09301004)
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.txt



Frequently 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.txt




S. Mahbub – Uz – Zaman (09301004)

More Related Content

PPT
Installation 4-database-connection
PDF
Buacm 3
PDF
Buacm 2
PDF
WorkShop on Arduino
PDF
Workshop on python
PPTX
Android SMS (GDayX, Dhaka, Bangladesh)
PDF
Android security and parsing 101
PDF
All about android
Installation 4-database-connection
Buacm 3
Buacm 2
WorkShop on Arduino
Workshop on python
Android SMS (GDayX, Dhaka, Bangladesh)
Android security and parsing 101
All about android

Similar to Command line (20)

PDF
Core java introduction
PPTX
Object-Oriented: Everything is modeled as an object. Platform Independent: C...
PPTX
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
PPSX
Installing JDK and Eclipse -JDKeclipse.ppsx
PDF
02 basic java programming and operators
PDF
Java Programming Fundamentals: Complete Guide for Beginners
PDF
4 implementing java program cinouke abd execye..pdf
DOC
Os solve bs 301-0 s-lab10
PPT
Java for Mainframers
PPTX
Lecture-2.pptx sensor design and signal processing using RF and THz sensing, ...
PPT
Java platform
PPTX
java:characteristics, classpath, compliation
PPT
Java introduction
PPTX
Easy java installation &amp; practice
PPTX
java basic for begginers
PPT
Java essential notes
PPTX
Installation of java and program execution
PPTX
Introduction to java
PPT
Lecture1_Introduction.ppt
PPTX
Java basics
Core java introduction
Object-Oriented: Everything is modeled as an object. Platform Independent: C...
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
Installing JDK and Eclipse -JDKeclipse.ppsx
02 basic java programming and operators
Java Programming Fundamentals: Complete Guide for Beginners
4 implementing java program cinouke abd execye..pdf
Os solve bs 301-0 s-lab10
Java for Mainframers
Lecture-2.pptx sensor design and signal processing using RF and THz sensing, ...
Java platform
java:characteristics, classpath, compliation
Java introduction
Easy java installation &amp; practice
java basic for begginers
Java essential notes
Installation of java and program execution
Introduction to java
Lecture1_Introduction.ppt
Java basics
Ad

Command line

  • 1. ACMACMACMACMACMACMACMA CMACMACMACMACMACMACMAC MACMACMACMACMACMACMAC ACM Training Session MACMACMACMACMACMACMAC BRAC UNIVERSITY MACMACMACMACMACMACMAC 6/15/2012 Mahbub MACMACMACMACMACMACMAC This work is licensed under a Creative Commons Attribution- MACMACMACMACMACMACMAC NonCommercial-ShareAlike 3.0 Unported License. MACMACMACMACMACMACMAC MACMACMACMACMACMACMAC MACMACMACMACMACMACMAC MACMACMACMACMACMACMAC MACMACMACMACMACMACMAC MACMACMACMACMACMACMAC MACMACMACMACMACMACMAC MACMACMACMACMACMACMAC MACMACMACMACMACMACMAC
  • 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 yourClassName S. Mahbub – Uz – Zaman (09301004)
  • 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.txt Frequently 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.txt S. Mahbub – Uz – Zaman (09301004)