Java 7

This is probably a really dumb question, but I thought I would ask rather than risking messing my current configuration up.



My question is simple, should JME3 work under the Java 7 framework or should I expect to experience bugs with it?



Thanks

Java 7 is supposed to be backwards compatible so yeah jME3 should work correctly

No it doesn’t

i wouldn’t advise using java 7 until its public release. I made a program in it, but no one could run it unless they went to the dev page and explicitly downloaded it, which no one wanted to do.

Wezrule, as of the time of the OP, Java 7 IS officially released.



Unfortunately there is a very serious loop optimizer bug in Hotspot with the current release, it’s recommended you not use Java 7 or at least be sure to turn off loop optimizations if you do:



http://www.lucidimagination.com/search/document/1a0d3986e48a9348/warning_index_corruption_and_crashes_in_apache_lucene_core_apache_solr_with_java_7

oh right hmm, I still see Version 6 Update 26 when I go to the general public download page.

Yeah I haven’t seen that page update yet but the SDK is an official release[1], and OpenJDK has official releases[2] now as well. It’s probably still smart for most people to stay on Java 6 as it’s proven and stable, but JME should ensure that it works under Java 7 now. I’ve heard many reports of better performance due to a much improved memory model, and unrelated to JME directly, this is the first official release of Java with the invokedynamic bytecode. If you follow JVM languages like JRuby you’ll understand why this is so important.



[1] http://www.oracle.com/technetwork/java/javase/downloads/index.html

[2] http://code.google.com/p/openjdk-osx-build/downloads/list

ah kk, thanks for the info, much appreciated. I think I will stick with Java 6 for the meantime. But there are a few things I liked about java 7 when I did use it, such as being as able to use strings in switch statements, and an efficient Watcher class to check for file changes in a directory. So I am still excited :]

Effectively its just easier to write code with the new switch statements etc. The compiler will always make it very efficient code, no matter if you use a series of if statements or a switch. Actually in jMP (and NetBeans) you can easily convert code using if/else to the new string switch with the click of a button when you use Java7. But again, Java7 is not yet 100% compatible to jme3 atm (yes, that way round ;))

I’m still rather new to JME so this is just curiosity talking, but what parts of JME don’t currently work under Java 7? It’s supposed to be fully backwards compatible, but we all know how well that can work.

Thanks for all the input guys. Supposedly there is some Fork/Join functionality for concurrency which looks promising, which is why I ask.

There are reports of Java 7 breaking LWJGL.

Do not use Java 7 with jME3 until further notice …

Hello,



Is JME working with Java 7 Update 2 ?

I heard the loop bug in HotSpot has been fixed.

Any feedback about it ?



Thank you :slight_smile:

Works fine, but I see no feelable performance difference to the 6 one.

From what I read, it averages to be about 15% faster than Java 6 thanks to a new garbage collector, and a better management of Arrays outbound checks (double speed!). I use a lots of Arrays in my game to manage de world’s data, I wouldn’t mind some speed improvment if JME works on Java 7. :slight_smile:



The new garbage collector is apparently doing a better job with applications creating and destroying a lots of objects. Firstly, it works in a separate thread to avoid performance hickups. Secondly, it doesn’t rely on only two realms (young and old variables) : it creates new realms as needed and compacts memory when required, freeing whole realms of memory if not needed anymore (something Java 6 never does).



I know you had to optimize objects creations in JME, I suppose it won’t be much of a problem in Java 7 anymore. :slight_smile:

@normen said:
Effectively its just easier to write code with the new switch statements etc. The compiler will always make it very efficient code, no matter if you use a series of if statements or a switch.

Actually, Oracle states otherwise:
The switch statement compares the String object in its expression with the expressions associated with each case label as if it were using the String.equals method; consequently, the comparison of String objects in switch statements is case sensitive. The Java compiler generates generally more efficient bytecode from switch statements that use String objects than from chained if-then-else statements.

cf. http://docs.oracle.com/javase/7/docs/technotes/guides/language/strings-switch.html

Other then that, jME works fine with Java 7, i'm using Java 7 with jME for quite a while now.

Yes, you are right, but in both versions java creates “very efficient code”, that much I was right :wink: What i generally meant is that apparent “optimizations” that you can do in code are mostly not really optimizations. And the difference in a switch vs if statements will probably make up 0.0000000001% of your applications overhead :wink:

Optimization wise, Java 7 makes a huge difference with programs using Arrays intensively. Then there’s a small gain from the improved Garbage Collector. That’s about it.



Most of the other modifications are for productivity and code readability. Switches on Strings are a tool to make code easier to write and to read. Not to make it faster to execute.



Anyway, let’s go Java 7 now, if it works ! o/

Thank you for your answers.

@normen said:
Yes, you are right, but in both versions java creates "very efficient code", that much I was right ;) What i generally meant is that apparent "optimizations" that you can do in code are mostly not really optimizations. And the difference in a switch vs if statements will probably make up 0.0000000001% of your applications overhead ;)

Well, lets say it's not worth going through your old code and convert your if-then-else to switch-case, but you might consider using it for future code.


If it's easier to read depends imho on your own code structure. If you use many single-line statements and don't need the braces for if-then-else, then if-then-else actually can be as good to read as switch-case.


Nonetheless, i like it ;) Switching on strings was something a long wanted in java :D


Does jME officially require Java 7 now? Meaning contributions to jME can (and maybe should) use Java 7 language features?
@Tr3kk3r said:
Does jME officially require Java 7 now? Meaning contributions to jME can (and maybe should) use Java 7 language features?

No, all JME code is java 5 compliant. no java6 nor java7 specificity