Upgrade java applications from old to a newest version - java

I have a doubt about java upgrading
I have applications running in java 6, for example.
And I wanto to upgrade my java to a 7 or 8
My doubt is: What is the best way to upgrade mi current java version?
Or how can I do it?
This applications currently are productive, so this means I has to upgrade the java version witouth affectate it.
I'm very confused about this, hope you can help me

There's only one way to do it:
Upgrade the JVM
Recompile the code and fix any errors that the JVM complains about.
Regression test the code running under the new JVM and make sure the functionality is unchanged.
Take the opportunity to see if there are any advantages to adding new features (e.g. java.time package, lambdas, java.util.function package, etc.)
No one should be running on any JVM other than 8 or 9. JDKs older than 8 have passed the end of their support lives. They are not getting any more security patches.
You are making the excuse that everyone tries when faced with currency issues: "The code is working fine. Why change it?"
Unfortunately there's a price to falling behind.
I'd advise you to upgrade as soon as possible. Stop the excuses.
JDK 9 is the current version. Current or current-1 is usually acceptable; current-3 is not.

Related

Is it possible not to upgrade to JDK 9 when this gets available?

Once the JDK9 is Generally available can we continuously blocked the upgrade?
IF yes until when?
Currently we have an application using java pluggins, we are still working on the equivalent web application. As per news the target date for the JDK9 is March 23.
If by March 23 we are still not done can we block the JDK9 upgrade?
You can still download and install Java 5, if you really want. Nothing will compel you to upgrade to Java 9, however Oracle will eventually end support for Java 8, at which point you'll stop getting security updates. The last public release of Java 7 was almost two years ago, for example. Any improvements to the JVM or JDK since then are only available in Java 8.
Even if you don't care about security(?!?!?) the correctness of your application will also start to falter - JDK releases contain updated timezone information, among other data that changes over time.
In general, it's going to be a lot better for you to work to solve your problem a different way that's future compatible, than to stick to legacy features that are no longer supported.

Steps to Migrate Code from Java 6 to Java 7 using eclipse

I have the existing codebase which runs on java6, but the current requirement is to upgrade the Java from java6 to java 7, Can anyone please let me know the steps, how can i upgrade it using eclipse(because i am using eclipse as IDE)?.
Upgrading code requires almost nothing, as Java 7 is backwards compatible with Java 6 except for a few things, mostly behavioral and in the standard library. And as said here, it should mostly just work:
What do I need to do?
Option 1 – “Just run”
Upgrading your eclipse project has been asked and answered several times, like here.

Should I keep compiling against older versions of Java?

Since the release of Java 8, I found myself slowly becoming dependent on Java 8-specific features (ex. lambda statements) on a library project that I have just started.
I have seen many other projects which, to this day, still build against Java 7, or even Java 6, causing me to second-guess myself.
Is it a good idea to immediately start building against the newest version of Java, or should I still use older versions?
Note that unlike those other projects that have started back when Java 6/7 was the newest version, mine was started recently when Java 8 is the newest.
There are two reasons I can think of that would require staying with a pre-Java 8 JVM:
You are writing a library that is being used by a large group of people outside your organization who are still stuck on a pre-Java 8 JVM. If you use the latest and greatest JVM, they won't be able to use your product anymore.
You are dependent on a 3rd party library that has not upgraded to Java 8 and breaks on Java 8.
Since you mentioned this is a new project, #1 is unlikely. Even if you plan on having external users, if it's a new project, requiring the latest version of the JVM isn't really an issue.
Number 2 is also getting more and more unlikely as the more popular 3rd party libraries have released updates to work on Java 8. Even the few stragglers are usually OK working on Java 8. For example I use an ancient version of hibernate with Java 8. I just don't use any Java 8 features in any mapped fields/entities.
Java 8 denotes a major change to the language since Java 5 (or perhaps its inception). If you are targeting specifically the changed language parts (which I guess you claim) then making it usable only by Java 8+ runtime makes sense.
When Java 5 occurred 10 years ago and you wanted to use all the new features introduced at the time (e.g. foreach statement, Enums etc.) into your own library development, what would you have done? I believe you would have made your library require Java 5 at the minimum. If you agree with that, then that (sound) logic applies consistently to your present situation as well.
For server side application, possibly a version or two prior to the current version as suggested by EJP.
On the client side however, I don't see any point in trying to support older Java versions. The JRE has been auto-updating since at least Java 6. It has gotten to the point where Java Web Start launched applications cannot specify an earlier than current JRE. Or rather, it can specify any JRE it chooses in the launch file, but that will be ignored in favor of the latest version installed on the user's computer.

Tomcat upgradation

