lukev 4 hours ago

More new programs should be written in Java/on the JVM.

Most of the reasons Java dropped out of popularity no longer apply, and at this point it is an incredibly stable and mature ecosystem.

I can come back to a Clojure program I wrote ten years ago and it runs great, meanwhile a TypeScript program I write 6 months ago requires a bunch of updating and cleanup.

  • Foomf 3 hours ago

    Oracle makes me too uneasy. Can I use Java without the worry of incurring Oracle's wrath? Maybe, if I make sure I use openjdk/jump through some hoops I'll be fine. Or, I could just use any other language and not have that worry looming over me. C# is right there if I want a java-like experience without the anxiety of Oracle breaking my kneecaps.

    I don't know how to use java and not violate one of Oracle's EULAs. I could read about it and figure out how to do it safely, or I could just not use java. Java isn't essential (for greenfield projects). There's lots of good alternatives, so I'd rather do that.

    • samus 3 hours ago

      Just use OpenJDK (only downside is you have to upgrade every half year) or a distribution of another vendor (most people use Eclipse, or Red Hat if they already are Red Hats customers). It's really not as difficult as it is made out to be.

      If you use Oracle's distribution of the JDK then you are an enterprise customer and should have the resources to deal with their license terms.

      • Foomf 2 hours ago

        "Am I using the correct language runtime distribution (or version thereof) so I don't get into legal trouble?" Is a question none of Java's competitors have to ask.

        Even using OpenJDK is a sword of damocles waiting to fall. If I forget to update OpenJDK, Oracle could come after me. It's just risk that I don't have to worry about by choosing not to go with Java. It's probably not a lot of risk, but it's risk nonetheless that doesn't exist with Java's competitors.

        Competition is so fierce in the language space and there are so many good options that java can't afford to have any friction points like this.

        EDIT: I got oracle openjdk and oracle jdk mixed up. They're different things. It looks like the oracle openjdk does not have its license change, the oracle jdk does. This is a problem/risk I don't have to worry about with any other language, but getting the two mixed up is on me.

        • cbm-vic-20 2 hours ago

          > If I forget to update OpenJDK, Oracle could come after me

          I must have missed that section of the GPLv2.

          Oracle does distribute a different (not OpenJDK) Java distribution under a special not-open-source no-cost license, which includes a stipulation that you can't use updates after the next LTS release. This only adds to the confusion: you really only need Oracle's special distribution if you want paid Oracle support for it or their stuff that requires it.

        • munksbeer 2 hours ago

          >Even using OpenJDK is a sword of damocles waiting to fall.

          No, it really isn't. Honestly, people seem to go to great lengths of talking nonsense to discredit Java. There are many reasons to not like a language, and that is absolutely fine. But there is no point talking nonsense about it when you could just... not use it.

          • Foomf 2 hours ago

            I was under the impression that openjdk changes licenses once a new version comes out. That's why the parent comment said "the only downside to openjdk is you have to upgrade every half year", right?

        • thevillagechief 2 hours ago

          This coming from a big Oracle skeptic. None of this is true. There is no practical friction left if you're using OpenJDK. And from the parent comment, you do not need to upgrade every 6 months. Most people just work with the LTS version.

        • lukev 2 hours ago

          > If I forget to update OpenJDK, Oracle could come after me.

          What?

          • Foomf 2 hours ago

            Licensing for OpenJDK is non trivial. Look at the large table and various bullet points Oracle had to make to tell you the license. https://www.oracle.com/java/technologies/javase/jdk-faqs.htm... (open the first dropdown on their FAQ page to open up their "licensing matrix")

            This is a mess, and is the license going to change again while I'm locked in the java ecosystem?

            Edit: It looks like the openjdk is consistently under the gplv2, I don't know why it has so many different entries in their table. I think I probably got opendjk and oracle jdk mixed up. I think the person I was replying to who said openjdk needs to be updated every half year got confused as well. It's so hard to even talk about all the different jdks without getting them mixed up or confused. Again, no other java competitors have this problem.

            • cbm-vic-20 an hour ago

              Licensing for OpenJDK is trivial (GPLv2+Classpath). Just like gcc/g++ and its runtime library exception.

              Licensing for Oracle JDK is more complicated. This is the one where you can use it for free, but after the next LTS you either have to move to the LTS or pay for updates. There's no reason to use Oracle JDK unless you want to pay for support from Oracle, or if your applications specifically require Oracle JDK. Oracle JDK is built from the same source as OpenJDK.

              https://blogs.oracle.com/java/post/free-java-license

        • Quekid5 2 hours ago

          What, exactly, are the JVM's competitors (not Java, btw)? You can always use Kotlin or Scala if they take your fancy. They both interop fantastically with 20+ years of the Java ecosystem.

          EDIT: The only remotely competitive ecosystem is JS/TS (because billions of pre-installs) and C#.

          > Even using OpenJDK is a sword of damocles waiting to fall. If I forget to update OpenJDK, Oracle could come after me. It's just risk that I don't have to worry about by choosing not to go with Java. It's probably not a lot of risk, but it's risk nonetheless that doesn't exist with Java's competitors.

          This is absurd hyperbole.

      • stronglikedan 2 hours ago

        All that just seems like friction when there are frictionless alternatives available. Life's too short for friction.

        • Quekid5 2 hours ago

          You usually have to explictly opt-in to installing an Oracle JDK because... you know, they have a license agreement that you must agree to.

          So there's no friction, everyone uses the OSS ones unless you have very specific needs.

    • thfuran an hour ago

      You don't have to jump through any hoops. If you don't want to deal with Oracle, don't be an enterprise customer of Oracle and instead just get some openjdk distribution.

    • GuB-42 an hour ago

      > C# is right there if I want a java-like experience without the anxiety of Oracle breaking my kneecaps.

      Is Microsoft really better than Oracle in that regard?

      • mrsmrtss 22 minutes ago

        If we look at .NET vs Java, then yes, Microsoft is better. Microsoft may charge for some of its dev tools (Visual Studio etc), but .NET itself is and was always totally free.

    • andrewl-hn an hour ago

      My semi-conspiracy theory is that the success of Rust is partially due to BigTech companies searching for a "legally-safe" alternative to Java.

      The multi-year Google vs Oracle lawsuit put the likes of Amazon and Facebook to unease. And meanwhile there was this safe and performant language with no strings attached under a nice Apache license. They quickly made a Foundation around it as a 501(c)(6) - trade association, and not a "public good"-kind of a non-profit. This essentially means that as long as you're a member and pay the fees you won't be sued - exactly what all these companies wanted. So now they all keep up the funding and employ some of the compiler developers to keep the lights on for next 20 years or longer.

      The fact that the language itself is really good for what they need it for is obviously the major reason why they support it, but the legal side of things definitely helped with adoption.

  • sunshowers 13 minutes ago

    Java has the same problem most imperative languages do, which is the lack of clear separation between mutable and immutable state, rigorously enforced by tooling. Many large-scale Java programs try and work around this by using immutable collections, which certainly makes a difference but can only go so far.

    Java has the additional issue of being object-oriented, which leads to spaghetti parent-child relationships under stress.

  • cgh 4 hours ago

    Java is hugely popular and widely used on large backend systems. I guess a lot of people here don't work on such systems? I'm always surprised when I see comments like the parent, since in my career exposure to Java is near-ubiquitous.

    • Noe2097 2 hours ago

      There has been a move in the past 8 years away from Java on the back end, notably to Go, by several large engineering organizations, which made the move, "motivated" by the example of companies like Google or by projects like Kubernetes, and seduced by the promises of a language simple to learn, build, and deploy.

      • p2detar 2 hours ago

        > seduced by the promises of a language simple to learn, build, and deploy

        That's actually quite correct and I'm saying this as someone that does Java on daily basis. Go is in fact superior in terms of deployment. I would rather deploy a Go-written service than a Spring Boot one. That being said, I love using Java for monoliths - large code bases crammed with business logic. I personally don't see Go doing very well in that direction.

        • makapuf 2 hours ago

          Why is it so ? Is go specifically lacking somewhere ?

      • Quekid5 2 hours ago

        Go is slowly becoming Java 1.5+ -- see the addition of generics.

        Btw, you can AOT compile Java if you wish... it'll probably be a larger binary than a Go binary, but that's whatever...

        [Meta] ... God, I'm turning in pjlmp here, lol

    • SoKamil 3 hours ago

      I suppose we are talking about user-facing desktop software.

    • belter 3 hours ago

      Most of the largest cloud was built on Java....

  • pgwhalen 3 hours ago

    Java's biggest risk towards continued adoption, by far, is the culture surrounding it - old Java programmers and old Java programs continue to be needlessly verbose, even if the language now has the tools (pretty much) to be as terse as other popular, modern languages.

    It's an uphill battle, but it might just climb the hill because it's still such a behemoth.

  • iLemming an hour ago

    > I can come back to a Clojure program I wrote ten years ago and it runs great

    Is that thanks to JVM or due to the way how Clojure works? Because I can share the same anecdotes for my Clojurescript projects. I can grab any old nbb script and things just work off the bat - sometimes I have to update some npm dependency, but most of the time, things simply aren't horribly broken. Meanwhile, I just spent half a day jumping around for weird Python dependency and venv magic dance, just for the sake of running five interdependent scripts.

  • palata 4 hours ago

    I'm secretly hoping that Kotlin and Compose will bring back Desktop apps on the JVM :-).

    • jareds 4 hours ago

      I'm rooting against Kotlin since it appears to be only usable with the JetBrains ide. I'm totally blind and Jetbrains tools are not nearly as accessible or easy to use as VS Code with all the Java extensions in my experience. At all the jobs I've had no one cared if I didn't use Idea, but considering it looks like there's no good VS Code tooling for Kotlin if I have to use Kotlin professionally it's going to be painful.

      • palata 10 minutes ago

        Oh I didn't know about that. Is JetBrains improving on accessibility, at least, or not really?

      • ohdeargodno 4 hours ago

        As of somewhat recently, Kotlin has a language server: https://github.com/Kotlin/kotlin-lsp

        Using it in vscode, while not perfect yet, is starting to be alright.

        • jareds 3 hours ago

          Thanks, I've starred the project so I can keep up with it. I don't currently have any plans to do anything with Kotlin but will look at this if I do in the future.

    • deepsun 3 hours ago

      I write desktop app on JavaFX (one Kotlin one pure Java). I don't see any problems why we should wait, it's production ready

      • palata 11 minutes ago

        I mean, I agree that it is really good! I'm just hoping that it will come in fashion, versus those ElectronJS... things.

  • Decabytes 2 hours ago

    My biggest Issue with Java, is that it isn't streamlined. There are multiple implementations of the jdk that could be used, Many different build systems, etc. The C# ecosystem is smaller for sure, but it is much more streamlined

    • waldarbeiter an hour ago

      The different JDK builds are almost all built from OpenJDK. Maven and Gradle cover nearly all use cases. The complexity is not that high.

  • AlienRobot 2 hours ago

    I've been trying Java recently with IntelliJ and it's been funny watching Java's evolution from the IDE's suggestions.

    In Java a lot of code looks like this

        void foo(Bar bar);
    
    where Bar is an interface, and in many cases it only has one single method, so it looks like a callback that must be wrapped inside a class. Fortunately, Java lets you create anonymous classes to use these methods.

        void foo(new Bar { @override boolean baz(Fish fish) { return false; } });
    
    I assume because this paradigm is so common somewhere along the way Java introduced "lambdas" that look like this (I learned this from an IDE hint)

        foo((Fish fish) -> false);
    
    But what if you have a class that has Bar.baz method signature but it's called something else like fries()? Turns out you can do this (another IntelliJ hint):

        foo(this::fries);
    
    This feels like a complicated way to declare a callback, but it means that if you do implement a method with the same name, you can just pass the instance, otherwise you can use the syntax sugar, e.g.

       saveMenuItem.registerMenuClickListener(myMenuClickHandler);
       saveButton.registerClickListener(myMenuClickHandler::onMenuClick);
    
    There is a lot in Java that just feels weird, though. From the top of my head:

    1. No unsigned integers. "byte" is -127 to 128. I believe this means it's not straightforward to make a 32-bit RGBA structure since you options are either using a signed "red" or using a 16-bit integer to store the 8-bit values. by the way I tried to benchmark how slow Java was compared to C in a simple test (I had arr1[] with indexes of arr2[] which contained values and I created arr3[] by resolving them) and it seems to be only half the speed of C which is probably fast enough for some basic low-level 2D graphics.

    2. String.split takes a regex argument and there is no standard way to split without a regex. This was really confusing to me, but fortunately it's very easy to write your own .split, so it's not that much of a big deal.

    3. You can call a different constructor with this(), but it has to be the first statement in the constructor. This one is pretty crazy! It would make sense if you couldn't access member fields before calling the constructor, but having to be first statement means if you want to calculate the argument for one constructor based on an argument passed to another constructor you need to do it inside the parentheses.

    So far there is only 2 things I wish Java had. First the ability to implement methods in interfaces so you could use them if you have an interface instead of using a static method. Second I wish @NotNull was the default. This is a problem that Kotlin fixes so I think if you like Typescript for tis type-safety learning Kotlin would be a good idea.

    • thfuran an hour ago

      Doesn't java now let you have both private methods in interfaces and default implementations of the interface methods?

  • AzzieElbab 4 hours ago

    It is probably more related to people replacing multithreaded services with single-threaded workers.

  • fnord77 3 hours ago

    I think Java is the best language for most medium to large projects or anything that requires threading or complicated/optimized IO

    Especially now that hardware architectures are getting fragmented again, I hope it becomes more relevant.

    I think Springframework is dragging Java's reputation down. I know Spring boot is better but it's such a monstrosity.

    I feel like sadly Python has won the war, though. Good enough for most things even though it is pretty rubbish.

    I see people trying to use Rust now for prod AI systems.

  • wry_discontent 4 hours ago

    In the circles I see, Java isn't popular because it's verbose and boring to use.

    These days I don't see those as significant issues, tbh.

    I would prefer a Clojure program, but I'll take Java over Typescript at this point.

    • Sohcahtoa82 4 hours ago

      > it's verbose and boring to use.

      Python code that follows traditional Python paradigms is called "Pythonic".

      Java code that follows Java paradigms is called "awful".

      To be fully transparent, I've never written Java professionally, only for a couple small hobby projects 10 years ago, plus some while in school, so my opinion isn't worth the pixels you're reading it on, but I look at most Java code with abject horror.

      Endless levels of abstraction. The apparent inability to write a simple function and instead creating a "ThingDoer" class with a single function called "doThing". Run-time introspection and reflection EVERYWHERE. Stack traces that are just an endless stack of calls to functions like ".invoke" and ".run".

      I've been under the impression that all of that is a by-product of Java's strict type system, but someone please correct me. Why do Java paradigms seem so awful?

      • sorokod 3 hours ago

        It's a culture, not language thing. Here is a JSON parser implementation (part of PlantUML) that lacks endless levels of abstraction.

        https://github.com/plantuml/plantuml/blob/master/src/main/ja...

        • porridgeraisin 3 hours ago

          I'd argue culture solely defines the language.

          Is there a full library ecosystem of stuff written like the json parser you shared, which is as complete as the enterprisey library ecosystem? Similarly, SO answers? LLM output? Tutorials? YouTube videos?

          I think the answer is no.

          It's the same problem with C#. Just adding alternate paradigms means nothing. The only thing that matters is how a majority of code in the ecosystem is structured. In java, that's enterprisey code. Most code is glue code, so you're forced into the majority pattern, lest you want to write endless wrappers...

          On the other hand, while typescript supports a lot of the enterprisey nonsense similar to C#, the majority of the ecosystem is written with simple functions, callbacks and options objects. Not in an enterprisey way. I don't need to use decorators to use zod.

          People that eschew enterprisey code and prefer simple code can't switch to java or c# until the whole culture changes, regardless of the kitchen sink of features either language adds.

          • sorokod 2 hours ago

            I agree with most of what you are saying except for the "solely defines" bit. The culture is a powerful force but individuals are free to make choices and the language allows for these choices.

          • Mawr 2 hours ago

            Spot on. You can't separate a language from the speakers of it. You can't redo millions of hours of work put into an ecosystem.

      • kbolino 3 hours ago

        ThingDoer.doThing was often just functional programming squeezed into an object-oriented straightjacket. Java 8 added first-class functions and lambdas over a decade ago, eliminating a lot of the need to turn simple behavior into full-blown classes.

      • johnyzee 4 hours ago

        Those are not Java paradigms per se - they're just practices of mediocre enterprise developers, of which Java has many, owing to being such a mainstream platform.

        As for the language itself, a lot of verbosity has been culled in later language versions, with diamond operators, lambda expressions, local variable type inference, etc.

        In either case, code is read more than it is written, so if a bit of verbosity makes code easier to read, I'm okay with it.

      • cryptos 2 hours ago

        One reason for that Java style is that Java was not such a powerful language for a long time. For example lambda expressions were only introduced in Java 8 (2014) and before that developers need to work around this restriction. A common workaround were/are some annotations above of methods and some reflection magic on top. For example a life cycle callback method annotated with @PrePersist is basically the same a registering a _function_. The whole Lombok library is a massive hack to circumvent some inconveniences in Java (and in my opinion no longer needed).

      • lab14 2 hours ago

        I think it doesn't have to be like that, but it's the way Java code has been written for ages, so those habits stuck. You can see it clearly when you bring a Java programmer to collaborate on a Ruby or Python codebase, if you let them, the will turn your codebase into an enterprise-ready mess with layers on top of layers of indirection in a blink.

      • robmccoll 4 hours ago

        I think a lot of it is the people using it and certain parts of the culture. There are a lot of Enterprise TM programmers that seem to believe as many layers of abstraction and as much verbosity as possible with little tiny methods that do practically nothing leads to better solutions. It is totally possible to write concise and pragmatic code with Java. One thing that will be a thorn in your side though is null handling. The traditional approaches increase line count and branching. The newer(ish) Optional-based null handling is quite verbose but in width.

        • ifwinterco an hour ago

          In my opinion at this point null handling is the one remaining thing about Java that is genuinely bad technically

      • microflash 3 hours ago

        As someone who has seen awful code in pretty much every language I've worked with, I'd blame this more on inertia and reluctance to change habits. The bad patterns that have entrenched deep into the ecosystem are very hard to shed even when the language and platform is making progress at impressive speed.

      • cmrdporcupine 3 hours ago

        As others are saying, it's a culture not the language. C++ and even some Python etc written in the late 90s, 00s era has the same pattern-itis. It comes from slavish adherence to the Gang Of Four patterns books and an obsession with OO generally. Also the languages themselves were weak on non-OO abstractions and ways of doing code re-use, so for example it took forever for Java to get lambda expressions ... so people used one-off helper classes with "invoke" methods, etc.

      • lock1 2 hours ago

        As other sibling comments have said, it's cultural. Fortunately, there's some push toward functional & ADT-style modelling in the Java community and they've decided to call it "data-oriented programming" for some reason.

        Eh, I don't think Java type system is strict, nor is it the root cause of this cargo cult mess. It's probably due to many enterprise programmers who think design patterns are the building blocks of everything rather than an invisible, emergent structure.

