Java 11 now required for KoLmafia, Java 17 recommended

heeheehee

Developer
Staff member
Note: this was initially written when we bumped the required version to 9. About a week later, we bumped it again to 11, which is a LTS release. We are considering one more move, from 11 to 17.

See https://kolmafia.us/threads/java-8-now-required-for-kolmafia.24547/ if you want more backstory.

Java 8 was released back in 2014. Since then, Java has moved to a much more frequent release cycle, adding many language features and greatly improving the standard library.

In part due to reported issues tied to version detection, but also to use industry-standard tooling for formatting in a forward-compatible fashion (due to a change in Java 16+), we are now requiring Java 9 to build and run KoLmafia.

However, Java 9 itself is no longer directly supported, as it isn't a long-term support (LTS) release. We strongly recommend upgrading to Java 17 (the latest LTS release), as we intend to further upgrade our codebase in the near future to take advantage of some of these new features.

As last time, if you're still using Java 8, you'll get an error trying to start KoLmafia. Upgrading to Java 17 should resolve that issue.
 
Last edited:

zarqon

Well-known member
Here's a note for anyone who, like me, got confused when you went to java.com to update Java and noted that Java 8 is still the latest version available there.

That website is for "consumers". We, the runners of KoLmafia, are not mere consumers. So even if you, like me, had until now considered yourself a consumer, you will nonetheless need to install the JDK (development kit) from oracle.com rather than the JRE (runtime environment) from java.com. Worked for me!

EDIT: Upon further reading, it seems the preferred source for upgrading Java is Adoptium.
 
Last edited:

Tombot

New member
I used the "Adoptium" JDK platform binary with the Mafia JAR and nothing happened, no errors, no windows popping up, nothing. But the development kit from oracle worked fine. So everyone shouldn't write that one off.
 
Last edited:
Had to change the .jar file association to get the adoptium option working. I don't use Java with anything else (knowingly, anyway).

It's probably safe to uninstall the Oracle stuff, right? That would be a plus.

edit: Window size / position got lost after the update. Font sizes are different here and there (smaller in some places, larger in others). Font face is a tiny bit different - or maybe it's just the size? Seems some line spacing has changed, separately from font size. Nothing overtly broken though.
 
Last edited:

MCroft

Developer
Staff member
Had to change the .jar file association to get the adoptium option working. I don't use Java with anything else (knowingly, anyway).

It's probably safe to uninstall the Oracle stuff, right? That would be a plus.
It can coexist, but if you don't need it, you can remove it.
edit: Window size / position got lost after the update. Font sizes are different here and there (smaller in some places, larger in others). Font face is a tiny bit different - or maybe it's just the size? Seems some line spacing has changed, separately from font size. Nothing overtly broken though.
You may want to look at the Preference for Look and Feel and see if there's a theme/font size that works better for you.
 
Thanks for the heads up about theme selection. I have been using default all along, so forgot all about that.

Went to grab a copy of the last pre-Java update build, to compare UI, and - gone? Apparently builds are so frequent now that history is less than 24 hours? Or is this just transient due to recent changes? If not transient, can this be changed to to cover at least the last 48 hours? In case someone who is updating / using daily wants to go to their previous build, as a contingency. If not, I can change locally to keep my own archive.

I have a much older build or two available locally, but I don't think it's wise to open that up anywhere where it can see current preference etc. files.
 

MCroft

Developer
Staff member
Thanks for the heads up about theme selection. I have been using default all along, so forgot all about that.

Went to grab a copy of the last pre-Java update build, to compare UI, and - gone? Apparently builds are so frequent now that history is less than 24 hours? Or is this just transient due to recent changes? If not transient, can this be changed to to cover at least the last 48 hours? In case someone who is updating / using daily wants to go to their previous build, as a contingency. If not, I can change locally to keep my own archive.

I have a much older build or two available locally, but I don't think it's wise to open that up anywhere where it can see current preference etc. files.
you can grab 21.9 from sourceforge, probably.
 

Rinn

Developer
Thanks for the heads up about theme selection. I have been using default all along, so forgot all about that.

