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:
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:
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
 
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.
 
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!
 
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.
 
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)
 
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.
 
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?
 
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.
 
I am a Mac person, but it's been a long time since I messed with this. What version of MacOS are you using?
 
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.
 
Since the switch to Java 21, mafia no longer even comes up. Both machines (Win11) have the current JDK. Both have been rebooted since install, and since downloading the latest mafia version. I've been using r28237 since yesterday, and have no clue how to go about resolving this. Sincere thanks in advance for any tips/ideas!!
 
I assume no longer comes up means you don't see the mafia GUI.

You might try running from a command window. mafia detects some errors on startup but they are never logged except to the screen. So opening a window and running from it will display any start up errors.

How do you start mafia? It is certainly possible file associations got trashed by the upgrade.

Run Task Manager and see if there are any Java tasks running? Start mafia and see whether there is evidence of a new Java task staring up.

I can give you more details if you need them and explain why something might be helpful but at the moment I am just tired of typing and editing to make sure my instructions are correct enough to work for me :-)
 
Back
Top