We are planning to upgrade our Tomcat from 4.1.31.
Our's is an Axis 1.4 application where we have our web services.
Request you to suggest the latest stable version of Tomcat 5 or Tomcat 6 suitable for our application. And the things to consider while upgrading.
Will the existing 1.4 Java code base works smoothly on Tomcat 5 or 6?
And going further we may write the code in JDK 1.5 as well. So, having Java 1.4 code and Java 1.5 code together, will create any problems?
Kindly suggest.
Please share your upgradation experiences.
Thank You :)
Tomcat 6.0.26 is the latest stable release.
It requires JRE 5.0 or later, so if you are truly stuck on 1.4, you'll need to download the latest 5.5 release, which requires a compatability package to run on 1.4.
My advice: bite the bullet and make the necessary changes for your application to function on 1.6. It is only going to get more and more painful to upgrade (and to continue to code in 1.4) as time goes on.
Go to Java (1.)6; it really makes doing web services like yours easier and it's really widely available now.
If you are going to upgrade I would recommend first doing some tests with java 6 + the existing codebases. If that seems to work, go to Tomcat 6.
Perhaps also upgrade some Axis libraries while you're at it, or leave it as is if it still works.
In my experience you can get to trouble by migrating to Java 5 (and thus 6), especially with XML. My memory has something like a class name clash between Java 5 and an old version of Xerces, but I could be mistaken.

Java source upgrade from 1.4.2 to 1.6.0_10 recommended ? (skipping 1.5)

Our desktop-only product at work has been using JDK 1.4.2 until now (also 1.4.2 JRE shipped with product). I am trying to convince the management to let us upgrade to a newer version in order to get the performance, API/features and developer comfort benefits.
Since 1.5 has reached EOL transition, I'm I thinking of the upgrade to 1.6.0_10 directly (update 10 chosen as it is a major one).
In terms of code, all compile errors are just variable names called enum which I have renamed and the product works fine.
The question is
Whether this upgrade is recommended/fine i.e. skipping 1.5 ? are there any catches
If yes then should I upgrade to 1.6u10 or the latest 1.6 available ?
Thanks
I would say if you are going to do the upgrade then go for whatever the latest update is. You may actually get some free performance gains going with 1.6, I know some JVM improvements have been made since 1.4.
In general, Java is fairly good in being backwards compatible.
In case there is a need to find out what has changed in the Java platform from 1.4 to 6, the following is a list of changes that Sun has listed for each release:
Java 5: New Features and Enhancements
Java 6: Features and Enhancements
There's always a possibility that any specific release may contain a bug affecting you, or that your code depends on some unspecified behaviour of standard API classes that has since changed, but in general, upgrading to the latest Java release is recommended and relatively painless. You should of course test the product extensively on the new JRE.
It's Java, it's not a dirty scripting language which changes its syntactic, its grammar, and its API every minor release.
Backward compatibility is one of the major features of Java.
Just did it (Swing app) from 1.3 to 1.6 :)
Works (according to UAT testing) perfectly OK (except some changes required for awt UI). PTE shows some memory consumption reduction (not much), and the server side works somewhat faster (I tend to think it's due to GC improvements and string intern()).
In any case, you have to do it because of EOL, and 1.6 is not much different from 1.5. So I'd say 1.6 definitely.
Whether this upgrade is recommended/fine i.e. skipping 1.5 ? Are there any catches
I think it's a good idea to skip 1.5 and go directly to 1.6 and there is absolutely no requirement that forces you to go through 1.5.
If yes then should I upgrade to 1.6u10 or the latest 1.6 available ?
I'd go for the latest. Actually, I think 1.6u16 is the current major release.
I would recommend upgrading to Java 6 over 1.5. As there would already be a need to test your app against the new JRE regardless of the version you choose, you may as well take advantage of this opportunity. Instead of incrementing your upgrade twice (once for 1.5 and later for 1.6) and requiring a test cycle twice, you can get it out of the way once. While you are at it, upgrading to the most recent version available would be perfectly fine.
We recently upgraded our Swing-application (lots of drag and drop) from 1.4 to 1.6 to get the concurrent facilities, and we have not seen a single issue which is due to Java itself. We also want to go to the Nimbus Look and Feel since the Windows look and feel doesn't look and feel like Windows.
The killer feature you should show your boss, is how to attach to the application using jvisualvm to introspect the running program in case of issues.
Swing apps can definitely have issues version to version. We have had issues every upgrade (1.3 to 1.4 and 1.4 to 1.5 and we stuck our toe into 1.6 - and more issues). However, there is no reason to spend time on 1.5. Go straight to 1.6, the latest release, you won't be saving any time by going to 1.5, you will just spend a bunch of time testing on 1.5 and then do it again at some point in the future for 1.6. Much more economical to jump to 1.6.
A lot of minor revisions fix issues, so sticking to 1.6_u10 is just inviting issues. u10 was a big upgrade (unlike its name implies) as far as Swing is concerned, and several of the releases after that addressed issues that came to light after u10 was released.

Categories

Resources