Skip to content

Instantly share code, notes, and snippets.

@gautamr
Last active May 11, 2018 16:41
Show Gist options
  • Save gautamr/80e09cc267f4f686a2ef to your computer and use it in GitHub Desktop.
Save gautamr/80e09cc267f4f686a2ef to your computer and use it in GitHub Desktop.
ubuntu java eclipse install
gautamr@gautamr-inspiron-5458:~/Downloads$ sudo mkdir /usr/lib/jvm
gautamr@gautamr-inspiron-5458:~/Downloads$ sudo tar -xvf jdk-8u171-linux-x64.tar.gz -C /usr/lib/jvm/
# Before addin this jdk as an alternative, you can see that the new alternative is not listed:
sudo update-alternatives --query java
sudo update-alternatives --query javac
//update-alternatives - maintain symbolic links determining default commands
sudo update-alternatives --list java
// --install link name path priority
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdkXXX/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdkXXX/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdkXXX/bin/javaws" 1
# example
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_171/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_171/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.8.0_171/bin/javaws" 1
gautam@gautam-ubuntu:~/software/dev$ sudo update-alternatives --config java
There is only one alternative in link group java: /usr/lib/jvm/jdk1.7.0_09/bin/java
Nothing to configure.
// a - for all user, x - for executable
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
# set system-wise JAVA_HOME in /etc/profile.d folder. make java.sh file and add the following
XXX:/etc/profile.d$ sudo vi java.sh
export J2SDKDIR=/usr/lib/jvm/jdk1.8.0_171
export J2REDIR=/usr/lib/jvm/jdk1.8.0_171
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_171
export DERBY_HOME=/usr/lib/jvm/jdk1.8.0_171/db
export PATH=$PATH:/usr/lib/jvm/jdk1.8.0_171/bin:/usr/lib/jvm/jdk1.8.0_171/db/bin:/usr/lib/jvm/jdk1.8.0_171/jre/bin
XXX:~/Downloads$ sudo unzip gradle-2.14.1-bin.zip -d/usr/lib/
clipse:
sudo tar -xvf eclipse-SDK-3.6.2-linux-gtk.tar.gz -C/usr
mv eclipse eclipse-3.6.2-classic
sudo chown -R root:root eclipse-3.6.2-classic
sudo chmod -R a+rw eclipse-3.6.2-classic
sudo touch /usr/bin/eclipse-3.6.2-classic
sudo chmod 755 /usr/bin/eclipse-3.6.2-classic
sudo gedit /usr/bin/eclipse-3.6.2-classic
Set JAVA_HOME / PATH for all user
You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:
# vi /etc/profile
Next setup PATH / JAVA_PATH variables as follows:
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_09
export PATH=$PATH:$JAVA_HOME/bin
#!/bin/sh
#export MOZILLA_FIVE_HOME="/usr/lib/mozilla/"
export ECLIPSE_HOME="/usr/eclipse-3.6.2-classic"
$ECLIPSE_HOME/eclipse $*
sudo gedit /usr/share/applications/eclipse-3.6.2-classic.desktop
[Desktop Entry]
Encoding=UTF-8
Name=eclipse-3.6.2-classic
Comment=eclipse-3.6.2-classic IDE
Exec=eclipse-3.6.2-classic
Icon=/usr/eclipse-3.6.2-classic/icon.xpm
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true
First time only
./eclipse -clean &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment