Installing SQLDeveloper 4 on Mint and Ubuntu – Minus the Alien

Deb recently bought a new kettle.
Now, a kettle used to simply boil water and turn itself off when it was done.
Not this thing.
It lights up as it boils and announces the fact that it’s finished with a melodious ping.
It’s got gauges and lights and switches.
I’ve decided that it’s probably a Dalek in disguise.
Like Daleks (or at least, the original Daleks), it can’t go up stairs – or if it can, it’s not advertising the fact.
Every morning, descending to the kitchen is filled with trepidation.
When will the Dalek tire of vaporizing innocent water molecules and move on to World Domination…

Doc-tor ! Doc-tor ! I feel like a ket-tle !

Doc-tor ! Doc-tor ! I feel like a ket-tle !

I wouldn’t be entirely surprised to find that, like most whizzy modern appliances, it runs on Java.
Which brings us, by a fairly circuitous route, to the topic at hand – SQLDeveloper.

Oracle’s latest incarnation of it’s IDE does indeed run on Java – the version 7 JDK to be precise.
In this post, I’ll go through the steps required on Mint to :

  • Install the Java 7 JDK
  • Install SQLDeveloper 4
  • Persuade SQLDeveloper 4 to play nicely with Java
  • Add SQLDeveloper to the Cinnamon Menu

The good news is that we can do all of this without the messy alien conversion of an rpm package to .deb format.

NOTE – I’ve followed these steps on Mint13, but they should be pretty much the same for any Debian Distro.
Anyway, without further ado…

Install Java 7

What’s installed now

Before getting into the installation, it’s probably a good idea to establish what Java version you have at present.
To do this, open a Terminal Window and :

java -version

This will probably return something like :

java version "1.6.0_30"
OpenJDK Runtime Environment (IcedTea6 1.13.1) (6b30-1.13.1-1ubuntu2~0.12.04.1)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

Assuming you haven’t got a version that is 1.7.0 or greater, you’re going to need to update it for SQLDeveloper.

Getting the latest and greatest Java version

The easiest way to do this is – courtesy of instructions found here :

sudo add-apt-repository ppa:webupd8team/java

Running this will give you a message similar to the following :

You are about to add the following PPA to your system:
 Oracle Java (JDK) Installer (automatically downloads and installs Oracle JDK6 / JDK7 / JDK8). There are no actual Java files in this PPA. More info: http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

Debian installation instructions: http://www.webupd8.org/2012/06/how-to-install-oracle-java-7-in-debian.html
 More info: https://launchpad.net/~webupd8team/+archive/java
Press [ENTER] to continue or ctrl-c to cancel adding it

Hit ENTER and…

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.HQYZnMcKX0 --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80/ --recv 7B2C3B0889BF5709A105D03AC2518248EEA14886
gpg: requesting key EEA14886 from hkp server keyserver.ubuntu.com
gpg: key EEA14886: public key "Launchpad VLC" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

I’m not sure if the following step is necessary, but I ran it to be on the safe side. Ensure that your packages are up-to-date by running :

sudo apt-get update 

Now for the installation itself…

Installing Java 7

Start by getting the installer :

sudo apt-get install oracle-java7-installer

The output looks like this :

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  gsfonts-x11
Suggested packages:
  visualvm ttf-baekmuk ttf-unfonts ttf-unfonts-core ttf-kochi-gothic
  ttf-sazanami-gothic ttf-kochi-mincho ttf-sazanami-mincho ttf-arphic-uming
The following NEW packages will be installed
  gsfonts-x11 oracle-java7-installer
0 to upgrade, 2 to newly install, 0 to remove and 31 not to upgrade.
Need to get 26.7 kB of archives.
After this operation, 228 kB of additional disk space will be used.
Do you want to continue [Y/n]? 

Yes, we do want to continue so enter ‘Y’.
At this point you’ll be presented with the following screen :

Takes me back to the early 90's...

Takes me back to the early 90’s…

Hit ENTER and …

Yes, I do want to install DOOM...er...Java

Yes, I do want to install DOOM…er…Java

Use the left arrow key to navigate to Yes and hit ENTER.

You will then get feedback to the effect that it’s downloading stuff. This should end with something like :

Oracle JDK 7 installed
update-alternatives: using /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so to provide /usr/lib/mozilla/plugins/libjavaplugin.so (mozilla-javaplugin.so) in auto mode.
Oracle JRE 7 browser plugin installed
Setting up gsfonts-x11 (0.22) ...

To check that it’s done what we wanted :

java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

Where’s the JDK ?

At this point, the system is using the java executable from the Java Runtime Environment (JRE).
SQLDeveloper will need to know where the Java Developer Kit (JDK) is located.

