regarding Java 7

fronobulax

Developer
Staff member
Is it possible (within KolMafia) to specify that a particular version of Java be used ? Just wondering, as at work we have various applications which use Java, and some can specify which version they want, whilst others just use the newest that is on the PC. Currently they have four java versions, which coexist happily (well, apart from the Java control panel, which only serves the most recent version), allowing a PC to have a recent Java whilst some older apps get to use an older version (1.4.2_02 is the oldest I think).

I'm uncertain how tricky (or possible) it would be to code, but might allow people to have Java 5 for KolMafia, whilst having Java 7 for general web use.

Generally your operating system determines which version of Java gets used. So if you want to force 1.5 for KoLmafia you should do so in a batch file or the equivalent for your system. mafia could detect the version being run and I poked at code that would do so, but the question is what do you do next? If someone chooses to run mafia with java 7, besides suggesting that they shouldn't, what else is to be done?
 

Darzil

Developer
Generally your operating system determines which version of Java gets used. So if you want to force 1.5 for KoLmafia you should do so in a batch file or the equivalent for your system. mafia could detect the version being run and I poked at code that would do so, but the question is what do you do next? If someone chooses to run mafia with java 7, besides suggesting that they shouldn't, what else is to be done?

Interesting. Maybe it's a web thing or something. Certainly on the same PC, if I start up Sage web client, it uses the latest version of Java on a work PC. If I start up Kronos web client, it uses a specified older version (though if Sage is already loaded it starts another web browser session for the second Java version), with no local configuration needed (other than having the Java versions present).
 
Interesting. Maybe it's a web thing or something. Certainly on the same PC, if I start up Sage web client, it uses the latest version of Java on a work PC. If I start up Kronos web client, it uses a specified older version (though if Sage is already loaded it starts another web browser session for the second Java version), with no local configuration needed (other than having the Java versions present).
That's the web. Java applets can recommend a specific Java version, which Java applications cannot. Mind you, the web browser / agent doesn't have to listen.
 

holatuwol

Developer
You could also embed a JRE into the application, which forces it to use that JRE version, but that would have to be a custom build.
 
If you're on Windows, it should be possible to make batch files that look somehow like

"C:\Program Files\Java\j2re1.2.3_04\bin\javaw.exe" -jar "C:\path\to\kolmafia.jar"
which then, when launched, will use the version of java found in the specified path to launch KoLmafia.
 
If you're on Windows, it should be possible to make batch files that look somehow like
Code:
"C:\Program Files\Java\j2re1.2.3_04\bin\javaw.exe" -jar "C:\path\to\kolmafia.jar"
which then, when launched, will use the version of java found in the specified path to launch KoLmafia.
Yes, that approach will definitely work. You can do exactly the same thing on Linux/UNIX and Mac OS X with shell scripts:

Linux version:
Code:
/usr/lib/jvm/jre1.2.3_04/bin/java -jar /path/to/KoLmafia.jar

Mac OS X version (Apple JDK):
Code:
/System/Library/Frameworks/JavaVM.framework/Versions/1.3/Home/bin/java -jar /path/to/KoLmafia.jar

Mac OS X version (Oracle JDK):
Code:
/Library/Java/JavaVirtualMachines/jdk1.7.0_04.jdk/Contents/Home/bin/java -jar /path/to/KoLmafia.jar

NOTE: For Mac OS X (both cases) I used the earliest known stable version, since JDK 1.2 was distributed only for Mac OS 9 and earlier.
 

xKiv

Active member
You can theoretically have a two-stage jar which, when invoked without a certain parameter, "discovers" installed versions of java, picks one and uses it to invoke self with that magical parameter.
But I think stand-alone launcher mini-apps (this includes .bat files with hard-wired path to the desired version) are the de-facto standard for that.
 

discdeath

New member
I've been having problems with freezing and massive lagging, and from reading this it would seem that it's due to Java 7. However, I've tried backdating to Java 6; and when I do Mafia refuses to open, instead showing an error message saying that Java 7 is missing. Any thoughts?
 
I've been having problems with freezing and massive lagging, and from reading this it would seem that it's due to Java 7. However, I've tried backdating to Java 6; and when I do Mafia refuses to open, instead showing an error message saying that Java 7 is missing. Any thoughts?
What operating system (OS) are you running?
 

roippi

Developer
With the release of 16.0, I'm going to optimistically un-sticky this. We need to transition to fully supporting 1.7 eventually.

If you know of things that work under Java 6 but do not work under Java 7, please bug report them. If you are experiencing "crashing", "freezing", "excessive lag", or what-have-you under Java 7, check if you experience it under Java 6 before you bug report it, since that is going to be our immediate followup question.
 

Theraze

Active member
We had that bug reported this past week about someone using beta 1.7 and having issues that release 1.7 wasn't having... do we need a new sticky post regarding not supporting non-release versions of Java, since we're no longer having the official "use 1.6" recommendation?
 
We had that bug reported this past week about someone using beta 1.7 and having issues that release 1.7 wasn't having... do we need a new sticky post regarding not supporting non-release versions of Java, since we're no longer having the official "use 1.6" recommendation?
7u21-b11 is NOT a beta. b11 here means "build 11" - in reference to that other thread.
 

Theraze

Active member
So what you're saying is that release Java 1.7.21 has issues, and we need to put back this warning against using Java 1.7? Since 1.7.21 is the current version of Java available from the site when I checked just now...
 
So what you're saying is that release Java 1.7.21 has issues, and we need to put back this warning against using Java 1.7? Since 1.7.21 is the current version of Java available from the site when I checked just now...
No. We don't need to reference that other thread if we post a warning about betas. I have no issues at all with Java 7 on OSX 10.8.3 :D
 

Veracity

Developer
Staff member
With the release of 16.0, I'm going to optimistically un-sticky this. We need to transition to fully supporting 1.7 eventually.

If you know of things that work under Java 6 but do not work under Java 7, please bug report them. If you are experiencing "crashing", "freezing", "excessive lag", or what-have-you under Java 7, check if you experience it under Java 6 before you bug report it, since that is going to be our immediate followup question.
For the record, I just upgraded to OSX 10.9.1 and had to reinstall Java - and I now have ONLY a Java 7 JDK. It was a pain in the rear to figure out how to get ant installed again, but having done that, things seem to be OK. I have the following observations:

- It is slower by a factor of 2 to build KoLmafia.jar
- Popping up dialogs seems slower: if I select a bunch of items in the Item Manager and say "autosell", it pops up a dialog for each in succession to ask "how many", and that feels a lot slower than before.
- Automating a bunch of turns through the GUI seems really zippy.

But, no errors in operation, that I can see. Just a subjective "slowness" compared to 1.6 - which is not something we can likely do anything about in KoLmafia itself.
 
For the record, I just upgraded to OSX 10.9.1 and had to reinstall Java - and I now have ONLY a Java 7 JDK. It was a pain in the rear to figure out how to get ant installed again, but having done that, things seem to be OK. I have the following observations:

- It is slower by a factor of 2 to build KoLmafia.jar
- Popping up dialogs seems slower: if I select a bunch of items in the Item Manager and say "autosell", it pops up a dialog for each in succession to ask "how many", and that feels a lot slower than before.
- Automating a bunch of turns through the GUI seems really zippy.

But, no errors in operation, that I can see. Just a subjective "slowness" compared to 1.6 - which is not something we can likely do anything about in KoLmafia itself.
I concur with the "No errors in operation" remarks... shame that it took this long; Java SE 8 is due out in a little over a month (March 18, 2014).
 

Theraze

Active member
Java 9 hit GA at some point recently and mafia users are starting to post issues while casually noting they're running JRE9.
JDK9 can't compile, since its oldest target is 1.6, not 1.5, our current target.
I'm not certain whether or not JRE9 runs things properly or if it has issues. As the JDK won't compile, I wouldn't feel confident that the JRE would be flawless.

Do we still want to maintain back compat with 1.5, or can this be bumped to 1.6 or even higher?
Or do we just tell people to avoid JDK9 and maybe JRE9?

Posting this here because it was from when the target was most recently bumped from 1.4 to 1.5 several years ago...
 

Darzil

Developer
Good question. I don't understand enough to answer, but am hoping JRE9 will let me have a usable mafia on my very high res laptop once supported !
 

lostcalpolydude

Developer
Staff member
What's the lowest version of Java that can connect to sourceforge, given their switch to https? Not supporting Java versions that are too old for that task seems reasonable.
 
Top