bootman 6 hours ago

Java has been such an amazingly solid technological foundation... and for a long, long time! It may not be the most sexy language but it's been a stable one. We have applications created with Java 1.4 running happily on Java 21 LTS and expect to upgrade to this latest LTS (Java 25) soon. Java for the win!

  • ivanjermakov 5 hours ago

    I wonder where Java would be today without superb tooling and smart student programs from JetBrains.

    • pjmlp 4 hours ago

      Java has enjoyed powerful IDEs since late 1990's, some of them are even free beer!

    • Onewildgamer 2 hours ago

      Java was thriving during the golden age of Eclipse Foundation and IDE. JetBrains is very much recent.

      • stevoski an hour ago

        > JetBrains is very much recent.

        JetBrains is 25 years old, almost as old as Java.

        • szatkus 33 minutes ago

          IntelliJ use wasn't that widespread until about 10-15 years ago. Java was thriving before that.

  • ilt 5 hours ago

    Kind of tangential, I still remember Gmail app created in Java which used to run on my touch Symbian phone in 2009. It was cute as hell and got the work done.

  • freedomben 5 hours ago

    Neat, I wrote some swing apps back in the day that I've thought about resurrecting, but didn't want to have to do much modifying since they are mostly toys, though useful to me. I'm gonna give it a try!

    • ameliaquining 5 hours ago

      Is Swing good now? Usually when people say Java is good now I assume they're not talking about Swing.

      • whartung 5 hours ago

        Swing is swing, it's as good as it's always been (eye of the beholder). As I understand it, it hasn't completely rotted on the shelf, they've made updates to the rendering to better leverage modern hardware, but it's not a modern toolkit by any means. But it is maintained, it still works.

        JavaFX is good (I really like FX), and maintained, and portable. They just came out with 25 I think. But it's a completely different model than Swing.

        • ameliaquining 2 hours ago

          Sure, but the same might be said of the subset of Java that existed twenty years ago; this is different from what people mean when they say "Java's good now".

      • RyanHamilton 4 hours ago

        It's as great as it ever was. I like it as its very stable and has a good model of interaction but if you want a modern embeddable map or embeddable chart stick with web interfaces. If you do go with swing definitely check out flatlaf to make it look modern.

      • ako 2 hours ago

        I wrote a swing app a long time ago (20+ years ago) that was used in operating theaters to register organs for transplantation. Swing has saved many lives since. Swing has been good enough for a long time.

      • johnyzee 3 hours ago

        Your neighbor's dog barks at Swing.

      • freedomben 5 hours ago

        No, swing is pretty out of fashion if not deprecated. I know it pretty well, but still wouldn't choose it if starting a new project today.

        I'd use Qt, though if you're not comfortable with C++ I've been told JavaFX is pretty good

        • pjmlp 4 hours ago

          Swing is standard part of JDK, there is nothing deprecated, it even got a Metal backend.

        • dionian 5 hours ago

          ive tried javafx but its always easier to me to go back to swing, if it aint broke dont fix it.

  • dionian 5 hours ago

    The JVM and its ecosystem can be used from other languages too like Scala which has all the sexy stuff, also clojure et al

    • palata 4 hours ago

      And Kotlin!

miki123211 5 hours ago

(not a Java developer, no dog in this fight)

I'm not sure I like the module import system very much. I think `import *`-like constructions make code a bit easier to write, but much harder to read, especially for developers new to the language / codebase.

C# and Nim love that style, and it makes them almost unreadable without a good IDE.

Personally, I much prefer Python's "short aliases" style, e.g. `import torch.nn.functional as F`

  • pie_flavor an hour ago

    I have never understood complaints about language constructs that don't make sense without an IDE. You have an IDE, it is where you are viewing the code. People that don't have an IDE are causing their own problems and should stop. People viewing the code on GitHub are not really analyzing it at the level that requires finely tracing through references usually and the terseness drastically outweighs the occasional annoyance when you are.

  • bob1029 2 hours ago

    > C# and Nim love that style, and it makes them almost unreadable without a good IDE.

    I think a lot of what turns people off to the C# developer experience is not using full-blown Visual Studio. VSCode is great but I would never open csproj or sln files using it unless I needed to manually edit their actual XML contents.

    It's not broadly advertised that you can buy a perpetual & fully licensed copy for $500 [0]. No subscription or other cloudy scam stuff is required, although Microsoft's product pages will initially lead you to believe it is.

    [0] https://www.microsoft.com/en-us/d/visual-studio-professional...

  • deepsun 3 hours ago

    In large codebases the main problem with imports is "where that thing comes from" -- you really want explicit imports. Especially if something broke in build and you're not sure you have correct versions of dependencies (what dependency that name came from).

    In small codebases anything would work.

    PS: why do you even look at imports? Any decent editor just hides it, you never need it, you navigate just by clicking/hotkeys on names directly from code.

  • samus 3 hours ago

    AFAIK it's mostly intended to make writing single source file programs easier.

  • dionian 5 hours ago

    so module imports looks to be different from normal imports and actually helps reduce the number of imports the developer needs to write. FWIW Scala (which runs on java) does have import renaming and also type aliases which can do what you mentioned.

