Framerate cut in half when running by clicking jar vs command line or netbeans

The framerate on my game drops from 16-19 to 10 when I run it from a jar by double-clicking. Running it from the same jar by command prompt or from the project itself in the IDE gives me the higher framerate.

I’m using LWJGL, but I’ve found posts about this problem both elsewhere and here by people not using OpenGL. No solutions that I noticed though.

Any ideas?

It could be that Netbeans is taking up resources. I realize that is a very common trait on older computers and laptops. Netbeans isn’t always a memory hog, but it totally depends on how it is configured.

Which JVM are jars associated with? You’re not accidentally using an old JVM when double clicking, are you? There have been some noticeable performance increases between the major versions.

Cas :slight_smile:

“It could be that Netbeans is taking up resources.”
What? That doesnt make sense.Why blame the IDE? I use netbeans and that never happened.Plus, if it was netbeans, it would have to be running.

goblinJoel,if you are using netbeans make a profile analysis , post screenshots if you dont understand it.

Careful. I am pretty aware of the profiler of Netbeans and its capabilities. Post solutions to the problem, and don’t dab too closely into the flames. Attack the argument, not the person. You’ll be highly respected that way.

? What!?
I just said that its not the Ide’s fault. Also, i meant for goblinJoel to check profiler, not you.And i did post the solutions.

God Bless.

If you have both 64 and 32 bit version of java installed, it’s possible that the OS will use 32 bit jvm for running jar that are opened by double click, and 64 bit jvm for running everything else. The 64 bit jvm is considerably faster than the 32 bit jvm at the cost of longer start up time and more memory consumption.

Looks like you guys are probably right!

If I search “java” in the start menu, it quickly comes up with Configure Java, About Java, and java.exe. If I open Configure Java, I’m seeing that I have Java 1.7.0_45 listed first in the User tab, with 1.6.0_31 second, and both are enabled. The System tab just has 1.7. All are located in Program Files (x86). So it looks like Windows is set up to use 32bit JREs.

If I instead open About Java, it tells me 1.7.0_45-b18. Presumably the same JRE that is listed first in Configure Java.

However, in control panel (Win7) -> Java, it lists only 1.6.0_26 in both User and System tabs, located in Program Files. So, that would indicate Windows is set up to use a 64bit Java 1.6 JRE.

In Control Panel -> Programs and Features, it looks like I have the following installed:
Java 7 Update 45
Java 6 Update 26 (64bit)
Java 6 Update 31
Java SE Dev Kit 6 Update 26 (64-bit)
Java SE Dev Kit 7 (64bit)

The NetBeans project is set to use JDK 1.6 as the platform. Under Tools -> Java Platforms, I have JDK 1.6.0_26 as the default, followed by JDK 1.7.0. I did pick 1.6 intentionally, because I assumed developing for Java 6 would have a broader install base than Java 7, and it would let me get a better idea of how it would run on less up-to-date systems even if that wasn’t true. I don’t know if that’s really the case.

If I check java -version in command prompt, I see:
java version “1.6.0_26”
Java™ SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot™ 64-Bit Server VM (build 20,1-b02, mixed mode)

I guess what’s going on is that command prompt and NetBeans are set to use 64bit Java 6, while double-clicking jars is set to use 32bit Java 7. Does that look like the case to you guys?

…how do I straighten Windows out? It has two separate Java Control Panels, one accessible from Windows Control Panel (the 64bit Java 6), one accessible from the start menu (the 32bit Java 7 and Java 6).

And what should I expect users to have if it’s this messy on mine?! Thanks for your help in at least steering me in the right direction so far.

Well firstly just get rid of Java 6 because it’s kinda ancient.

Cas :slight_smile:

Haha, thanks for the advice.

Hm… well, I’m a little blurry on how forwards compatibility works in Java. If I wrote something in Java 7, and someone had Java 6, would it always work, sometimes work depending on the features I used, or never work? (Or maybe I could bypass the whole issue by distributing the right JRE with the game… I think I’ve heard you can do that.)

If there’s no reason to use Java 6, then I might as well follow your advice.

As a side note, it’s my personal irrational goal to make sure the game can run on my netbook, which, despite coming with Windows 7 Starter, for some reason only supports OpenGL 1.4. Even though it was made in 2009. So I guess I have a lot of sympathy for people on old machines that just want to play a game that doesn’t really look like it should need a new machine.

If you wrote something in Java 7 it can be post-processed to make it work with Java 6 sometimes. However you are right in thinking that what you should be doing is distributing a JRE with the game itself; OpenJDK on MacOS (10.7+) and Linux, and the Oracle JRE for Windows.

There’s a slim chance there’s some newer video drivers for your laptop; OpenGL 1.4 is proper ancient.

Cas :slight_smile:

Thanks, Cas!

I’ll have to remember that about distributing the JRE with the game. I’m guessing a bit of searching will reveal some solutions or at least instructions for the best ways to do that.

Unfortunately, I’m pretty sure my netbook’s video drivers are as up to date as I can get them. Intel 945GM does not appear to be the hottest thing around. Which brings up the related question of how to use OpenGL extensions with LWJGL, but I’ll search around a bit more before starting a thread about that. (Unless you already have a link handy. :stuck_out_tongue: )

Btw, I think it’s cool that you frequent these forums. I loved Revenge of the Titans (despite not being able to tell what upgrades would do ahead of time), and I can’t help but wonder how you find/steal time to answer newbie questions.

It uses Microsoft GDI renderer, a kind of OpenGL emulation through Direct3D. You’re lucky as lots of older laptops only get a driver supporting OpenGL 1.1, things could be worse. Maybe you need to use “allowSoftwareOpenGL=true”, I’m not the best person to speak about LWJGL.

'tis true, I’ve just checked; The 945GM only has hardware support for OpenGL 1.4 :S … I’d accidentally spill a cup of coffee on that laptop.

Cas :slight_smile:

Lol.

It feels inappropriate to reply just to say that. This forum feels too official. Maybe something’s wrong with me.

Indeed, you aren’t allowed to just say LOL :wink: Try it. Actually ignore me, I thought there was a minimum post size restriction on JGO but it was a different forum I was thinking of.

Cas :slight_smile: