Thanks so much
I'm not too sure if I would go right to Java 9 as it just came out within that last week.
Most/much of Java is setup to be backwards compatible, however I'm sure that there are some breaking changes between versions.
How you manage the upgrade does depends somewhat on your environment and other system dependencies. For instance if you are running WebSphere with a specific version of Java then you may need to upgrade WebSphere first.
Even thought Java does try to be backwards compatible, the code that you are responsible for could be using third party libraries (pdf library, word library etc) which may break with newer versions of Java.
I do not think that there is a quick and easy process here, regardless of which IDE you are using.
Here are the broad steps:
A) Get a listing of system dependencies which are used in your environment that may need the code your are working with. For example if WebSphere is part of the equation then see if there is a reason that they are using the version Java that they are currently using. If they need to use a specific version of Java for whatever reason then maybe your job is done. Or maybe you have to do some extra testing with a newer version of the dependancy to see what happens with a newer version of Java.
B) Get a listing of libraries that the code is using to see how they would react to an upgrade of Java. Maybe these libraries cannot function in newer Java versions and your job is done. Or maybe you have a find alternatives.
Once you are 100% sure that you have both steps A and B from the above listing covered then I would suggest making a test environment with Java 8 to see what happens when compiled with Java 8.
- If this works then you would need to migrate that to the production systems/environment.
- If this does not work then try with Java 7. If it works with Java 7 then I would migrate the Java 7 to the reset of the production systems/environment.
- If it works with Java 7 but not Java 8 then you have to become a detective and find out why.
This whole process could be done within a week if everything goes smoothly and you have a small production systems/environment. However more then likely this process will take more then a week.
Hope this helps out,
You should be able to recompile your code with Java 8. Then you can look at updating the syntax to use new features. For example, loops and streams.
As long as you don't breach that important principle:-
Jeanne Boyarsky wrote:. . . look at updating the syntax to use new features. For example, loops and streams.
I would suggest you look for instances of finalize() methods and replace them with something else; you will find finalize() is hardly ever used any more and will be deprecated in Java9.
If it ain't broke, don't fix it.
Campbell Ritchie wrote:As long as you don't breach that important principle:-
If it ain't broke, don't fix it.
But as a counterpoint--if it's messy, hard to understand, inflexible, low performance, or unscalable, it might very well be "broke" even if it works properly ;)
However, to the original point, I have it on reliable authority (Mark Reinhold) that more than half the effort involved in creating a new version of Java goes into ensuring it's backward compatible. You might come across something that doesn't work, but a) that's pretty darn rare, and b) it's quite likely that your code used something that wasn't "recommended" in the first place.
I have one piece of code that's caused me trouble, and that was using a pre-released version of transparent windows in Java 6. The code specifically used classes in packages sun.blahblah, rather than exclusively using java... and javax...
So, yeah, try it, you might like it.
And, you might even find you can get directly to Java 9, though I've not kept up so can't comment with confidence on whether things like the command line might change for that.