BlindEyeHalo 6 hours ago

Crazy that it took this long to allow parameter validation and transformation before calling super in the constructor.

That was something that always bothered me because it felt so counterintuitive.

  • PaulHoule 5 hours ago

    I've been programming in Java since before JDK 1.0 and that was one misfeature that bothered me then but that I've long since learned to work around.

  • delusional 6 hours ago

    Especially because you were always able to bypass it by declaring a `static` function and calling that as part of the parameters to `super`:

    public Foo(int x) { super(validate(x)); }

    validate would run before super, even though super was technically the first statement in the constructor, and the compiler was happy.

    • mystifyingpoi 4 hours ago

      This is such a funny workaround, I like that. But it doesn't matter in any library or your own code, since factory methods are much better (simply because they have names).

mkurz 8 hours ago

New Features: https://openjdk.org/projects/jdk/25/

Java 25 is an LTS release.

  • theflyinghorse 5 hours ago

    Can't wait to have a job migrating an application from 17 to java 25 in 10 years!

    • gunnarmorling 5 hours ago

      I wouldn't expect migrating from 17 to 25 to be an awful lot of work. The hard bump was moving from Java 8 to 9+ (11, typically), due to the introduction of the module system, removal of APIs previously shipped with the JDK (e.g. JAXB), etc. Things get much easier once you've passed this hurdle. Adopting 17 posed another, usually smaller, challenge due to reflection not working OOTB like before, but I'm not aware of other, equally disruptive changes after 17.

      • david38 5 hours ago

        Except he didn’t say “for ten years” but “in ten years” referring to the extreme length of time companies take to upgrade

    • vips7L 4 hours ago

      Already doing the work to move my team to 25 and it's been out for a day.

      • p2detar 2 hours ago

        I'm doing that in 2 weeks. The next major version of our product will require 25.

        edit: I wrote "require" when I meant "ship with". We ship a Temurin JRE together with our product, so it's being updated with each new installation.

        • vips7L 2 hours ago

          Nice! It really isn’t hard to stay on top of it imo. The only thing stopping anyone from upgrading is their own company culture at this point.

mrsilencedogood 7 hours ago

Damn, still not structured concurrency full release. Really looking forward to that one.

Happy to see Scoped Values here though. That'll be big for writing what I'll call "rails-like" things in Java without it just being a big "static final" soup in a god-class, or having a god object passed around everywhere.

  • pjmlp 6 hours ago

    Much better this way with previews, than the mess C++ is having nowadays with standardising features without implementations.

  • jayd16 6 hours ago

    I hope structured concurrency ends up feeling better than async/await with less sugar. The examples do not instill confidence, but we shall see.

    • dwaite 4 hours ago

      The structured part is somewhat like using for and while loops rather than goto statements - it uses block scope to make it easier to reason about how concurrent code is compartmentalized.

      However, you still have concurrent code. The example given uses futures rather than async/await, and so the thread blocks waiting for these other threads to complete.

      The Java alternative to async/await is the virtual threads. Since they are not GC roots and the stack is a chain of heap-allocated objects, the idea is that they can have significantly lower overhead in terms of memory usage for small tasks. Rather than the compiler generating heap objects to store intermediate state, it just uses a virtual thread's stack.

      However, even without async/await syntax you still have equivalent concepts. Since the compiler doesn't have native structured concurrency, it is emulated by putting tasks in lambdas. You fork off subtasks, and do a blocking get() to resolve the futures for their results. Heavy use of fork(), run() and get() aren't necessarily better than async and await keywords.

      One concern I have is that Java virtual threads are supposedly preemptive, not cooperative. This means you will have less guarantees around concurrent modification than you would with a typical async/await system running cooperatively on an executor. Several languages willing to make more core changes around adding async/await have gone as far as to also integrate actor functionality to help developers write concurrency-safe code. I don't see Java being able to provide developer help/diagnostics here like other languages can.

    • pjmlp 6 hours ago

      Unfortunately on .NET side, TPL Dataflow doesn't get enough love.

      • jayd16 6 hours ago

        They added an async Channel and its actually pretty nice to work with, at least.

      • colonCapitalDee 4 hours ago

        Agreed. This is how I feel using it: https://xkcd.com/297/. It's from 2012! I hadn't even written my first `public static void main(string[] args)` then.

        My favorite parts of TPL Dataflow are using Channels + Encapsulate to create custom blocks, backpressure, and parallel execution while maintaining ordering. Great library. I sometimes wonder if it would be possible/useful to implement a TPL Dataflow 2.0 on top of Channels.

    • dionian 6 hours ago

      I would be shocked if they came up with something that made me want to move away from ZIO.

