Difficulty Running Mafia on new Win11 computer

Sparklebeast

New member
I've been having a rough go at making mafia work on my new computer. I have installed the Adoptium Java 17 (located in C:\Program Files\Eclipse Adoptium\jdk-17.0.7.7-hotspot), and when I run the jar file it doesn't do anything. When I run it through CMD I get This message:

Error: Could not find or load main class C:\Users\mages\Documents\mafia\KoLmafia-27437.jar
Caused by: java.lang.ClassNotFoundException: C:\Users\mages\Documents\mafia\KoLmafia-27437.jar

The jar's path is: C:\Users\mages\Documents\mafia
 

Sparklebeast

New member
When I run java -version in the cmd, it gives me:
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)
 

MCroft

Developer
Staff member
Hey Sparklebeast, sorry you're having troubles! My guess is that this is an environment issue. I have four recommendations to try first:
  1. Try running cmd.exe as administrator, then executing your command.
  2. get a newer JAR file.
    This will test if something just went wrong with the file you have.
  3. Save the code from here as HelloWorld.java in the same directory and run java HelloWorld.java
    This will test if any java code can run
  4. Move the file to a different directory
    some versions of Windows protect the Documents and Downloads folders by not allowing scripts to run. The helps against certain malware.
 

fronobulax

Developer
Staff member
Try opening a command line in C:\Users\mages\Documents\mafia and then running java -jar KoLmafia<version>.jar

Or if the following makes sense - right click on the jar file and Open with and then pick where java.exe is located.
 

Sparklebeast

New member
I ran cmd as administrator, and was able to get it to execute using the java -jar KoLmafia<version>.jar command in the document\mafia directory. The double click still doesn't work though.

EDIT -tried running hello world from the mafia directory, and it didn't do anything.
 

MCroft

Developer
Staff member
if you move your hello world or kolmafia jar to a directory that isn't under Documents, do they work?
 

fronobulax

Developer
Staff member
I ran cmd as administrator, and was able to get it to execute using the java -jar KoLmafia<version>.jar command in the document\mafia directory. The double click still doesn't work though.

EDIT -tried running hello world from the mafia directory, and it didn't do anything.

The failure to double click means the file association between jar files and Java is not set or correct.

If you want you can open a command line and try "start KoLmafia<version>.jar" and confirm that it is the file association.

If you right click on the jar file and then select Open With you should get something that asks how you want to open the file. You want to chose Java.exe however it is labelled. It will not be an answer from the App Store.

Some nits - take my comments with a grain of salt since I am still on Windows 10. I do not need to be an Administrator to run KoLmafia. Windows does not like KolMafia installed and run from the Desktop but I have no recollection of issues from Documents. Nevertheless my mafia jar is in C:\Dropbox\dist which is not a directory Windows in protective about.
 

Sparklebeast

New member
I apologize, that maybe came off as more flip than I intended. I am sincerely grateful to get back and running - Playing KoL is something I love doing, and I was mega bummed at the prospect of it not working on my new computer.
 

fronobulax

Developer
Staff member
I apologize, that maybe came off as more flip than I intended. I am sincerely grateful to get back and running - Playing KoL is something I love doing, and I was mega bummed at the prospect of it not working on my new computer.

Sorry. I was trying to acknowledge that if it is working for you then we don't have to spend any more time figuring out what fixed it for you. I could have phrased that better.
 
Top