[LINUX] [Latest] How to build Java environment on Ubuntu

1. Prior knowledge

-[Super easy] How to install VirtualBox on Windows -[2019 latest] How to create an Ubuntu virtual environment with VirtualBox

As prior knowledge, the contents of the above link are required.

2. What is Java?

―― Java is a class-based object-oriented programming language, which is characterized by being generic and ʻOS independent. -- Java is a fast and reliable language in terms of security. --The advantage of choosing Java is that it is used in a wide range of areasdue to its high reliability, and it has abundantlibraries and so on`.

3. Advance preparation

08.png

#Add repository
$ sudo add-apt-repository ppa:webupd8team/java

#Get the package list from the repository
$ sudo apt-get update
  1. Start ʻOracle VM VirtulaBox and start the virtual machine`.
  2. Start command line.
  3. Enter the above code.

4. Install JRE

#Install JRE
$ sudo apt-get install openjdk-6-jre
$ sudo apt-get install openjdk-7-jre
$ sudo apt-get install openjdk-8-jre
  1. Select one of the above version and enter the command.

5. Install the JDK

#Install the JDK
$ sudo apt install openjdk-6-jdk
$ sudo apt install openjdk-7-jdk
$ sudo apt install openjdk-8-jdk
  1. Enter the command same version as the version selected in` 3. Install JRE``.

6. Java verification

02.png 03.png 04.png 05.png 06.png

Hello.java


public class Hello{
   public static void main(String[] args){
     System.out.println("Hello World!!");
   }
}
  1. Start File and right-click.
  2. Click New Folder and change Folder Name to Java.
  3. Confirm that the folder has been created and start the text editor.
  4. Enter the above source code in the text editor and click the save button.
  5. Enter Hello.java as the file name and click the Save button.
  6. Start command line and enter the code below.
#Move to Java folder
$ cd Java

# Hello.Compile java
$ javac Hello.java

#Run
$ java Hello

07.png

  1. If Hello World !! is displayed as shown in the image, it is successful.

7. Code that is useful to know

#java version check
$ java -version

#javac version check
$ javac -version

#Java management
$ sudo update-alternatives --config java

#Javac management
$ sudo update-alternatives --config javac

-- java -version can check the version of java. --javac -version allows you to check the version of javac. -- sudo update-alternatives --config java allows you to manage multiple java versions. --sudo update-alternatives --config javac allows you to manage multiple javac versions`.

Recommended Posts

[Latest] How to build Java environment on Ubuntu
How to build Java environment on Ubuntu (Linux)
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
How to build a Django (python) environment on docker
How to build a Python environment on amazon linux 2
Build Python 3.8 + Pipenv environment on Ubuntu 18.04
How to install Go on Ubuntu
Memo A beginner tried to build a Java environment and Japaneseize it on Ubuntu 18.04.2 LTS.
How to build a sphinx translation environment
Build Python3 and OpenCV environment on Ubuntu 18.04
How to build Hello, World on #Nix
Steps to install Python environment on Ubuntu
How to install php7.4 on Linux (Ubuntu)
Shell script to build pyenv environment on ubuntu in one shot
Build python environment with pyenv on EC2 (ubuntu)
Build Python3.5 + matplotlib environment on Ubuntu 12 using Anaconda
How to run MeCab on Ubuntu 18.04 LTS Python
How to update security on Ubuntu 19.10 Eoan Ermine
Build a Kubernetes environment for development on Ubuntu
build Python on Ubuntu
[TF] How to build Tensorflow in Proxy environment
How to build an environment for using multiple versions of Python on Mac
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
How to build a development environment for TensorFlow (1.0.0) (Mac)
How to register on pypi
Build python3 environment with ubuntu 16.04
Build Python environment on Windows
Build python environment on windows
How to build a beautiful Python environment on a new Mac and install Jupter Notebook
How to create a Python 3.6.0 environment by putting pyenv on Amazon Linux and Ubuntu
[Latest] How to use Python library to save Google image search & use Chrome Driver on ubuntu
How to use Fujifilm X-T3 as a webcam on Ubuntu 20.04
A memo on how to easily prepare a Linux exercise environment
Build an Ubuntu python development environment on Google Cloud Platform
How to share OS and Vim clipboard on Ubuntu 18.04.3 LTS
How to use VS Code in venv environment on windows
Introducing Kaggle's Docker Image on Windows to build an environment
A note on how to load a virtual environment in PyCharm
How to build a python2.7 series development environment with Vagrant
When I tried to build a Rails environment on WSL2 (Ubuntu 20.04LTS), I stumbled and fell.
How to connect to Cloud SQL PostgreSQL on Google Cloud Platform from a local environment with Java
How to manage Python minor version (build virtual environment) on Windows (without Pyenv or WSL)
Prepare Python development environment on Ubuntu
How to install mysql-connector-python on mac
How to use Dataiku on Windows
Building a Python environment on Ubuntu
Modify Ubuntu tofu to Japanese environment
Notes on how to use pywinauto
How to install graph-tool on macOS
How to install VMware-Tools on Linux
How to install pycrypto on Windows
How to deploy django-compressor on Windows
Notes on how to use featuretools
How to install OpenCV on Mac
How to run matplotlib on heroku
How to install MBDyn (Linux Ubuntu)
How to install PyPy on CentOS
How to use homebrew on Debian
Misunderstanding on how to connect cnn
How to install TensorFlow on CentOS 7
From Ubuntu 20.04 introduction to environment construction