Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Compile Java files using command line
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
scholarlytutor




PostPosted: Fri Mar 18, 2022 12:11 am   Post subject: Compile Java files using command line

Does anyone know how to compile a Java program using command prompt in Windows or terminal for Mac/Linux? I know how to compile simple programs with only a main class, but I am unsure of how to compile several classes together.

I've written all the code on a plain text editor, so are there are any lines of code I need to add to the files before compiling, or do I just need to write a specific command in the terminal?
Sponsor
Sponsor
Sponsor
sponsor
scholarlytutor




PostPosted: Tue Mar 22, 2022 4:12 pm   Post subject: RE:Compile Java files using command line

For anyone wondering:

I figured out that you just need to write all the names of your classes on the same line. Using the terminal:

javac Main.java OtherClass.java OtherClass2.java

Just make sure they are all in the same folder.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: