GoDaddy 도움말

How to install Java on Ubuntu

Java is used to run such programs as Apache, IntelliJ, Eclipse and many others. Historically, the runtime shipped with Ubuntu, however this changed in 2011. Since then, you've had to manually install the runtime environment to run Java programs or the development environment if you wanted to develop Java programs. For the majority of the population, installing the runtime is sufficient, but in either case, you have to do it for yourself.
DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
TIME REQUIRED 15-30+ min
RELATED PRODUCTS Linux-based VPS or dedicated servers

The Oracle implementation of Java is the reference implementation.

Before installing, you need to know if you're running a 32-bit or 64-bit installation of Ubuntu. Run the file command against the init boot startup file to determine its file type and it will report which of the two is installed.

file /sbin/init

This reports results like the following:

/sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x7aa29ded613e503fb09fb75d94026f3256f01e7a

Next, visit and download the Linux release for your installation, either Linux for the 32-bit release or Linux x64 for the 64-bit version. Follow the instructions on the Oracle site. You'll download a file named something like jre-8u25-linux-i586.tar.gz (32-bit) or jre-8u25-linux-x64.gz (64-bit). The name may differ slightly.

Now, run the rest of the commands as root.

After downloading, create a place to store the unpacked version of what you've just downloaded. You may pick a different place if you wish to install it in a different location.

mkdir /usr/local/java

Next, unpack what you've downloaded into that directory:

cd /usr/local/java
tar -xvzf /tmp/jre-8u25-linux-x64.gz

After unpacking, you'll need to add "Java" to your path so it can be found when you need to run java. Add the following to /etc/profile, make sure to use the directory that was created when you unpacked what you downloaded. There will be a sub-directory specific to the version installed. Use that as your JAVA_HOME. Use your favorite text editor to edit the /etc/profile file.

vi /etc/profile

Add the following to the bottom of file:



export JAVA_HOME

export PATH

The next time you login, you can check to see if you've configured your environment correctly. If you have, the following command will tell you what version is running. It should be the same as what you just installed.

java -version

Output should look like the following

java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

이 글이 도움되었나요?
피드백을 보내주셔서 감사합니다. 고객 서비스 담당자에게 문의하시려면 지원 전화 번호 또는 위의 채팅 옵션을 이용하시기 바랍니다.
도와드릴 수 있어 기쁩니다! 더 도와 드릴 것이 있나요?
그것 유감스럽습니다. 혼동이 되었던 사항 또는 솔루션이 고객님의 문제를 해결하지 못했던 원인을 알려주세요.