thewisenerd 5 hours ago

recently pulled the trigger on a migration out of jdk8

we decided to bite the bullet and do 21 instead of 17; one of the reasons being 25 being just around the corner.

as far as i can tell, the biggest hurdle is 8 to 11 (with the new modules system); but it's smooth sailing from there. the proof-of-concept was done with jdk17, but it worked as-is with jdk21 (except guice which needed a major version bump).

(of course being with a jvm language instead of java itself also probably helped)

  • MBCook 4 hours ago

    For us 8 to 17 was tough due to a lot of things you weren’t supposed to be using going away (sun packages). But TONS of libraries did it anyway. And the move from javax to jakarta for a lot of things in there was also tough.

    If you could get through that, you’re golden. From what I’ve seen going to 21 or 25 look easy. They’re just adding features, the big upheavals of doing the long needed cleanup are over.

    I expect keeping up to date to be far easier from now on.

    • cesarb 4 hours ago

      > For us 8 to 17 was tough due to a lot of things you weren’t supposed to be using going away (sun packages). But TONS of libraries did it anyway.

      AFAIK, these libraries did so because there was no alternative, and some of the changes in Java 9 and later were done to provide them with an alternative. The only thing left is Signal/SignalHandler, which AFAIK still has no alternative outside the sun.* packages.

    • samus 3 hours ago

      The move from javax to jakarta was not really connected to the changes in the language. It is very much recommended to not do these upgrades simultaneously.

  • pjmlp 4 hours ago

    Yeah, Java 9 was the Python 3 moment of the ecosystem, however it has been sorted out for ages.

    • samus 3 hours ago

      Not comparable; Python 3 changed the source language. While for most programs complying with standard Java nothing had to be changed at all.

      • pjmlp 3 hours ago

        Yes it was, your Java 8 code won't compile in Java 9, if using anything that was removed or blocked due to the modules changes, library and runtime are part of the language.

        A programming language isn't only grammar and semantics.

