Bug KolMafia dumping files in Steam folder

harbinger1984

New member
Running on Windows 10.

I only play during Crimbo any more so I'm pretty sporadic with updates. Pulled down version 27696 the other day to get ready for the coming season, and it doesn't see any of my old configs. After a bit of poking around, I learn that it's created a new set of folders but they aren't where I launched KolMafia from, and they aren't in AppData - instead they're in my Steam install folder.

Out of curiosity more than anything else, I tried to launch the other version I had on hand - 27065 - and it also is going to the Steam location.

How do I make it stop? Is there some registry setting that's doing this?
 
Kolmafia puts its data in subfolders from where you run it. So if the .JAR is in your steam folder it will put the files there. You need the new version you download in the same place you had your old version .JAR file
 

harbinger1984

New member
I understand that's the expected behavior, but I am seeing these files land in my steam folder while running the jar from a folder on my desktop (which is not the steam folder, just to be extra clear).
 

fronobulax

Developer
Staff member
I understand that's the expected behavior, but I am seeing these files land in my steam folder while running the jar from a folder on my desktop (which is not the steam folder, just to be extra clear).
Try creating a folder under Documents and running from there. It is a long shot but the Desktop is not a "normal" folder and I have seen Steam do some weird stuff when files and games are not in the defaults it prefers. It could be trying to remap something from Desktop. Real long shot but it maybe that your Java associations have gotten tweaked so that the default directory when running is something Steam related and not the directory containing the jar.
 

harbinger1984

New member
Try creating a folder under Documents and running from there. It is a long shot but the Desktop is not a "normal" folder and I have seen Steam do some weird stuff when files and games are not in the defaults it prefers. It could be trying to remap something from Desktop. Real long shot but it maybe that your Java associations have gotten tweaked so that the default directory when running is something Steam related and not the directory containing the jar.
Thanks for the suggestion. Looks like it's still reaching for the Steam folder even when launching from a folder directly under my user's home, but maybe you are on to something with the associations. I'll dig into that a bit more.
 

fronobulax

Developer
Staff member
Thanks for the suggestion. Looks like it's still reaching for the Steam folder even when launching from a folder directly under my user's home, but maybe you are on to something with the associations. I'll dig into that a bit more.

Open a command line.
Change the directory to the directory containing the KoLmafia jar file.
Confirm Java is on the PATH by typing "java -version" and seeing something like
C:\KoLmafia>java -version
java version "17.0.4.1" 2022-08-18 LTS
Java(TM) SE Runtime Environment (build 17.0.4.1+1-LTS-2)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.4.1+1-LTS-2, mixed mode, sharing)

If that works then launch mafia by typing "java -jar KoLmafia-27726.jar" where you have changed the name of the last parameter to be the name of the jar file.

Watch the command line for messages because sometimes mafia will detect a problem on startup but not log it to any file.
 

harbinger1984

New member
Okay, this feels like progress! When launched this way, I see a message that the current directory is the working directory. Launching from my old desktop folder, it picks up all my configs and everything.

So there's something different that goes on when I just double-click the jar vs the commandline.
 

fronobulax

Developer
Staff member
I feel like Steam has hijacked something. It hasn't done so on my system so I am at a loss.

I don't see any way to associate a default directory with a file association. You're not using a shortcut so that doesn't seem to be it. There are reports that Java sometimes resolves a "home" directory based upon how it is launched but sometimes derives it from other information.

I'd be curious about two things. Can you display and post the SYSTEM and USER environment variables? It is a very long shot but if Steam has mangled something it might be visible there. Second, if Steam, or a Steam app has bundled Java then running KoLmafia might be picking up some residue.

"where java" in a command line might provide some insight.

C:\Users\frono>where java
C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
C:\Program Files\Java\jdk-17.0.4.1\bin\java.exe

C:\Users\frono>

A global search for the file "java.exe" might also provide some hints as to where to look next.

