Java vs .Net legacy code issues

Status
Not open for further replies.

Bagheera

Ars Tribunus Angusticlavius
8,773
Subscriptor
Several of our Java-based programs are not compatible with the latest JRE. We have to maintain expensive subscriptions to Oracle to get security updates for JRE 6 and 7 because several of our programs won't run with JRE 8 installed.

I've noticed that none of our .Net-based programs have this problem. All of our Windows servers and clients have .Net Framework 4.6.1 only. We don't need to keep older versions installed, even for programs that were developed many years ago.

Is this a common issue between Java and .Net development? Does Oracle deprecate old libraries faster than MS does? Does .Net handle backward compatibility better than Java does? Or do I just have bad Java developers at my workplace?

I think Programmer's Symposium is the best place to get reasonable, calm opinions on this issue. If it's more a Battlefront question, then just lock it rather than move it there. This post sounds like I'm criticizing Oracle and fanboying MS, but I'm really not. I'm genuinely curious to know if the behavior I see at my workplace is common elsewhere.
 

Pont

Ars Legatus Legionis
26,160
Subscriptor
Does Oracle deprecate old libraries faster than MS does?
I have no idea what the current situation is, but early on it was definitely Sun's fault.

MS applied updates to the .NET Framework and tried to maintain backwards compatibility. Distributed via Windows Update and standalone installers.

Sun's guidance was to just have multiple versions, even minor versions, of Java installed at the same time. All apps would have startup scripts (.sh or .bat) that would launch them with the appropriate JDK. Not unsurprisingly, this led to a security nightmare, as there was no sane way to distribute security patches that affected all apps that used Java short of doing a full file scan of your disks to find every version of every JDK you had installed.
 

Bagheera

Ars Tribunus Angusticlavius
8,773
Subscriptor
Thanks for the input. To clarify: I'm trained as a developer, but I work as a sysadmin. I've written programs in C# and Java, but the only work I do professionally are admin scripts in Powershell, Bash, and occasionally Python.

This post was written out of frustration with a vendor whose software is stuck on JRE 6. They're about to release the new version, which runs on....JRE 7. They hyped it up like it was so great they were coming off JRE 6, and our sysadmin team sent a reply that was one big :facepalm: .

Many of our sysadmins bash Java, but I'm bashing the vendor for not updating their code. This is based on my limited experience with Java: Oracle doesn't remove a feature until it's two versions old. So if our vendor is stuck on Java 7, that means they're using classes/interfaces/something that were: available Java 6 was released, marked as deprecated in Java 7, 5 years ago, and removed from Java 8. Do I understand that correctly?
 

Apteris

