Been a while since I’ve posted anything here, but I’m back. Since my last post I’ve completed 2 years at university (foundation year and first year BSc Computing) and now moving into stage 2 of computer science as I fancy doing a transfer to a more full-on course.
Anyway, I digress, I have dual-booted ElementaryOS, an Ubuntu-based operating system with the look an feel of Mac OSX, and less of the clutter of some of the other distros I’ve used, and less of the hardware compatibility issues I’ve also found with other distros (PCLinuxOS has problems with my Intel graphics chip).
This is the website http://elementaryos.org/ and a little more info about it in Linux User & Developer magazine (interview with a few of the developers) http://www.linuxuser.co.uk/features/elementary-os-interview-iconic-design
Moving into stage 2 we’re going to be working with Java and Oracle. I’ve already installed NetBeans through the software centre but now need the other two.
This post is more about a set of notes for myself but is useful if you have Ubuntu or ElementaryOS (Luna) and want to install the Java Development Kit and Oracle SQL Developer. I also include how to create a desktop/application shortcut.
N.B. Java’s JDK MUST be installed before installing Oracle SQL Developer, as it doesn’t use the OpenJDK platform. Alternatively, Oracle CAN be installed before the Java platform, but the sqldeveloper.sh file should be changed retrospectively. I’ve done Java then SQL Developer to make it easier to follow.
The first step, then is to download the JDK.
To install the JDK I used this guide:
You will need to download the tar.gz file for either Linux x86 (32-bit) or Linux x64 (64-bit), I downloaded the 32-bit version to be on the safe side, called jdk-7u45-linux-i586.tar.gz or jdk-7u45-linux-x64.tar.gz (the version may be different when you download it) but it ends in either i586.tar.gz or x64.tar.gz. Anyway, download whichever you choose.
After this, extract the folder to where you downloaded it. You need to move it to /usr/lib/jvm/ , if it doesn’t exist, open terminal and type
sudo mkdir /usr/lib/jvm/
Now to move it
sudo mv jdk1.7.0_45 /usr/lib/jvm/
Get the system to use the new JDK
NOTE: The formatting of this page turns a double hypen “- -” (no spaces) into a single elongated hypen “–” for install, so I’ve put this bit in Pastebin for you: http://pastebin.com/5jYX8tU3
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_45/bin/java" 1
Then http://pastebin.com/Lt8htYqb (another formatting problem with this page)
sudo update-alternatives --config java
This will probably tell you there’s nothing to configure, which is fine.The tutorial this is from includes registering the Firefox java plugin withthe new JDK. For some reason this didn’t work for me but it’s not a problem as I already had the other OpenJDKs installed, so it uses that.
To check the new JDK has installed properly, check the version
The output should be
java version “1.7.0_45″
If not, then go back a few steps and make sure the command to get the system to use the new Java version has been typed properly
Next step here is to install Oracle SQL Developer.
On the downloads page http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html download the version for other platforms, for me called sqldeveloper-3.2.20.09.89-no-jre.tar.gz
Extract the folder and move it to root. In a new tab, navigate to where you’ve just installed Java, in my case it’s /usr/lib/jvm/jdk1.7.0_45 and make a note of the path
Navigate to /sqldeveloper/sqldeveloper/bin/ and open sqldeveloper.conf. If you can’t edit it there, copy it to your documents so you can edit it. Open it and edit the line SetJavaHome from …/…/jdk to /usr/lib/jvm/jdk1.7.0_45 (the version that’s just been installed)
Edit the AddVMOption line to -XX:MaxPermSize=512M
If it’s in your documents (you didn’t have write permission in /sqldeveloper/sqldeveloper/bin/) then this needs to be moved back into that folder (I prefer to copy), in terminal:
sudo cp -i sqldeveloper.conf /sqldeveloper/sqldeveloper/bin/
We’re done. Before creating any shortcut for it, if you’re using Ubuntu, navigate to /sqldeveloper/ and find the sqldeveloper.sh file. Right-click it > Properties > Permissions and select Allow executing as a program. In Elementary right-click > Properties > More, and click on Execute for Owner, Group and Everyone (so it shows as 755).
To make sure that SQL developer works, open Terminal and type
I get a message telling my I’m not using the correct version of the JDK, but I click past this (I have come across a problem yet as I haven’t used it)
Now, we want to create a shortcut to sqldeveloper.sh that’ll appear in Applications
In the Documents folder create a blank file called Oracle SQL Developer.desktop. It might try to rename itself once enter is pressed so just rename it again. Open it in Gedit or Scratch and paste this inside it:
[Desktop Entry] Name=Oracle SQL Developer Type=Application Icon=/sqldeveloper/icon.png Terminal=False Categories=Development Exec=bash /sqldeveloper/sqldeveloper.sh
- Terminal=False because we don’t want Terminal to open up when we click on the shortcut
- The entry must have a category that highlights in red in Scratch (ElementaryOS) for it to appear in the Applications menu, it is not necessarily the case in Ubuntu
- The last line is the command, sqldeveloper which would be entered in Terminal
This desktop file now needs to be copied to the Applications folder
sudo cp -i “Oracle SQL Developer.desktop” /usr/share/applications/
It should now appear in the menu (under Programming in ElementaryOS)