Skip to content

Instantly share code, notes, and snippets.

@loop
Created January 9, 2015 16:18
Show Gist options
  • Save loop/85d8547c626c3ed186ef to your computer and use it in GitHub Desktop.
Save loop/85d8547c626c3ed186ef to your computer and use it in GitHub Desktop.
Installing Java SDK on Ubuntu
I recommend...
1. Download Java JDK
Download the 32Bit JDK right from SUN.
You want this: jdk-6-linux-i586.bin
2. Download Eclipse
Download the 32Bit Eclipse right from eclipse.org
You want this: eclipse-SDK-3.2.1-linux-gtk.tar.gz
Installation
A. Eclipse simply needs to be extracted.
B. The JDK requires that you run: sh jdk-6-linux-i586.bin, and agree to the terms.
Rename the folder it produces to something simple: JDK6.32
C. Configure BASH to export the JAVA_HOME env variable like so:
`
#BEG Copy and Paste
#Copy and Paste at the bottom of your /home/<user>/.bashrc file
#Then close all of your terminal windows. Reopen one, and type "eclipse"
# ~~~~~~~~~~~~~~~~~ JAVA (JDK,JRE) ~~~~~~~~~~~~~~~~~~~~~
export JAVA_HOME='/home/<user>/Desktop/JDK6.32'
PATH=.:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
# The eclipse alias below assumes that you have extracted the eclipse folder
# to your desktop. It can be anywhere. Edit path as necessary
alias eclipse='java -jar /home/<user>/Desktop/eclipse/startup.jar'
#END Copy and Paste
`
Additional Info
This is a very simple way to install the latest JDK. Obviously this method isn't supported by the package managers. You'll have to update on your own. The advantage is that the cooperation and performance of the two 32bit packages rivals the same on Windows. Also, this way, you can actually have multiple eclipses, JDK's, and, when you decide to, multiple Tomcat instances. They all can be installed in nearly the same way.
Notes
Once eclipse is running, you'll need to change the default compiler, and possibly add the JRE:
Window -> Preferences -> Java -> Compiler (Set the version ie 6)
Window -> Preferences -> Java -> Installed JREs (Confirm your JRE)
A few times I've downloaded the JDK, only to be presented with an error that a file could not be found, and that installation could not continue. It seems that, occasionally, the file available for download has been prepared incorrectly. Once the problem is reported, and a few hours go by, I try again with success. It doesn't happen often, but it's happened more than once.
__________________
Install Java's JDK 6u1
How to install .bins:
1. Download the .bin file and store it in anywhere you want. I recommend the Desktop, as it is easy to navigate through the Terminal.
2. Now open the Terminal window (Applications > Accessories > Terminal) and navigate to the folder where you have stored the file by using the cd command. For example, if your file is stored on the Desktop you need to type cd Desktop (The commands and filenames are case-sensitive).
Now your Terminal code will change to something like this – user@user-desktop:-/Desktop$
Similarly, you can navigate to other locations by using cd location.
3. Once you have navigated to the required location, type ls to list the files in that directory and note down the exact file name of your .bin file.
4. Type sudo chmod +x filename.bin. This command permits Ubuntu to execute the file. It will ask for your password. Enter the password and hit Enter.
5. Now type ./filename.bin. The .bin file will start installing from within the terminal. Just follow the instructions that appear on the screen. Once the installation is completed, close the terminal window.
That’s it! You have successfully installed the .bin file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment