Install JDK on Arch Linux – manually

Archlinux-icon-crystal-64Duke (Java mascot) wavingI suppose the number of readers here that do use Arch Linux and do programming in Java is rather close to zero, but anyway I want to write this down for my own reference, so why not do it in English so others can benefit from it.

I recently bought an online course on Java developing because, well, I’d like to (re-)learn the language and I enjoy coding every now and then.

I did want to use the javafx classes, though, and that’s where the problems began: It started with code not compiling and the compiler complaining about the javafx classes not being there. I quickly found out that the javafx classes were a seperate package in the OpenJDK distribution.

So I figured I install the extra package and all is fine. Well, it wasn’t. I found out that there are javafx classes for version 8, but not for the actual version 10 of OpenJDK.

So I thought I downgrade to version 8, but then I read that Openjdk does not (yet) implement all of Java, that is, the JDK of Oracle would have the language complete, but OpenJDK wouldn’t.

So I thought: Why not drop OpenJDK all togehter and switch to the original. It’s not fully open source, yes, but heck, I wanted the whole thing and the recent thing, although I knew I would hardly ever need any features that are only in version 10 but not 8 and or only in Oracle’s JDK but not in OpenJDK’s.

So I looked at the AUR and found a recent package of Oracle’s JDK. Which I tried to install but didn’t work. I don’t want to go into detail, but it seemed that there was a version update from 10.0.2 to 10.0.3 and the link didn’t work any more.

So I downloaded the recent JDK from Oracle’s website and searched the internet for advice, what to do with it. I found Shahriar Shovon’s fine article on how to install Oracle JDK 10 on Arch Linux. For obvious reasons I chose the manual install.

That worked. And I could write my first small Java code samples with an editor and compile on the command line.

Then I wanted an IDE. Whether you install IntelliJ or Eclipse on Arch Linux, it will install a JDK alongside with it; OpenJDK.

So there I was, with an IDE, Oracle’s JDK in a custom directory (/opt) and OpenJDK 8 installed through pacman. And well, there was some conflicting. So I deleted the shell script I created when installing Oracle’s JDK manually under /etc/profile.d/ and turned Oracle’s JDK into dead data on the hard drive. I had OpenJDK 8, and I added openjfx8 and could have been content. But I wasn’t.

There must be some way to get the manually installed Java version integrate into Arch. And it was. For archlinux-java, the helper script for the selection of the default JDK to recognize any Java JDK, it must be installed under /usr/lib/jvm/  with a cetain directory name pattern, as I learned here.

So I renamed Oracle’s JDK directory into java-10-oracle  and moved it to usr/lib/jvm/ , and running archlinux-java status  suddenly listed Oracle’s JDK among the available JDKs.

archlinux-java set java-10-oracle  then set it to the system default, and all is fine now.

Whenever there is a new JDK coming out, all I need to do is download it, unpack it under /usr/lib/jvm/  and set it to default with archlinux-java . Pretty straight forward and I do not have to hassle with incorrect download links in the AUR.

Dieser Beitrag wurde unter Spaß mit Arch Linux, Technik abgelegt und mit , , , , , , , , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.