SlideShare une entreprise Scribd logo
1  sur  3
Télécharger pour lire hors ligne
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)

Contenu connexe

Similaire à Command line

JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)Prof. Erwin Globio
 
Installing tomcat on windows 7
Installing tomcat on windows 7Installing tomcat on windows 7
Installing tomcat on windows 7Ravi Kumar Lanke
 
Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Servermohamedmoharam
 
Enterprise Messaging Foundations
Enterprise Messaging FoundationsEnterprise Messaging Foundations
Enterprise Messaging FoundationsJeremy Deane
 
Integrating tomcat with apache
Integrating tomcat with apacheIntegrating tomcat with apache
Integrating tomcat with apachegovindraj8787
 
Cacoo enterprise installation_manual
Cacoo enterprise installation_manualCacoo enterprise installation_manual
Cacoo enterprise installation_manualjoseig23
 
BestInFlowCompetitionTutorials03May2023
BestInFlowCompetitionTutorials03May2023BestInFlowCompetitionTutorials03May2023
BestInFlowCompetitionTutorials03May2023Timothy Spann
 
Integrating Tomcat And Apache On Windows
Integrating Tomcat And Apache On WindowsIntegrating Tomcat And Apache On Windows
Integrating Tomcat And Apache On WindowsMohanraj Nagasamy
 
java:characteristics, classpath, compliation
java:characteristics, classpath, compliationjava:characteristics, classpath, compliation
java:characteristics, classpath, compliationShivam Singhal
 
How to install Java and how to set the path
How to install Java and how to set the pathHow to install Java and how to set the path
How to install Java and how to set the pathyesheeka
 
Integration of apache with tomcat
Integration of apache with tomcatIntegration of apache with tomcat
Integration of apache with tomcatCognizant
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialRaghavan Mohan
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction SheetvodQA
 

Similaire à Command line (20)

Mc sl54 051_ (1)
Mc sl54 051_ (1)Mc sl54 051_ (1)
Mc sl54 051_ (1)
 
Dspace
DspaceDspace
Dspace
 
JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)JAVA Object Oriented Programming (OOP)
JAVA Object Oriented Programming (OOP)
 
Installing tomcat on windows 7
Installing tomcat on windows 7Installing tomcat on windows 7
Installing tomcat on windows 7
 
Tomcat tutorail
Tomcat tutorailTomcat tutorail
Tomcat tutorail
 
Apache Tomcat 8 Application Server
Apache Tomcat 8 Application ServerApache Tomcat 8 Application Server
Apache Tomcat 8 Application Server
 
Enterprise Messaging Foundations
Enterprise Messaging FoundationsEnterprise Messaging Foundations
Enterprise Messaging Foundations
 
Integrating tomcat with apache
Integrating tomcat with apacheIntegrating tomcat with apache
Integrating tomcat with apache
 
Cacoo enterprise installation_manual
Cacoo enterprise installation_manualCacoo enterprise installation_manual
Cacoo enterprise installation_manual
 
BestInFlowCompetitionTutorials03May2023
BestInFlowCompetitionTutorials03May2023BestInFlowCompetitionTutorials03May2023
BestInFlowCompetitionTutorials03May2023
 
Integrating Tomcat And Apache On Windows
Integrating Tomcat And Apache On WindowsIntegrating Tomcat And Apache On Windows
Integrating Tomcat And Apache On Windows
 
Tomcat + other things
Tomcat + other thingsTomcat + other things
Tomcat + other things
 
02 basic java programming and operators
02 basic java programming and operators02 basic java programming and operators
02 basic java programming and operators
 
java:characteristics, classpath, compliation
java:characteristics, classpath, compliationjava:characteristics, classpath, compliation
java:characteristics, classpath, compliation
 
How to install Java and how to set the path
How to install Java and how to set the pathHow to install Java and how to set the path
How to install Java and how to set the path
 
Lesson 2
Lesson 2Lesson 2
Lesson 2
 
Integration of apache with tomcat
Integration of apache with tomcatIntegration of apache with tomcat
Integration of apache with tomcat
 
Java, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorialJava, Eclipse, Maven & JSF tutorial
Java, Eclipse, Maven & JSF tutorial
 
Jakarta struts
Jakarta strutsJakarta struts
Jakarta struts
 
Automation Frame works Instruction Sheet
Automation Frame works Instruction SheetAutomation Frame works Instruction Sheet
Automation Frame works Instruction Sheet
 

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)