Bug - Fixed Java 7 problem with system tray icon

BleedingFingers

New member
I get an error when trying to use the daily build JAR file with 64 bit Java JDK. I've just moved PC's from Windows XP to Windows 7. Do I need to use the 32 bit version of the JRE, or is there a way to get KolMafia to run under 64 bit?

I've tried searching on the forums for this but there don't seem to be any posts about 64 bit java (JDK or JRE).
 

BleedingFingers

New member
I've just got it working... Seems to be the Tray Icon. When I was trying to use "javaw" then the message I got was "Could not create virtual machine". When I used "java" then I got the following exception...

Exception in thread "main" java.lang.UnsatisfiedLinkError: H:\KoL\images\TrayIco
n12.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1807)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1703)
at java.lang.Runtime.load0(Runtime.java:770)
at java.lang.System.load(System.java:1003)
at net.sourceforge.kolmafia.swingui.SystemTrayFrame.addTrayIcon(SystemTr
ayFrame.java:82)
at net.sourceforge.kolmafia.KoLmafia.main(KoLmafia.java:444)

Edit the GLOBAL_prefs.txt file and set useSystemTrayIcon to false and now it loads.

Why is Minimise to System Tray 32 bit only?
 

fronobulax

Developer
Staff member
AFAIK, I have been running 64 bit Java for over a year now with no problems on Windows 7.

Code:
C:\KoLmafia\dist>java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

C:\KoLmafia\dist>java -jar KoLmafia-10023.jar

I might suggest your problem is with Java 7 which has been known to have some problems with KoLmafia and it is not clear that they all have been resolved.
 

Bale

Minion
I'm moving this to Bug Reports so it can be looked at appropriately by Hola.

I'm also changing the thread title to something appropriate to what was revealed in the 2nd post.
 

holatuwol

Developer
Why is Minimise to System Tray 32 bit only?
Well, KoLmafia uses a third-party library that comes with a 32-bit DLL, so I'm guessing Java 7 does some additional checking before loading DLLs that it thinks won't work. Sadly, there isn't a solution to that short of finding another third-party library that provides equivalent functionality, or somehow detecting that you're using Java 7 and using the native tray icon functionality that it ships with via some fancy reflection (kind of like the way we add a menu bar in OSX).

I'm not particularly motivated to add tray icons to 64-bit Java 7 at this time (particularly since I don't have a machine running 64-bit Windows). So, I've added a try-catch around the attempt to load the library so that, even if you lose tray icon functionality, KoLmafia will still start up properly.
 
Top