Assumption:
- The Java JDK has installed and Java path variable has set.
- You have a Java source code (.java file). In this example, using MyFirstJavaProgram.java source code.
Step:
- Open Command Prompt.
- Set the directory in which the .java file is saved. In our case, the .java file is saved in C:\demo.
- Use the following command to compile the Java program.
javac MyFirstJavaProgram.java
and press enter. - Use the following command to run the Java program:
java MyFirstJavaProgram
and press enter. - Or running a Java program using classpath option, which allows you to run a bytecode files in a same directory.
java -cp . MyFirstJavaProgram
and press enter.
Bibliography:
https://www.mcmaster.ca/ ( university )
https://jenkov.com/
Tidak ada komentar:
Posting Komentar