I know when I was supporting a Java based desktop program, we finally had to bundle our code with its own JRE because that turned out to be more reliable than hoping the user installed Java correctly and/or the way we expected it. But bundling was not trivial and it took us a while to set up and configure our program in a way that did not effect any of the user's settings or other Java programs. I can easily believe someone packaging a Java app for Steam could make similar mistakes and has not fixed them yet.
 

VladYvhuce

Member
I ran into this problem. When I opened Mafia last night, it had forgotten my username, password, alternate color scheme, and who knows what else. I did not log in, and instead shut it down and went looking for duplicate java.exe files as suggested. And yes, Steam had decided within the past 2 of days to fully install its own Java into a game called Project Zomboid (This is a game that some friends sometimes play, but I've never actually played myself).

Solution: I uninstalled Project Zomboid and made sure the files from that game were removed from its folder, and Mafia mostly restored itself when relaunched. It kept things like my list of moods and custom combat scripts, and the overall appearance. But most other preferences, I'm having to manually reconfigure (including telling it to run the moods, ccs). It also forgot all of my choice adventures preferences.
 
Last edited:

fronobulax

Developer
Staff member
I ran into this problem. And yes, Steam had decided within the past couple of days to fully install its own Java into a game called Project Zomboid.

Thank you. Did you have any problems with KoLmafia?

I guess most of my questions about system environment become slightly more important since Steam failing to isolate its JRE from the system is a bit more specific as a hypothesis.
 

VladYvhuce

Member
Thank you. Did you have any problems with KoLmafia?

I guess most of my questions about system environment become slightly more important since Steam failing to isolate its JRE from the system is a bit more specific as a hypothesis.
Edited the post to have more info when you were posting, apparently. I hope the new info is more helpful.
 

datavortex

New member
Having this same problem. Version 27726. Windows 11 Pro 23H2. Oracle Java and OpenJDK both installed. Same results with either one when launched via clicking on the jar file. Command line is an effective workaround.

Interesting User:
Code:
JAVA_HOME=C:\Program Files\Java\jdk-12.0.2
Path=%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

JAVA_HOME is the same for System. Interesting is:
Code:
Path=C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Program Files (x86)\Razer\ChromaBroadcast\bin;C:\Program Files\Razer\ChromaBroadcast\bin;C:\Program Files\Eclipse Adoptium\jdk-17.0.7.7-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet\;C:\Users\datav\AppData\Local\Microsoft\WindowsApps;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Calibre2\

Nothing in there from Steam, which is installed along with a handful of games, not the one above. I did find a JRE in 3DMark there.
 

fronobulax

Developer
Staff member
Interesting User:
Code:
JAVA_HOME=C:\Program Files\Java\jdk-12.0.2
Path=%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

I am a touch concerned because JAVA_HOME should point to v17 or higher in order for KoLmafia to work.

But there are many ways to run Java programs and not all of them use the value of JAVA_HOME. Indeed some conventions use JAVA_HOME for development options such as compiling or debugging code (so it points to a Java Development Kit) and use the PATH or other system defaults to find the Java Runtime Environment to run programs.

My USER environment has JAVA_HOME C:\Program Files\Java\jdk-17.0.4.1 and %JAVA_HOME%\bin on the PATH so I am probably bypassing anything set for C:\Program Files\Common Files\Oracle\Java\javapath.

I need to do some digging to see what C:\Program Files\Common Files\Oracle\Java\javapath has for defaults and the like.
 

datavortex

New member
FWIW, this is what I get when running the default on the command line:

Code:
PS C:\Users\datav> java --version
java 21.0.1 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)

PS C:\Users\datav> & 'C:\Program Files\Common Files\Oracle\Java\javapath\java.exe' --version
java 21.0.1 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 21.0.1+12-LTS-29)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.1+12-LTS-29, mixed mode, sharing)

So I don't think JAVA_HOME is being used from CLI.
 
Top