Ars Tribunus Angusticlavius
9,589
Subscriptor
Many of our sysadmins bash Java, but I'm bashing the vendor for not updating their code. This is based on my limited experience with Java: Oracle doesn't remove a feature until it's two versions old. So if our vendor is stuck on Java 7, that means they're using classes/interfaces/something that were: available Java 6 was released, marked as deprecated in Java 7, 5 years ago, and removed from Java 8. Do I understand that correctly?
Not entirely. While there are deprecated classes (but who cares about that it's just an annotation :devious:) and incompatibilities between Java 6 and Java 7 as well as between Java 7 and Java 8, you'd need the developers on the vendor's side to analyse their source files and tell you, to know exactly why their software doesn't run on newer JREs.

Or you could debug it yourself in a newer-than-supported JRE if you wanted to, but why would you want to.
 

ShuggyCoUk

Ars Legatus Legionis
10,387
Subscriptor++
Disclaimer to all this:
* App writers can sometimes do hideous things that the framework can do little about (for evidence see much of Raymond Chen's Old New Thing blog)
* I am not familiar with the JVM eco-system in recent years - I may be very out of date

MS actually started making retaining backwards compatibility with newer .Net Framework versions harder over the last few years. Previously all 'significant' versions of the framework could co-exist on the same machine. Apps (executables that used the framework) would use the one they were built against if required, but would use more recent ones by default if the runtime indicated they should; Changing/adding a simple config file for the executable could alter that behaviour.

This was generally desirable due to MS generally keeping things compatible. They only made one really serious binary compatibility break to the CIL (intermediate representation used by .Net apps), and that was the 1.1 to 2.0 transition over a decade ago[1]. If you had more complex hosted scenarios (when an unmanaged process hosted .Net app-domains directly) then it was impossible to allow mixed instances up until the 4.0 Era IIRC. That was a particularly complex case, and I doubt hosting multiple different JVM runtime in a single process would be much fun in that era either.

MS recently changed to NOT doing this on the two most recent significant runtime upgrades. The installation of the newer framework was an inplace upgrade. Anything requesting 4.x gets 4.{mostrecent} and it is impossible to change this (because the old files are replaced).

I can see why they did this, keeping the old versions is a bunch of space (and the flash heavy tablet world has much less space to burn than before). Plus is simplifies their support and security concerns. Nonetheless this back fired rather spectacularly on the last one because their initial release had a correctness bug in the JIT[3]).

As mentioned, this approach (assuming forward compatibility for older apps compiled against older runtimes) was possible because MS approach to binary breaking changes to APIs is generally extremely conservative[2]. Crucially they almost never delete older APIs (even on a runtime bump the older dlls remain, and almost always work). My understanding has always been that the JVM and standard libraries of Java has kept fairly true to the first part, but is more willing to delete deprecated functionality (after a pretty significant amount of time).

Java does have the additional wrinkle that is how a java process gets the relevant runtime to start with. This is left to the 'runner' of the app, in effect the end user, most of the time rather than the standard mechanism being controlled by the OS integration. There is considerable fragmentation and potential complexities as a result (JAVA_HOME, and the JRE_HOME being a whole bunch of fun) as environment variables can be quite painful to use in this regard. If you choose to depend on a shared one a change to it can cause unintended pain. In addition many configuration settings for a more complex java process might involve command line variables that tweak the memory/gc behaviour and those are nor always consistent across java runtimes is you're making use of the -X switches)

The approach that they seem to be going with .Net Core is to compile most/all of the necessary parts of the runtime into the resulting executable. How they plan to back patch security issues in older applications I don't know.
Edit: how serendipitous: you can keep doing both if desired but the app writer is responsible for patching
If I deploy my app along with .NET Core it's important to remember that I'll be responsible for servicing .NET Core and keeping it up to date.

There is an argument that, if you are a business and one of your vendors does not support the latest runtime framework within a reasonable amount of time (over a year is definitely unreasonable, but tune to taste) then you need to start moving away from them, or apply pressure till they do. If a vendor refused to support windows 10 (assuming they supported windows in the past) nowadays they should be dropped as the resulting knock on effect to the rest of your business should be too severe to consider. If the App is genuinely irreplaceable (company gone bust but the app has massive business value and migrating will take some time) then it needs putting into a VM with the required dependencies and isolating from the rest of your software as much as possible. The same approach should govern something dependent on an ancient java/MS/whatever runtime to make it clear nothing else should be using it/impacted by it.

[1] Generics required this to be effective - this was a very good thing, and totally worth it.
[2] Not quite so conservative as Linux's "Don't break Userspace", but there's a much larger API surface for MS to maintain
[3] It's hard to over state how bad that is. Crashing is one thing, producing the wrong result sometimes is *awful*.
 

gregatron5

Ars Legatus Legionis
13,003
Subscriptor++
I don't know what vendor you're using, so I can't say specifics. IME, the upgrade from Java 6 -> Java 7 was mostly painless unless you were doing something stupid. The upgrade from Java 7 -> Java 8 can cause more problems if you're in the bowels of the Java. Oracle changed some things with memory handling and class loading that broke a lot of assumptions. Anything that loads classes (e.g. J2EE containers) is suspect to breakage.

That said, if you're vendor is just now getting to Java 7, I'd start looking for a replacement if you can. Java 9 is due out early next year, which means Java 8 will be EOL'd before too long, and your vendor's timeline does not inspire confidence.

[Edit] I was starting to wonder if you work for my last company, but then saw that you're not in Chicago so probably not.
 

Fruity Pebbles

Ars Praetorian
595
Subscriptor
[url=http:/civis/viewtopic.php?p=31902453#p31902453:z3mk6t5c said:
Bagheera[/url]":z3mk6t5c]
This post was written out of frustration with a vendor whose software is stuck on JRE 6. They're about to release the new version, which runs on....JRE 7. They hyped it up like it was so great they were coming off JRE 6, and our sysadmin team sent a reply that was one big :facepalm: .

To me this sounds like a cheapskate vendor. I worked on an application that - over a long time - moved from Java 1.4 to Java 5 to Java 6 to Java 7. None of those moves required a great deal of development effort, but it did require a significant commitment of testing resources to make sure things were working correctly.


[url=http:/civis/viewtopic.php?p=31902453#p31902453:z3mk6t5c said:
Bagheera[/url]":z3mk6t5c]
Many of our sysadmins bash Java, but I'm bashing the vendor for not updating their code. This is based on my limited experience with Java: Oracle doesn't remove a feature until it's two versions old. So if our vendor is stuck on Java 7, that means they're using classes/interfaces/something that were: available Java 6 was released, marked as deprecated in Java 7, 5 years ago, and removed from Java 8. Do I understand that correctly?

Oracle doesn't remove features for at least two versions, but sometimes it's longer than that. And they don't deprecate/remove much, especially the mainstream stuff. If the vendor can't get their code to run on a new version of Java they probably did something foolish.
 

Drizzt321

Ars Legatus Legionis
34,922
Subscriptor++
[url=http:/civis/viewtopic.php?p=31918897#p31918897:15sq52ts said:
Fruity Pebbles[/url]":15sq52ts]
[url=http:/civis/viewtopic.php?p=31902453#p31902453:15sq52ts said:
Bagheera[/url]":15sq52ts]
This post was written out of frustration with a vendor whose software is stuck on JRE 6. They're about to release the new version, which runs on....JRE 7. They hyped it up like it was so great they were coming off JRE 6, and our sysadmin team sent a reply that was one big :facepalm: .

To me this sounds like a cheapskate vendor. I worked on an application that - over a long time - moved from Java 1.4 to Java 5 to Java 6 to Java 7. None of those moves required a great deal of development effort, but it did require a significant commitment of testing resources to make sure things were working correctly.


[url=http:/civis/viewtopic.php?p=31902453#p31902453:15sq52ts said:
Bagheera[/url]":15sq52ts]
Many of our sysadmins bash Java, but I'm bashing the vendor for not updating their code. This is based on my limited experience with Java: Oracle doesn't remove a feature until it's two versions old. So if our vendor is stuck on Java 7, that means they're using classes/interfaces/something that were: available Java 6 was released, marked as deprecated in Java 7, 5 years ago, and removed from Java 8. Do I understand that correctly?

Oracle doesn't remove features for at least two versions, but sometimes it's longer than that. And they don't deprecate/remove much, especially the mainstream stuff. If the vendor can't get their code to run on a new version of Java they probably did something foolish.

Agreed on this. They probably used some bad hackery and used some Sun/Oracle private classes or something. You can do some real extreme stuff inside the JVM if you really want to stretch your neck under the guillotine. Or your downstream clients.

Ideally, get a new vendor. Practically speaking... good luck is all I can say. Maybe pitch paying the vendor to update to latest Java8. Sell it to management as a 1-time cost, vs almost perpetual cost paying Oracle, who eventually will stop even supporting Java6/7 anyway regardless of how much you'll pay.
 

Afty

Ars Scholae Palatinae
1,434
Bytecode manipulation isn't voodoo, but does require updates with language versions to handle new bytecodes and language features. For example, to support Java 8 you'll have to handle invokedynamic because it's used for lambdas.

There are other small incompatibilities between Java versions. For example, hashmap iteration order is unspecified but is consistent for a major version, so people end up accidentally depending on it. JUnit is a good example -- the order in which unit tests are executed used to be based on whatever order the JVM reflectively returned the methods for the class, which was unspecified. People accidentally depended on them running in a certain order, and when Java 7 was released everything broke. JUnit then defined a specific iteration order and used that instead of depending on the VM. (see https://github.com/junit-team/junit4/wi ... tion-order)

At my company we have patched our JDK to randomize hashmap iteration order to avoid this problem, helping us migrate to new versions of Java. Python and Go do this as well.
 
[url=http:/civis/viewtopic.php?p=31969985#p31969985:2e5ah0la said:
Faramir[/url]":2e5ah0la]Apparently some of that stuff is pretty widespread in the java library world. IIRC jackson (json library) and jersey (REST library) do bytecode manipulation voodoo under the covers. Not sure for what exactly, but I'd be it has something to do with annotations ...

Its used for AOP, essentially wrapping your REST handlers in other functions to handle pre- and post-processing data. They do it to provide a clean annotation-based interface instead of the standard Java interface and factory hell (http://steve-yegge.blogspot.com/2006/03 ... nouns.html).
 

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
Microsoft has made extreme efforts to minimize backwards compatibility issues. Anything v3.0 and above is pretty safe to move up to newer frameworks (Even 1.0, 1.1 and 2.0 were reasonably close to 100% compatible with previous versions.

Why?

Because MS realized quickly that if a pattern of apps breaking on new frameworks occurred, .NET could easily die off because IT departments would drag their feet upgrading clients, and that would stifle adoption of the platform. They bet the farm on the .NET upgrades being safe and made the new versions automatically install with typical Windows Update settings. They are fully aware of how bad things would be if an automatic Windows update suddenly broke legions of older .NET apps. (Upgrading funky not-best-practices code still has risk, but those instances are few and far between.

I'm not a Java/Oracle guru, but it hasn't been uncommon to see issues with JRE versions in code that I've been involved in. Java seems to have orders of magnitude more issues with runtime compatibility than I've ever seen with .NET.
 
Status
Not open for further replies.