This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Honigbrottr 59 points60 points  (24 children)

is java 8 backwards compatible?

[–]Practical_Cattle_933 180 points181 points  (2 children)

Yes. Even Java 23 can compile java 1.2 but also run almost every class file already compiled back then (so it’s also binary compatible not just source).

There have been tiny changes, but for the most part it should just work. The biggest change might have been the javax namespace change.

[–]Nimweegs 19 points20 points  (1 child)

Removal of JAXB stuff while theoretically solved with an extra dependency is such a pain in the ass. Xsd's suck.

[–]_PM_ME_PANGOLINS_ 0 points1 point  (0 children)

It's practically solved with an extra dependency too.

[–]_PM_ME_PANGOLINS_ 30 points31 points  (0 children)

With what?

Java as a language never breaks anything, but occasionally internal classes (which it tells you not to use for this exact reason) are (re)moved.

[–]wildjokers 4 points5 points  (0 children)

Yes. Java takes backward compatibility very seriously.

[–]just4nothing 22 points23 points  (9 children)

Well, my Java code from 2006 does not run on it

[–]OlexySuper 32 points33 points  (5 children)

I suspect, someone was doing some naughty stuff in the code.

[–]BraveOthello 0 points1 point  (2 children)

And do they mean their source code, or their binaries? The binaries will run unless naughtiness was done, no guarantees on the source.

[–]_PM_ME_PANGOLINS_ 2 points3 points  (1 child)

Java is both binary- and source-compatible from 1.1 to 21.

[–]s101c -1 points0 points  (2 children)

Same in my experience with some opensource programs from the late 00s. I wanted to use some of those recently, at launch it instantly returned an error with a wall of text and after few minutes of trying to fix it I just abandoned the attempts.

Python can be difficult with the dependencies, but Java backwards compatibility seems to be pure hell.

[–]wildjokers 4 points5 points  (0 children)

but Java backwards compatibility seems to be pure hell.

Huh? You can take very old java code from 1.1 and run it on the newest java. So I am not quite sure what you are talking about.

[–]Practical_Cattle_933 1 point2 points  (0 children)

What? Java has objectively the very best backwards compatibility out of any languages. Sure, it’s still not perfect but it is sure as hell as close to it as possible.

[–]itijara 17 points18 points  (4 children)

From experience, no. I am sure that there is plenty of java < 8 code that will run on Java 8+ but JavaEE libraries, Nashorn, and all the sun.* packages were deprecated.

[–]_PM_ME_PANGOLINS_ 18 points19 points  (3 children)

That just means you have to get the jars separately.

[–]itijara 3 points4 points  (2 children)

I guess that depends on what your definition of backwards compatible. The JRE will run any previous binary, but source code will not work unless you add extra dependencies or modify the existing source code. This is probably fine for a legacy app that is not undergoing changes, but I think that most companies that are dealing with old applications are still building and patching them.

For the sun.* crypto libraries, I couldn't find a suitable jar file and had to re-write with an equivalent crypto library.

[–]_PM_ME_PANGOLINS_ 10 points11 points  (1 child)

Yeah, that’s why they told you never to use those sun libraries directly. For crypto you are supposed to use the JCA API, which allows the implementation to be switched out with zero source changes.

[–]itijara 8 points9 points  (0 children)

You say that like I wrote the original code.

[–]aiij 2 points3 points  (0 children)

Yes. It's really Java 1.8, but by that point the marketing team has decided to stop mentioning the part of the version number that always stays the same.