Went to grab a copy of the last pre-Java update build, to compare UI, and - gone? Apparently builds are so frequent now that history is less than 24 hours? Or is this just transient due to recent changes? If not transient, can this be changed to to cover at least the last 48 hours? In case someone who is updating / using daily wants to go to their previous build, as a contingency. If not, I can change locally to keep my own archive.

I have a much older build or two available locally, but I don't think it's wise to open that up anywhere where it can see current preference etc. files.
Older releases are available on GitHub https://github.com/kolmafia/kolmafia/releases. Here's the revision from right before the java 9 change https://github.com/kolmafia/kolmafia/releases/tag/r25711
 

xKiv

Active member
Does anyone have a working .jinfo file for adoptium that I could use for update-java-alternatives?
(this is a very un-updated system, I am too scared of breaking things to do a full reinstall, and incremental updates are even worse proposition by this point)
 

heeheehee

Developer
Staff member
A heads up to everyone: we are planning to bump the minimum version required to the next LTS release, Java 11, in the coming days. You should not experience any disruptions unless you are using Java 9 or Java 10 (both of which are unsupported by Oracle).

We'll likely have one more jump, from 11 to 17, but we don't need to do so yet.

Does anyone have a working .jinfo file for adoptium that I could use for update-java-alternatives?
(this is a very un-updated system, I am too scared of breaking things to do a full reinstall, and incremental updates are even worse proposition by this point)
I looked at .jinfo files and it seems like it depends heavily on your current packaging setup / how you install the files. As a workaround, can you download Java 17 from Adoptium, unpack `java` into an accessible directory, and then use it exclusively for launching Mafia?

e.g. `./java -jar path/to/KoLmafia-12345.jar`

It's probably not necessary to keep all of the binaries unless you intend to actively develop the codebase + build from sources (and even then, you might be able to get away with just java / javac).
 

xKiv

Active member
I looked at .jinfo files and it seems like it depends heavily on your current packaging setup / how you install the files. As a workaround, can you download Java 17 from Adoptium, unpack `java` into an accessible directory, and then use it exclusively for launching Mafia?
For now, I have zulu12, and successfully managed a build from commandline. But I would like to have a way to automatically switch before I try it out. I can guesstimate as to what lines there should be in that file (based on the other .jinfo files I already have), I know what the paths will be.
In general I want to be running in debug mode from eclipse, in case something happens where I can find interesting additional information that way.
Commandline running using adoptium 17 seems to work.
 

MCroft

Developer
Staff member
dunno about eclipse, but switching JVMs and using gradle is dead easy with IntelliJ and VSCode.

For Eclipse, it looks like there is a plugin that is included by default in the most popular Eclipse distributions

I'd recommend a clone in a brand new directory and import it via the plugin and see how it goes before switching that to your main workspace.
 

heeheehee

Developer
Staff member
Eclipse can manage installed Java versions for you (Preferences -> Java -> Installed JREs), so I don't think you have to fiddle with a .jinfo or anything.
 

heeheehee

Developer
Staff member
As of r25756, we will now require Java 11 for building and running Mafia. I've updated the thread title to reflect that. As before, we strongly recommend that you upgrade to Java 17, as that's likely our next step in the coming weeks (where we plan to stay until the next LTS is released, in about 3 years).
 

MCroft

Developer
Staff member
Not sure how to make this work on macOS... Suggestions welcome, and TIA.
How are you running it now? There's a bunch of us on MacOS, so it should be easy to help you. The simplest way is to jump over to the GitHub release page, download the macOS.zip file from the bottom of that page, unzip it and run the installer inside it. It will install KoLmafia.app into your Applications directory with a bundled JDK.

If you don't want to do that (and it's still pretty much an experiment), you can install an updated JDK, set a version of java as your working java, and go from there.

From terminal, run /usr/libexec/java_home -V and you can see which versions are installed.

Type `export JAVA_HOME=```/usr/libexec/java_home -v17` and it will set your version of java. I do this in my ~/.zshrc file, but you can start with the command line. Then `java -jar /path/to/KoLmafia/KoLmafia-25656.jar` (or something like that) and it should run.
 
Bit of a long shot, but anyone have any advice for someone who also does a lot of Minecraft, which seems to be nonfunctional on adoptium? Currently trying to figure out if I can specify the java path for the server and client...
 
Top