palata 4 hours ago

My feeling (which is worth what it is worth) is that Java as an old language has been improving over the last 10 years, whereas C++ has gotten worse.

112233 6 hours ago

What is the current situation of using Java (from legal standpoint)? In open source and in commercial setting? Oracle has a lot of fantastic technology locked up in Java (things like Truffle), how reasonable it is for new projects?

  • jeroenhd 4 hours ago

    OpenJDK is pretty much open and straight from Oracle.

    If you don't like Oracle (and I wouldn't blame you), there are alternatives from parties ranging from the Eclipse Foundation to Microsoft and Amazon that will do the same thing.

    As for new projects, Java is here to stay. It's longevity is part of why companies are still using Java 8/11; once you write it, it'll run pretty much forever.

    The language lags behind in terms of features compared to pretty much any competitor, but it's functional enough to get anything important done.

    I'd personally go Kotlin if you were to rely on the JVM (almost entirely because Java still lacks nullable types which means nullpointerexceptions are _everywhere_) or C# if you don't like the Kotlin syntax, but Java is Good Enough.

  • whartung 5 hours ago

    The only real nut right now is, if you're using the Oracle distributions, only the latest LTS is, essentially, free to do anything with.

    Older releases are under their OTN license, which is only for personal and development, but not production.

    Again, this only matters if you want an Oracle sticker on your runtime, OpenJDK and the other projects are full boat "do whateva" JDKs.

  • exabrial 6 hours ago

    There is literally 0 worry. OpenJDK is fully open source.

  • piva00 6 hours ago

    Use OpenJDK (or similar) and you are free from any Oracle shenanigans.

    • ffsm8 6 hours ago

      I don't disagree (it is gpl licenced after all)- but it's worth keeping in mind that openjdk is still provided by oracle, too.

      And all the other variants ultimately just repackage it. So if oracle doesn't care about destroying the Java IP, it definitely could cut everyone off from updates going forward.

      I don't think they'll do so however, MySQL is still freely usable too, right? And that's oracle IP too.

      Might change if they ever get into financial troubles, but that's the same issue with all languages and frameworks.

      • thuridas 5 hours ago

        And there is Amazon Correcto, Eclipse Temurin...

        Sure, that could stop to maintain it, but would put the power immediately in the hands of other companies with a fork

        That said, you always have oracle's greediness...

        • giancarlostoro 5 hours ago

          > Sure, that could stop to maintain it, but would put the power immediately in the hands of other companies with a fork

          I have a feeling all those companies / orgs would band together to maintain it.

      • miki123211 5 hours ago

        Honestly, Java is one of those technologies I would never worry about in this way.

        It is used everywhere. Just among the faang companies, Apple, Amazon, Netflix and Google definitely use it at scale, and they're just the tip of the iceberg. Taking away JVM updates would almost be a company-ending event for them, and they definitely have the resources to keep it alive if Oracle ever dies.

  • deepsun 5 hours ago

    It's only a consideration if you are going to write your own Java implementation and distribute it.

suyash 4 hours ago

Nice to see "Vector API (Tenth Incubator)" - it should open possibility of doing low level vector maths much needed by machine learning toolkit in Java.

  • samus 3 hours ago

    It's not that new though. It will probably only be frozen once value types arrive.

alwahi 4 hours ago

i think its time for some of the enterprise customers to maybe consider upgrading to java9?

fnord77 3 hours ago

It's a damn shame that project Valhalla still isn't finished. This would fix so much and open up java for better matrix math support

  • samus 3 hours ago

    Project Valhalla is too big to land in just one release. Even if all changes to surface language and the JVM land, it's just the beginning for adding new optimizations.

  • joe_mwangi 3 hours ago

    It was submitted recently 2 weeks ago hence we might see something in future releases too.

alwahi 4 hours ago

i think some of the enterprise users should maybe consider upgrading to java9?