ReventonMC ReventonMC - 1 year ago 88
Java Question

Javac classpath (.java file)

I want to compile a java file from the command line using this command:

javac -cp C:/Java myPgm.java
but it keeps saying that

javac: file not found: myPgm.java
Usage: javac <options> <source files>
use -help for a list of possible options


any help please? ;)enter image description here

Answer Source

run the following code in the terminal to compile the java source code

javac C:/Java/myPgm.java

then to execute the code

java theClassNameOfTheJavaFile