0

I have java EE artifacts like .jar , .war, .ear files compiled and running in java 1.6 version. i wanted to run them (.ear file [.jar + .war]) in latest java versions like java 1.8.

Which Option would be the best considering moving to new java version.

1) Recompile Code in 1.8 and deploy to Application server
- to be at a little safer.
2) Just deploy to java 1.8
- No Code Compilation required (means .ear file generated using java 1.6). .ear file can be safely deployed to latest java 1.8 version
- probably we wont end-up having runtime issues ?

As this this is a production code base and no developer. Hence No Code changes in either cases, the only change is java version. I prefer going with Option-1, as compilation in higher version of exiting java classes to avoid any runtime issues.

Any thoughts ! or other useful options in this regard.

Thanks

738560
  • 129
  • 2
  • 9
  • 2
    what is the point about "recompiling" them. are you also going to refactor them to be compliant with that new version? - Since you're not going to alter code. why? – Stultuske Oct 05 '18 at 10:30

2 Answers2

0

As @Stultuske mentioned you only telling no code changes possible in either cases then your first case not valid one only.

But anyway as per java(Oracle) compatibility specification Java 8 is backward compatible with previous versions for sure no doubt about this except some very rare cases where binary incompatibilities happened.

For more information about this you can refer below stack overflow link --

Can newer JRE versions run Java programs compiled with older JDK versions?

0

Recently I did a similar thing but we updated the code/dependencies if needed.

I will suggest recompiling the code base first because this will tell you quickly if it or any dependencies don't support the newer Java version. If compilation is successful, then deploy to test environment and do sanity, regression, etc.

I hope you aren't talking about deploying to Production environment directly :)

Rahul
  • 637
  • 5
  • 16
  • Yes deploying to production is the ultimate goal – 738560 Oct 05 '18 at 14:48
  • But we do have Application Specific jars in them, which we might need to consider as their version will also be changing (and their .jar file version will also change ). in that case do we need to consider recompiling the entire code with java 1.8 with appln specific jars (with latest version) – 738560 Oct 05 '18 at 14:52