Breaking News

Search This Blog

Saturday, August 11, 2018

how to run java program in CMD

how to run java program in CMD


It's a First Program Of Java⬇

class Suryansh
{
public static void main(String a[])
{
System.out.println("hello");
}
}



format of save the java program & Important points

  format:  classname.java

{ first letter of class name is always capital } 
{class name and file name is always same }
ex: Suryansh.java,Technical.java

Save this file on C, D,E,F etc drive . before run the java program first set the Environment path .

 OutPut



Compile the Program

we will use the javac command[CMD] to convert your Java program into a form more amenable for execution on a computer.


        first open CMD

C:\Users\username>d: {drive name}


D:\>cd java {folder name when program is saved} 

Assuming the file, say  Suryansh.java, is in the current working directory, type the javac command give space and your program name.

    D:\java>javac Suryansh.java 

    write our java & our program name with out ".java" 


      If everything went well, you should see no error messages.

        Execute the Program
        You will use the java command to execute your program.
        From the Command Prompt, type the java command below.
        D:\java>java Suryansh
        Hello

        If all goes well, you should see the output of the program - Hello




          how to run java program in cmd using notepad,how to run java program in windows 7,how to run java program in windows 10,how to run java program in ubuntu,run java from command line mac,how to run a java program in terminal,how to run java program in eclipse,java command
          We use Java compiler javac to compile Java program and the Java interpreter java to run the Java program. ... Save your file as HelloTesters.java in C:\SoftwareTestingMaterial. ... Step iv: Run the created Java program using command prompt.,

          how to run java program in cmd using notepad,how to run java program in windows 7,how to run java program in windows 10,how to run java program in ubuntu,run java from command line mac,how to run a java program in terminal,how to run java program in eclipse,java commandWe use Java compiler javac to compile Java program and the Java interpreter java to run the Java program. ... Save your file as HelloTesters.java in C:\SoftwareTestingMaterial. ... Step iv: Run the created Java program using command prompt.,
          how to run java program in cmd using notepad,how to run java program in windows 7,how to run java program in windows 10,how to run java program in ubuntu,run java from command line mac,how to run a java program in terminal,how to run java program in eclipse,java command

          No comments:

          Post a Comment