Contents
How do I run Java on Linux?
How to Run Java through Command-line
- $ javac -version. (Javac command-line tool is used for the compilation of java programs) …
- $ sudo apt install default-jdk. To verify the installation of javac, type:
- $ javac -version. Now, write a Java program in the text file and save it with . …
- $ javac testing.java. …
- $ java testing.
How do I install java on Linux terminal?
Install OpenJDK
- Open the terminal (Ctrl+Alt+T) and update the package repository to ensure you download the latest software version: sudo apt update.
- Then, you can confidently install the latest Java Development Kit with the following command: sudo apt install default-jdk.