How to install Java SE Development Kit 7 on Debian
Debian is a wonderful “open source” Linux distribution that I have been using for quite some time now. One problem that creeps up every now and then is the whole “open source” thing–frankly sometimes you need proprietary software. Now I hate that and if you know any better you probably do too, but such is the world we live in.
I needed Java SE 7 to try to fix a small problem I had been having with PyCharm. For some reason the “ctl+v” for pasting is not working and I had seen somewhere on a forum that the java version could be causing a problem. I had been using openjdk-7 –and since I don’t do much in java–that really hadn’t been much of an issue. But now it was and Debian does not have the official Oracle version in the repositories–anywhere. (Oracle is evil by the way).
So off to some “googling” to find out a solution…
While Debian does not provide the oracle version in the repos, they do have a neat package called “java-package” which is kindly provided for the sole purpose of helping poor developers install the evil official version of java on their systems. (Get the feeling that this is a fairly frequent problem). This lovely little package installs a program called “make-jpkg” which you can then use to compile a .deb installer to install on your system.
So should you need to do this little exercise it will look like this:
Download Java SE 7 to your computer.
open your terminal and
cd
into your Downloads folder or wherever you downloaded the file to.then
make-jpkg your-file-here.tar.gz
to compile that compressed file into a .deb file.Finally
sudo dpkg -i your-new-deb-file-here.deb
to install Oracle’s java.
You are also probably interested in using this version of java on a regular basis–and since you have it now maybe even all the time. We can do that also!
In your command line type sudo update-alternatives --config java
. This will bring up a small command line menu that will enable you to change which version of Java you want to be your default version:
kevin@debian:~/Development/FlaskHF$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061 auto mode
* 1 /usr/lib/jvm/j2sdk1.7-oracle/jre/bin/java 317 manual mode
2 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061 manual mode
Press enter to keep the current choice[*], or type selection number:
Simply enter the number of the version you want and you’re done! Hopefully this will be of some help to you. Leave any comments or helpful tips below.
PS This didn’t solve my Pycharm problem so if you have any tips you can pass those there also
PPS I just solved the PyCharm problem it was related to keyboard layout order in Debian. Weird! see thread.