Difference between revisions of "JDK setup"
Line 5: | Line 5: | ||
==Get Java== | ==Get Java== | ||
2 versions of Java are available: | 2 versions of Java are available: | ||
− | * '''JRE''' as Java Runtime Environment. For end-users | + | * '''JRE''' as Java Runtime Environment. For end-users. |
− | |||
− | |||
Download JRE: https://java.com/getjava | Download JRE: https://java.com/getjava | ||
+ | * '''JDK''' as Java Devolpment Kit. For developers and application servers. The JDK includes the corresponding JRE. | ||
+ | Download JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html | ||
− | + | You need to install the JDK on your development station & servers. | |
==Windows installation== | ==Windows installation== | ||
Line 16: | Line 16: | ||
==Linux installation== | ==Linux installation== | ||
− | On a server, I | + | On a server, I advise you to put the JDK instead of the JRE. Many services requires the JDK such as JMX. |
− | only | + | |
− | + | While on Windows ORACLE java is almost the only JVM available, on Linux you can choose your JVM vendor: OpenJDK, ORACLE, .... | |
− | + | I advise you to use the official ORACLE library, instead of the OpenSource OpenJDK due to stability issues and JavaFX2 compability. | |
− | + | ||
− | + | ===ORACLE JVM automatic installation (ubuntu)=== | |
− | + | This is for Ubuntu based distributions only. | |
+ | |||
+ | Add a new repository: | ||
+ | <syntaxhighlight lang="bash"> | ||
# add-apt-repository ppa:webupd8team/java | # add-apt-repository ppa:webupd8team/java | ||
# apt-get update | # apt-get update | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Install ORACLE JDK packages: | ||
+ | <syntaxhighlight lang="bash"> | ||
# apt-get install oracle-java7-installer oracle-jdk7-installer | # apt-get install oracle-java7-installer oracle-jdk7-installer | ||
+ | </syntaxhighlight> | ||
+ | |||
To remove the repository: | To remove the repository: | ||
+ | <syntaxhighlight lang="bash"> | ||
# apt-add-repository --remove ppa:webup8team/java | # apt-add-repository --remove ppa:webup8team/java | ||
− | + | </syntaxhighlight> | |
− | + | ||
− | + | ===ORACLE JVM manual installation (debian)=== | |
− | |||
You've to retrieve the JDK / JRE from the sun website | You've to retrieve the JDK / JRE from the sun website | ||
http://www.oracle.com/technetwork/java/javase/downloads/index.html | http://www.oracle.com/technetwork/java/javase/downloads/index.html |
Revision as of 18:54, 10 November 2013
“Java” is one of the most popular and common language in this world.
It's everywhere, and you need some library to execute these programs.
Contents
Get Java
2 versions of Java are available:
- JRE as Java Runtime Environment. For end-users.
Download JRE: https://java.com/getjava
- JDK as Java Devolpment Kit. For developers and application servers. The JDK includes the corresponding JRE.
Download JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
You need to install the JDK on your development station & servers.
Windows installation
Linux installation
On a server, I advise you to put the JDK instead of the JRE. Many services requires the JDK such as JMX.
While on Windows ORACLE java is almost the only JVM available, on Linux you can choose your JVM vendor: OpenJDK, ORACLE, .... I advise you to use the official ORACLE library, instead of the OpenSource OpenJDK due to stability issues and JavaFX2 compability.
ORACLE JVM automatic installation (ubuntu)
This is for Ubuntu based distributions only.
Add a new repository:
# add-apt-repository ppa:webupd8team/java
# apt-get update
Install ORACLE JDK packages:
# apt-get install oracle-java7-installer oracle-jdk7-installer
To remove the repository:
# apt-add-repository --remove ppa:webup8team/java
ORACLE JVM manual installation (debian)
You've to retrieve the JDK / JRE from the sun website http://www.oracle.com/technetwork/java/javase/downloads/index.html Download Oracle JDK Download link: http://download.oracle.com/otn-pub/java/jdk/7u9-b05/jdk-7u9-linux- x64.tar.gz
- wget -c --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F"
"<DOWNLOAD_URL>" --output-document="<TARGET_FILE_NAME>" Installation
- tar -xzvf jdk-7u9-linux-x64.tar.gz
- mv jdk1.7.* /usr/lib/jvm
- cd /usr/lib/jvm
Adjust symlink
- rm /usr/lib/jvm/default-java
- ln -s /usr/lib/jvm/jdk1.7.0_17/ /usr/lib/jvm/default-java
Perform update
- update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_09/bin/java 1065
- update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_09/bin/javac 1065
- update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.7.0_09/bin/jar 1065
- update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_09/bin/javaws 1065
Choose system version
- update-alternatives --config java
Check result
- java -version
Update environment You need to add an environment variable:
- vim /etc/profile
Ubuntu:
- vim /etc/environment
export JAVA_HOME="/usr/lib/jvm/jdk1.7.0_09" if [ "`id -u`" -eq 0 ]; then PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$JAVA_HOME/bin" else PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:$JAVA_HOME/bin" fi export PATH Guillaume Diaz Page 6 / 30 version 1.8Continuous Integration Platform # Linux Reminders Don't forget to adjust the JAVA related services: Tomcat /etc/default/tomcat7 Eclipse IDE eclipse.ini Jenkins etc. Java # OpenJdk It’s always good to setup OpenJDK as well, especially for the old version as there is more updates.
- apt-get install openjdk-6-jdk