Compiling java

+1 Jimmy Rodriguez · September 8, 2014

  • I can't seem to run the compiler 

Post a Reply


Oldest  Newest  Rating
0 jan burg · November 8, 2014
For anyone else who reads this thread, this is the general syntax for compiling through the command line:

javac <name of program>.java

Then to run it...

java <name of program>

Sometimes on linux, you need to supply the classpath switch for the program to run:

java -classpath . <name of program>


java -cp . <name of program>

**** It's important not to add ".class" to the end of the program name when trying to run it.
0 Jimmy Rodriguez · November 5, 2014
I figured it out thanks
+1 Alinous Alinous · September 9, 2014
Could you tell, how you're trying to compile your class in java? In cmd or in IDE?
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator