Selasa, 28 Maret 2023

How To Compile Java 1

 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:

  1. Open Command Prompt.
  2. Set the directory in which the .java file is saved. In our case, the .java file is saved in C:\demo.
  3. Use the following command to compile the Java program.
    javac MyFirstJavaProgram.java
    and press enter.
  4. Use the following command to run the Java program:
    java MyFirstJavaProgram
    and press enter.
  5. 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/

Related Post:

Tidak ada komentar:

Posting Komentar