I'm new to Java and have recently become responsible for maintaining a code base of approximately 300 pages (8.5" x 11"). Any tips on how to estimate the expense and time required to update from Java 6 to Java 9 would be greatly appreciated. Would you recommend going from 6 to 7 to 8 and then 9 or is going straight from 6 to 9 the preferred path?
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,
“The strongest of all warriors are these two — Time and Patience.” ― Leo Tolstoy, War and Peace
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.