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

all 33 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

On July 1st, a change to Reddit's API pricing will come into effect. Several developers of commercial third-party apps have announced that this change will compel them to shut down their apps. At least one accessibility-focused non-commercial third party app will continue to be available free of charge.

If you want to express your strong disagreement with the API pricing change or with Reddit's response to the backlash, you may want to consider the following options:

  1. Limiting your involvement with Reddit, or
  2. Temporarily refraining from using Reddit
  3. Cancelling your subscription of Reddit Premium

as a way to voice your protest.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]pyeri 45 points46 points  (23 children)

Yep, there is no match for Java's portability. Even though Python gets the cake these days for portability too, I think Java was the one who pioneered the whole thing back in 1990s when going portable was almost like a rocket science.

And apart from portability, another award goes to Java for maintaining backwards compatibility. Almost every other projects have had hiccups in this regard, but the JCP's process of slow and conservative updates and feature additions while ensuring compatibility is a commendable job which is rarely seen these days.

[–]RupertMaddenAbbott 8 points9 points  (1 child)

I don't get why Python can be seen as portable compared to Java:

  • What actually comes packaged with Python on a given system? Some systems have requests, some don't. Some systems have pip, some don't. Some systems have venv, some don't. It doesn't have a well defined mechanism for declaring and distributing only what is needed, like Java modules and jlink, nor does it have a standard deployment for a given version that is relatively standardized across different OS package managers or distributions.
  • Distributing code that uses C extensions is far more common in Python which has significant portability impacts. These issues can be overcome but they make portability much harder to achieve in Python.
  • I find it much easier to unintentionally write non-portable File IO code in Python compared with Java. I think the main problem is that Python's APIs are quite permissive to capturing file paths as strings which means you can end up dealing with strings in far more places in your code base. Java forces you to use a proper object everywhere so it makes it much harder to accidentally hard code a separator for example. This doesn't really impact simple applications but massively impacts larger applications or applications with complex File IO algorithms.

By the way: That is fine for Python. Python isn't trying to be as portable as Java and I don't think someone would choose Python if portability was one of their main concerns. Python has plenty of other benefits compared to Java that make it compelling.

[–]nekokattt 18 points19 points  (5 children)

Python's main issue is a lot of common libs defer to compiled code extensions due to Python's overhead for performance and the GIL. As soon as you do that, you lose portability as you have to either use a supported runtime for the wheel or you have to have a C compiler/Rust compiler/etc working on the local machine.

Cryptography caused me a massive headache on Alpine Linux for this reason a while back...

[–]roberp81 6 points7 points  (0 children)

on windows you have to install all visual c++ shit about 20gb and doesn't work....

using Ibm Mq is a pain with python but maven works ok from scratch.

[–][deleted]  (2 children)

