What are the pitfalls when upgrading to Java 7 - java

I am switching an enterprise application built on Spring 3.1.0, Hibernate 3.6.0 from Java 6 32bit to Java 7 64 bit.
Has anybody done that? Any problems? Are there any resources on the subject?

Here are the pitfalls I know about:
You might have to upgrade your IDE to be able to enable Java 7 features.
Make sure that command line tools and your IDE use the same Java version. If you're using Maven, for example, look into $HOME/.mavenrc and/or check the environment variable JAVA_HOME
Check the source/target options of the Java compiler.
Java 7 supports generics better than Java 6 so some code will now compile that failed with Java 6
The 64bit version of Java uses a lot more memory than the 32bit version
The first release of Java 7 had a severe bug in the JIT compiler which broke Lucene. Use at least b2 or better.

Java 7 uses the newer JAXB 2.2 instead of 2.1 (the full change on the XML stack is described here). These versions are not compatible on generated code for Boolean getters and setters!

Related

Is Java 8 forward compatible with Java 11?

I'm migrating multiple projects from Java 8 to Java 11 and I was wondering if Java 8 is forward compatible with Java 11.
In other words, is it possible to use artifacts compiled against Java 11 in Java 8 projects?
No, you cannot execute Java 11 bytecode on an older (any older) JVM. This has always been the case. Each new major compiler release has a new bytecode format that won't execute on older runtimes.
You CAN however execute bytecode from an older version on a newer JVM, so executing Java 8 bytecode on a Java 11 runtime is quite possible and you can thus use Java 8 (or older) compiled libraries in Java 11 projects, if the dependency requirements are met.
Do however keep in mind that Java 9+ removed a number of packages from the core libraries that were in there with Java 8, so you may need to supply new dependencies from third parties to replace those. Most notable of those (but certainly not the only ones) are XML parsers.
You can run projects that were compiled for Java 8 in Java 11 runtime.
You can run projects that were compiled for Java 11 in Java 8 runtime if you properly set the --target during compilation to target JDK 8 or less. This will of course also limit the set of features supported in the source code.
Generally, earlier versions of JDK are supported on later runtimes (i.e. Java 11 should run on Java 17), but there are some caveats because some of the features might get deprecated or changed. Always read the release notes and test before you upgrade.

How to run Java in compatibility mode?

Does Java support running in compatibility mode? In other words if we have JDK 8 install on system, can it be configured to run my application on 7 or previous release using the same installation ?
I can give one example like IE-11 can be switch to run as IE 8, 9, or 10 based on the compatibility option.
I agree with the comment of Kayaman.
There are 2 types of incompatibilities that could occur: bytecode changes (some feature supported in 8 and not in 7 - new Java versions tend to be upward compatible - so 8 will be able to run all 7-targeted code) and library changes which is more problematic.
If you have compiled with Java 8 targeting 7+, your bytecode will be compatible with Java 7 JVM, but you have no guarantee that it will run with Java 7 libraries.
Your best bet is then to compile and run with Java 7 - and it will (most probably) run with Java 8.
Then there are other changes that may impact your application (GC performance for instance).

Sonar broken after installing python plugin: The plugin python is not supported with Java 1.6.0_29

I am using windows and installing the python 1.5 plugin from
http://docs.sonarqube.org/display/PLUG/Python+Plugin
Sonar breaks after I install this, the java version that is needed is not even specified. Are there any workarounds for this?
According to http://docs.sonarqube.org/display/SONAR/Requirements, Sonar is not supported on Java 6 anymore.
Are there any workarounds for this?
Upgrade your Sonar platform to a more recent version of Java. Preferably Java 8, because Java 7 has been EOL'd by Oracle. (You could get away with using Java 7 if your Sonar platform is behind a firewall, but running a Java 7 based service with publicly facing web access is risky.)
SonarQube and the latest versions of the plugins all requires java 7 see requirements : http://docs.sonarqube.org/display/SONAR/Requirements
No workaround, java 6 is no more supported, so please use at least java 7 (moreover, java 8 is recommended as Java 6 and 7 are now not supported anymore)

Cann't write java 8 code at eclipse?

I installed java 8 on Lubuntu 13.10. It is pre release but it should work - JDK™ 8 Early Access Releases.
I added JDk to eclipse:
And tried wrote first java 8 version code.
This code should find the longest word.
I caught a bunch of exceptions:
for 12 line - it shows:
Multiple markers at this line
- Syntax error, parameterized types are only available if source level is 1.5 or
greater
- Resource specification not allowed here for source level below 1.7
Why does this exactly happen?
How to solve this trouble?
Eclipse JDT environment -- editors and tools -- only supports Java Syntax up to 1.7. As of today, Java 1.8 support is only available in early access releases.
Adding a JDK or JRE to Eclipse does no change the characteristics of the JDT environment, which is a highly-integrated set of tools. So, until Eclipse releases Java 1.8 support and that makes its way into your distribution, you will not be able to use the Java editor for any syntax that is unique to Java 1.8.

Trouble in installing j2se 1.4 or higher

I have a intel core i3 (not the 2nd generation i3) processor and windows 7 64 bit OS.
Which j2se 1.4 should i install from http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase14-419411.html#j2sdk-1.4.2_30-sol-JPR this website
There's Windows versions available of update 19 here: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase14-419411.html#j2sdk-1.4.2_19-oth-JPR
They were never designed to work on Windows 7 though, let alone 64 bit - so I can't guarantee they'll work (and if they don't then Oracle won't do anything to try to make them work because of the age!)
I'd also seriously question your motive for requiring 1.4, and recommend you migrate to a current, supported version of the JDK. If nothing else remember there's no security updates, so any exploits that are found won't be patched.
You shouldn't be installing JDK 1.4 at all - it's well past its supported life.
I took a peek at the link you provided. It looks to me like Oracle will only make older versions of the JDK available for Solaris. I doubt that there was ever a version that ran on that version of Windows. Why port it now?
You're out of luck.
I'd recommend an upgrade to JDK 6 or higher. JDK 7 is the latest standard. You should be keeping up with your JDK, just as you are with your operating system.
You can download a 32-bit version of Java from http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase14-419411.html
I use such a 32-bit Java on a regular basis under Windows 7 64-bit directly from the command line.
That said, newer versions of Java perform better and you should only use Java 1.4 if you need to support it or have software that explicitly requre Java 1.4.
The latest version of Java 7 supports 64-bit and is tested under Windows 7.

Categories

Resources