Bug - Not A Bug I can't open any .jar files after r25707 [Java 8 no longer works with Mafia]

sadoatcakes

New member
Mod note from heeheehee: if you're reading this because you're having this same problem, you most likely need to download a newer version of Java. Keep reading for suggestions.

^ What is says on the box. When I try to open both 25712 and 25718 after downloading, I get two pop-up boxes in succession from the Java Virtual Machine Launcher:

Error: A JNI error has occurred, please check your installation and try again.

Followed by:

A Java Exception has occurred

Previous iterations of mafia run without issue; I'm currently adventuring with r25707. Whatever's changed, I don't think it's on my end.
 
Last edited by a moderator:

Magus_Prime

Well-known member
Just as an additional data point: I'm able to run 25718 just fine on a Windows 10 computer. What version, or versions, of Java do you have installed? There was an announcement posted, yesterday, that Java 9 or higher is now required.

Java 9 now required for KoLmafia, Java 17 recommended

Mod note from Mad Carew: Java 17 now required. Time marches into the future.
 
Last edited by a moderator:

oztrich

Member
I don't have much experience with Java other than specifically installing it to run Mafia - apologies in advance for asking silly questions here!

So, when it says that Java 9 is required, with Java 17 recommended my only Java install is the latest version of the JVM from from java.com, which appears to be this:

"Recommended Version 8 Update 301
Release date July 20, 2021"

That seems to be a long way out of date given the naming convention, but it's the version that is automatically suggested, and when I run the update tool locally it suggests I'm right up to date. What obvious thing am I missing here?

Edit: and I'm also getting the errors reported in OP.
 
You need to install the JDK not the JRE to get Java 9. The best place to install from is Adoptium and not from Oracle so you can get Java 17
 

fronobulax

Developer
Staff member
Oracle is not making life especially easier for end users. Try getting an update from https://adoptium.net/ which makes it easier to find what you need, even though it is also available from Oracle if you look hard enough.
 

oztrich

Member
Oracle is not making life especially easier for end users. Try getting an update from https://adoptium.net/ which makes it easier to find what you need, even though it is also available from Oracle if you look hard enough.

Yeah, I use Java for nothing else so just relied on java.com previously. When I looked into other versions it wasn't particularly obvious what I needed to do (or why). The link for adoptium was what I needed though, should have read the other thread properly first. Thanks!
 

heeheehee

Developer
Staff member
I've stickied this thread so anyone coming to post a new bug report about not being able to open Mafia sees it right away. Maybe.
 

cardern

Member
I'm receiving the error "Java Application launch failed" with v27759 after updating to the newest version of Java. I'm able to open v20388.

openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode)
 

fronobulax

Developer
Staff member
I'm receiving the error "Java Application launch failed" with v27759 after updating to the newest version of Java. I'm able to open v20388.

openjdk version "21.0.1" 2023-10-17 LTS
OpenJDK Runtime Environment Temurin-21.0.1+12 (build 21.0.1+12-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.1+12 (build 21.0.1+12-LTS, mixed mode)

How do you launch? There are ways to update Java that allow jar files to be run with the old version. That might explain why v20388 works.
 

cardern

Member
How do you launch? There are ways to update Java that allow jar files to be run with the old version. That might explain why v20388 works.
I'm just double clicking on the .jar file from Finder (Mac). Should I try launching from cmd or some other method?
 

fronobulax

Developer
Staff member
I'm just double clicking on the .jar file from Finder (Mac). Should I try launching from cmd or some other method?
I'm not a Mac person :) Windows uses a file association to determine what it does with a double click and some Java installations update Java but don't always update the association.

You might try launching from a command. "java -version" should confirm that the cmd is using the expected version of Java. Setting the current directory (for the command) to be the directory containing the jar file and then trying "java -jar <insert name of jar file here>" to run might give better results.
 

MCroft

Developer
Staff member
I am a Mac person, but it's been a long time since I messed with this. What version of MacOS are you using?
 

fronobulax

Developer
Staff member
macOS 13.2 (22D49)

Restarting my laptop after installing the newest version of Java seems like it resolved the issue!

In the Windows world there are many installations that are not "complete" until the system is rebooted so this could explain what was reported.
 
Top