Best Answer: How Compile and Run Java in Linux?
Contents How Do I Compile Java in Linux Terminal? Just Follow These Simple Steps: from Terminal Install Open Jdk Sudo Apt-Get Install Openjdk-7-Jdk. Write a...
Contents
How do I compile Java in Linux terminal?
Just follow these simple steps:
- From Terminal install open jdk sudo apt-get install openjdk-7-jdk.
- Write a java program and save the file as filename.java.
- Now to compile use this command from the terminal javac filename.java. …
- To run your program that you’ve just compiled type the command below in terminal: java filename.
3 июн. 2012 г.
How do I compile and run Java in terminal?
How to run a java program
- Open a command prompt window and go to the directory where you saved the java program (MyFirstJavaProgram. java). …
- Type ‘javac MyFirstJavaProgram. java’ and press enter to compile your code. …
- Now, type ‘ java MyFirstJavaProgram ‘ to run your program.
- You will be able to see the result printed on the window.
19 янв. 2018 г.