Skip to content


Using Freenet with OpenJDK (AdoptOpenJDK) on Windows

Java/Oracle recently rolled out a new licensing policy. Frankly, I find it’s a mess and I don’t really understand what is and what isn’t allowed. It seems personal use and development use are both allowed, but still, downloading the SDK now requires creating an Oracle account. That broke the camel’s back. So I looked into alternatives.

AdoptOpenJDK seemed nice. It provides builds that seem regularly updated, for OpenJDK 8, 11 and 12, and it even lets you choose which Java VM you want, between HotSpot and OpenJ9. That JVM choice doesn’t seem to matter that much, from the few benchmarks I found, but still it’s appreciated.

Installation is straightforward, and I was soon able to get this in my console:

> java --version
openjdk 12.0.1 2019-04-16
OpenJDK Runtime Environment AdoptOpenJDK (build 12.0.1+12)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 12.0.1+12, mixed mode, sharing)

A nice upgrade from Java 8u201.

But, to my surprise, Freenet wasn’t able to find Java (so wasn’t able to run at all). After a brief search, I found that I was missing the registry entries for Java. Maybe I messed up during setup, but anyway it can be fixed quite trivially, by defining the following keys via Regedit (you could also just put this in a .reg file and “run” it):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft]

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment]
"CurrentVersion"="12.0.1"

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\12.0.1]
"JavaHome"="C:\\Program Files\\AdoptOpenJDK\\jdk-12.0.1.12-hotspot"

Note that, depending on your version, you’ll want to replace “12.0.1” with whatever you have (and of course, adapt the path too). Although I’m actually not that sure whether the version number matters for real, as long as both occurrences match.

Freenet should now be able to start.

Edit: I tried on another computer, and I tried the “Javasoft (Oracle) registry keys” option during setup. It created some keys automatically, but not the ones needed for Freenet to work: it created keys under HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JDK, which I guess might turn out useful for development, but not under HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment, which is what Freenet needs.

Update (2019-07-31)

I just tried on yet another computer, where I hadn’t run Freenet in a while. Mysteriously, despite setting all this configuration properly, Freenet still wouldn’t start (it was still looking in the old path, I have no idea why… maybe a restart will help). As a last resort, I added the full path to the Java executable, in [Freenet path]/wrapper/wrapper.conf, with the follwoing line (NB: it should already exists, you just need to complete it):

wrapper.java.command=C:\Program Files\AdoptOpenJDK\jdk-12.0.2.10-hotspot\bin\java.exe

Update (2019-11-11)

I don’t know how I didn’t notice that in the first place, maybe it’s because of the “AdoptOpenJDK” name or because they put forward the JDK so much, but they provide both a full JDK and just the JRE alone. So unless you’re planning to do Java development, you can grab just the JRE, which is about 4 times smaller than the JDK. I updated the link in the post, to point to a download page where it’s clearer that you can choose between those 2 options.

Posted in software, Windows.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA