Compiling java

+1 Jimmy Rodriguez · September 8, 2014

  • I can't seem to run the compiler 


Post a Reply

Replies

Oldest  Newest  Rating
+1 Alinous Alinous · September 9, 2014
Could you tell, how you're trying to compile your class in java? In cmd or in IDE?
0 Jimmy Rodriguez · November 5, 2014
I figured it out thanks
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>

or...

java -cp . <name of program>



**** It's important not to add ".class" to the end of the program name when trying to run it.
  • 1

Java / Android Development

124,582 followers
About

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

Links
Moderators
Bucky Roberts Administrator