You can verify this and find the JDK itself as follows :

which java
/usr/bin/java

If you look at /usr/bin/java you’ll see it’s a symbolic link…which points to another symbolic link…which eventually points to the actual location of the java executable…

ls -l /usr/bin/java
/usr/bin/java -> /etc/alternatives/java
ls -l /etc/alternatives/java
/etc/alternatvies/java -> /usr/lib/jvm/java-7-orale/jre/bin/java

In this case, the Java executable is in the JRE, not the JDK.

Fortunately, the JDK itself is also present. We can find this in :

/usr/lib/jvm/java-7-oracle/bin

We need to keep a note of that directory for when we fire up SQLDeveloper.
Speaking of which…

Getting the right SQLDeveloper

To get the SQLDeveloper download, you will need an Oracle Technet account. Fortunately, this is free.
You can do this by going to the Technet Home Page.

Once you’re set up, go to the SQLDeveloper Downloads Page.

There are a couple of things to note here.
First, the package you need to download is labelled Other Platforms.
Secondly, if you do happen to look at the Release instructions for this package, it will mention JDK 1.6.0_11 or above.
These instructions are out of date in this regard and refer to the previous version of SQLDeveloper.

Anyway, on the download page, click accept License Agreement and click on the Other Platforms Download.

Free you say ? That's my kind of price.

Free you say ? I’ll take it.

At this point, you may be asked to re-enter your Technet credentials.

When prompted by Mint, save the file.

Once completed, go to the Downloads directory and you should see…

cd $HOME/Downloads
ls sqldeveloper-4.0.1.14.48-no-jre.zip
sqldeveloper-4.0.1.14.48-no-jre.zip

Installing SQLDeveloper4

We’re going to install SQLDeveloper under /opt so…

sudo mkdir /opt/sqldeveloper401

Now to copy and extract the zip file …

sudo cp $HOME/Downloads/sqldeveloper-4.0.1.14.48-no-jre.zip /opt/sqldeveloper401/.
cd /opt/sqldeveloper401
sudo unzip sqldeveloper-4.0.1.14.48-no-jre.zip

At this point, the output will look something like this :

...
 inflating: sqldeveloper/svnkit/licenses/COPYING  
  inflating: sqldeveloper/svnkit/licenses/JAVAHL-LICENSE  
  inflating: sqldeveloper/svnkit/licenses/SEQUENCE-LICENSE  
  inflating: sqldeveloper/svnkit/licenses/SQLJET-LICENSE  
  inflating: sqldeveloper/svnkit/licenses/TRILEAD-LICENSE  
  inflating: sqldeveloper/svnkit/licenses/license.txt  
  inflating: sqldeveloper/svnkit/sequence.jar  
  inflating: sqldeveloper/svnkit/sqljet.jar  
  inflating: sqldeveloper/svnkit/svnClientAdapter.jar  
  inflating: sqldeveloper/svnkit/svnjavahl.jar  
  inflating: sqldeveloper/svnkit/svnkit.jar  
  inflating: sqldeveloper/svnkit/trilead.jar  
  inflating: sqldeveloper/view-source-paths.lis  

Once completed, we’re now ready to finalise the configuration.

Setting the Java Path for SQLDeveloper

To do this, we simply need to run SQLDeveloper. The first time it starts, it will ask for a path to the JDK.
This will be the path we figured out earlier. So…

cd /opt/sqldeveloper401/sqldeveloper
sudo chmod+x sqldeveloper.sh
. ./sqldeveloper.sh

When we execute the shell script to start SQLDeveloper we’ll get…

 Oracle SQL Developer
 Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.

Type the full pathname of a JDK installation (or Ctrl-C to quit), the path will be stored in /home/mike/.sqldeveloper/4.0.0/product.conf

At this point, we enter the path, minus the bin directory (which SQLDeveloper will look in automatically) :

/usr/lib/jvm/java-7-oracle

If you have a previous version of SQLDeveloper installed, you will be asked if you want to copy all the settings, connections etc to the latest version :

sqldev_import

Finally, SQLDeveloper will start.

Adding SQLDeveloper4 to the Cinnamon Menu

To add SQLDeveloper to the menu…

Right-click the Menu in the bottom left corner of the screen and select Configure :

Mint_Menu_Config

Click the Open the menu editor button.

menu_editor

Select New Item

Name : SQLDeveloper4.0.1
Command : /opt/sqldeveloper4/sqldeveloper/sqldeveloper.sh

Click on the rocket icon and select the sqldeveloper icon at :
/opt/sqldeveloper4/sqldeveloper

Now you should see the SQLDeveloper4.0.1 option under the Programming Menu.

After all that, I feel like a cup of coffee. Now where did I leave that Sonic Screwdriver…

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s