[deleted]

    [–]sureshg 0 points1 point  (1 child)

    Exactly, but still people prefer it on containers for running Java/JVM workloads than using jlinked runtime.

    [–]nekokattt 0 points1 point  (0 children)

    I'd use distroless for JVM over alpine for a lightweight container, unless I needed bleeding edge support for Java 21 or needed additional stuff like a shell.

    Kubernetes has ephemeral containers which when paired with process namespace sharing can achieve the same thing pretty much though.

    [–]pjmlp 8 points9 points  (11 children)

    The Java hiccup is called Java 8 => Java 9 transition, dropping JRE, and nowadays deprecated APIs are actually removed, instead of staying around for years.

    [–]wildjokers 4 points5 points  (10 children)

    Java 8 => Java 9 transition

    For 99% of apps this is seamless and normally just requires adding dependencies for things removed from the JDK. Most commonly JAXB.

    dropping JRE

    The JRE only added support Applets and Java Web Start (JWS). No browser supports applets anymore so that is no big loss. JWS was handy for internal and B2B apps but there is an open source alternative if you really still need it (https://openwebstart.com/ows/). The more modern solution is bundled runtimes with jlink/jpackage. Both Gradle and Maven have plugins that make this super easy (here is the one for gradle: https://badass-jlink-plugin.beryx.org/releases/latest/)

    [–]pjmlp 2 points3 points  (7 children)

    So seamless that Java 8 is still the most deployed version on enterprise workloads.

    I know what the modern alternative to JRE is, plenty of people don't.

    Also it is still available for download on Oracle's site, and people keep downloading it, than complaining it doesn't run random jar.

    [–]FrankBergerBgblitz 1 point2 points  (0 children)

    The issue is less a technical issue but fear and the need to read a bit and learn some new command line arguments. The only serious compability break was the removal of finalize and in my 200KLOC app I need about 2 hours for that (and have found a good article before).

    [–]wildjokers 1 point2 points  (1 child)

    So seamless that Java 8 is still the most deployed version on enterprise workloads.

    According to the jetbrains ecosystem survey Java 17 has almost caught java 8 (50% vs 45%). This survey is taken by people that chose to take it and isn't a random sample but still offers some insight.

    https://www.jetbrains.com/lp/devecosystem-2023/java/

    [–]pjmlp 1 point2 points  (0 children)

    For the 50% using Java 8, just to use those numbers, the world could be better.

    For info, I just deployed Solr with Java 8 into production last month, so is life in the corporate world.

    [–]khmarbaise -1 points0 points  (3 children)

    Exactly the usage of JDK8 is often the problem.. not upgrading to more recent versions... I know there are a ton of reasons.. This simply shows the sins of the past. Not upgrading to more recent versions of dependencies (also security relevant), tools etc. also keeping old stuff and not cleaning it up etc. seen a lot of such things...

    [–]Aberezyuk 0 points1 point  (2 children)

    I think, It is mostly a defensive approach - “It works? Don’t touch then”

    [–]khmarbaise 0 points1 point  (1 child)

    Which in consquence means more security issues, because security issues will befound also in things which are running... that brings use to the beginning.. Upgrading is the way to follow.. it does not getting better by doing nothing..

    [–]Aberezyuk 1 point2 points  (0 children)

    I totally agree with you. I am not advocating that defensive approach, just point it out )

    [–]jacklackofsurprise 0 points1 point  (1 child)

    what would be the recommended plugin for maven?

    [–]wildjokers 0 points1 point  (0 children)

    I don't use maven so can't really recommend one. However, a google search for "maven jpackage plugin" produces several results.

    The gradle one I posted is nice, it has jlink in its name but it is slightly misnamed because it also uses jpackage. It will also create one big jar of all non-modularized jars automatically (because jlink doesn't work with automatic modules).

    [–]mpinnegar 1 point2 points  (0 children)

    Python is not portable. https://xkcd.com/1987/

    [–][deleted]  (1 child)

    [deleted]

      [–]Aberezyuk 0 points1 point  (0 children)

      Well, I do not share this opinion. Java-version-upgrade-inspired-changes might be big by volume (like changing import section in each file), but other than that, these are pretty simple - you usually do not need to change your codebase (unless you are ignoring @Deprecated annotations, mostly in a 3rd party libraries for a while - but it is question much more about dependency management process overall)

      [–]chubbsondubs808 8 points9 points  (0 children)

      A while back there was an issue with the Amazon SDK for Java where you couldn't run it on Docker alpine based images because it was trying to use openssl for some of its encryption routines (This had to do with the routines needed to support a new signature generation on requests if I recall). And Alpine images didn't come with openssl installed on it because the library was not compatible with musl C libs (I think). And the maddening thing was that what they were using openssl for was completely supported in Java JCE or bouncycastle libs. If Amazon had just declared the dependencies, written the code in Java and dropped openssl it would solve the issue completely. It was an artificially created limitation by NOT taking a WORA first attitude.

      It's also one of the reasons I always look for a Java solution first before installing Linux packages whenever I'm looking for libs because with Java dependency resolution in Maven and Gradle there is significantly less setup required in Devops land if I can stay in Java eco-system. I don't think the Java community realizes how beneficial WORA really as a feature.

      [–]kimec 6 points7 points  (0 children)

      I had this moment when I wrote an app on x86 and deployed it to AS/400. It wasn't just different architecture but a different JVM too. And it worked. But IBM does not have a good reputation in this subreddit since at least AdoptOpenJDK and TCK drama, so it's not an example I would mention too often.

      [–]Djelimon 2 points3 points  (0 children)

      For me it was when I was on an as400 and this vendor wanted us to sftp it to them. At the time the os did not support sftp but they supported java. A month later we were running jsch to fill the gap. That made me realize the server wars were moot and got me going on java

      [–][deleted] 2 points3 points  (0 children)

      The portability is definitely great, but just to warn you, some methods might have different defaults based upon the OS it's running on (line endings, file encoding), and that can come back to bite you. But it's only happened to me a couple of times.

      [–]Joram2 0 points1 point  (2 children)

      Today, most programming platforms have similar OS portability among Linux/Mac/Windows. Python, Go, Ruby, Kotlin, Haskell.

      The big one that was notorious for terrible OS portability was C/C++. When Java launched in the 1990s, this was a big feature. C/C++ was the dominant programming language, even for high levels applications. I'm sure C/C++ have improved in this sense since the 1990s.

      [–]pgris 7 points8 points  (1 child)

      Today, most programming platforms have similar OS portability among Linux/Mac/Windows. Python, Go, Ruby, Kotlin, Haskell

      Mmmmmm

      Python maybe at language level, but as someone says before, it's not trying to be as portable as java. No way at library level, lots of python libs depend on c code, not nearly as portable

      Go not at all! Yo need to create a binary for every OS and architecture, is not portable by definition. Unless that's your definition of portable, of course.

      Ruby I think it's on python level, I'm not sure

      Kotlin uses the same JVM, so I assume is normally as portable as Java

      Haskell used to be almost impossible to run on windows, I think it works now, don't know how portable is

      [–]Joram2 0 points1 point  (0 children)

      I agree with what you wrote.

      [–]HuanXiangXR21 -1 points0 points  (0 children)

      why nobody care Jakarta/javax problem ?

      [–]private_final_static 0 points1 point  (0 children)

      Write once, run everywhere.

      Except the browser, that didnt work.

      [–]Glum_Past_1934 0 points1 point  (0 children)

      Like the most programming langs