How do I run Java on Ubuntu?

How do I run Java on Ubuntu?
Answer
Just follow these simple steps:
  1. From Terminal install open jdk sudo apt-get install openjdk-7-jdk.
  2. Write a java program and save the file as filename.java.
  3. Now to compile use this command from the terminal javac filename. java.
  4. To run your program that you’ve just compiled type the command below in terminal: java filename.
Photo in the article by “Wikimedia Commons”
Code:
https://commons.wikimedia.org/wiki/File:Gnome-system-software-installer.svg
Follow the steps below to install Java OpenJDK 11 on your Ubuntu system:
  • First, update the apt package index with: sudo apt update.
  • Once the package index is updated install the default Java OpenJDK package with:
  • Verify the installation, by running the following command which will print the Java version:
 

Tìm kiếm

Back
Top