10 ms·
Serious question: when should one use Java for greenfield projects in 2026?
by Horffupolde 17d ago
Serious question: when should one use Java for greenfield projects in 2026?
- kllrnohj 17d agoWhen you think a garbage collected language is a good fit for whatever you're building?
- kfir 17d agoWouldn't you go with golang in that case?
- topbanana 17d agoI would, or C#
- ndriscoll 17d agoGolang gives you none of nice features of a modern language while being about the same performance tier as Scala or Java, so there's basically no reason not to use Scala.
- eklavya 17d agoI ported a moderate sized java project to golang. Test suite runs order of magnitude faster now. There isn't much change in terms of the architecture. Pretty much the same algos and data structures. The whole dev tooling runs on a 16 gb mac without swapping now. I used vs code for both
- ndriscoll 17d agoIME they're both in a place where Rust is maybe ~40% faster for a decent CRUD web application server, but with go you need to write much lower level code to get there (e.g. using composable generic iterators will ruin your allocations, so it's all manual for loops). You can write idiomatic high level Scala and get the same performance. Which could be as simple as the go compiler offers no ability to force inlining and has way too low of a complexity threshold, but that basically makes reusable code unusable in high performance situations. The whole go team's philosophy tends to also revolve around assuming their users don't know what they're doing, which is annoying. Like an inline keyword: thinking you know better than me doesn't mean I'm not going to inline it; it means I'm going to manually write it inline myself in the code, and then think the language sucks because it's tedious, error-prone, and verbose. Or they tend to mark lots of stuff private for no reason, and e.g. with TLS 1.3 they just ignore your config because they think they know better, etc.
- jeffbee 17d agoIsn't this mostly about java cold start costs? It might be that other people are optimizing for steady-state performance, not transient startup performance.
- eklavya 16d agoOne particular test was running for 20 minutes, doing repetitive calculations, hopefully enough to get jitted. It finishes much much faster now. I could have profiled to check what was going on but the test was simple and the dev tooling and the ram usage was a major concern for me. Also gradle upgrades were painful. Java tooling taking up a lot of ram was a major motivation for me. I have done a lot of Scala as well. I don't think either Java or Scala in the real world beat go on performance for most cases. I don't doubt that in some cases jvm can do better but at least before Valhalla delivers all the promises, in real world, I am doubtful. I have been a Java/Scala user almost for the majority of my career. I doubt I would pick jvm over golang going forward though. Also not having to deal with OOP is a plus.
- gf000 16d agoSo you compare the build tool of A and B on a short-lived job type where java is knowingly not its strongest? How is that a meaningful comparison?
- eklavya 16d agoI am not sure I understand your point. It's a meaningful comparison based on my situation. But even if it isn't, what are you arguing for? I change my use case rather than the tool/lang? Sorry if I misunderstood.
- Thaxll 17d agoGolang is faster and use way less memory than Java, never wonder why you never see Kubernetes controller / sidecar is Java? As for Scala it's pretty much a dead language, no one work with it and it's impossible to find dev for it. 10 years ago I was moving Scala code back to regular Java.
- deleted 17d ago[deleted]
- weego 17d agoIt's sad - I spent a good 12 years writing Scala every day and it was the ideal language for my brain. Until it wasn't - sbt got too complex for it's own good, everything became "very smart" developers over-using implicit conversions, you couldn't find a project that wasn't an opinion war on cats vs whatever. It collapsed on the weight of it's own smugness. go and kotlin aren't it, gleam scratches the itch but I can't justify writing code that would impossible to hire for. scala situation is a real shame.
- ndriscoll 17d agoEvery job I've has has used different languages so I don't really understand the need to find a dev for a specific language. I went from network firmware in C to banking application servers in Scala and it took like 2 weeks to ramp up. Not a big deal. Now I write lower level networking stuff again in Go, which seems like its just worse than e.g. C-with-templates (and occasional classes) style C++ so I don't really understand why people like it. I think it used to be common to just look for smart people and assume they can run with whatever stack. Wasn't that the point of abstract algorithm questions etc. (basically an IQ test)?
- logicchains 17d ago>I think it used to be common to just look for smart people and assume they can run with whatever stack. Wasn't that the point of abstract algorithm questions etc. (basically an IQ test)? Lots of companies where software isn't the focus see it as a cost center, so they'd prefer to hire lower-IQ specialists instead of higher-IQ generalists, because the latter are more expensive/have more options.
- davidee 17d agoThis made me chuckle. Aside: Scala dev here - but I only talk about how wonderful it is with people I trust (mostly Go and Rust developers I used to work with). Also, Scala Native means I don’t always have to worry about the JVM depending on the use case. ScalaJS is fun too.
- pron 17d agoYou could, but it's not as fast as Java, especially under heavy workloads, its telemetry is nowhere near as good, and it's much less popular.
- mahboi 17d agoIt's unsafe in many applications due to not having exceptions
- dorkypunk 17d agoWhen you are already familiar with it or work in a Java shop, there are better options if you are starting from scratch, but if you already have 50 guys that know Java it's a pretty big ask for all of them to switch.
- doublepg23 17d agoWhy not Kotlin?
- dorkypunk 17d agoMost organizations that use Java tend to be pretty conservative with their technology picks and nowadays with newer Java versions the only real gap with Kotlin is null-safety which is supposed to also come to Java at some point. There is also an organization culture component most of the time, one our engineers actually proposed to use Kotlin for one of the new projects but it got rejected because "We are a Java shop"
- doublepg23 17d agoAre you guys keeping up with the Java LTS releases?
- unscaled 16d ago> Most organizations that use Java tend to be pretty conservative with their technology picks That part i s true. > with newer Java versions the only real gap with Kotlin is null-safety But that part isn't. Kotlin has: - Structured Concurrency: Coming to Java sometime in the future, but it's been in preview for very long now. - Standalone functions that don't have to live in classes - Properties - Property delegation - Data classes: more powerful than records. Can be used for large DTOs that you can modify with copy(). Java needs something like Lombok to make records more useful. - Extension methods - Context parameters - Operator overloading - Implementation delegation - Inline functions (which can receive returning closures and reified types) - Block syntax (supports `it` for unnamed arguments) - Sequence abstractions: more powerful and more efficient than Java streams due to the inlining and block syntax. This is just a partial list, but Kotlin clearly has a lot of things that Java doesn't. If you only personally care about NPEs that's fine, but that's not the only thing.
- orangesilk 17d agoJruby is nice - runs Ruby on a Java Virtual Machine with full concurrency and Ahead Of Time compilation
- topbanana 17d agoWhen you work at a Java shop. Kotlin is much nicer if you have to run on the JVM but aren't restricted to Java.
- mahboi 17d agoI don't understand the point of Kotlin anymore, now that Java has virtual threads and other stuff.
- joe_mwangi 17d agoOnce it gets nullness types, hackernews is gonna explode!
- mahboi 16d agoWait is this why people keep complaining about NPE? Is the nullness type thing a dog whistle for Kotlin? lol
- joe_mwangi 16d agoYes.. lol. The biggest argument now is Kotlin having nullness by default in the language. Just check around the comment section. Now java is planning to have them which will further help jvm to optimise for performance. Not sure what the next argument will be after.
- t0mas88 17d agoWhen building boring web applications with a sizeable team that need to run for a long time. Hiring developers is easy since there are many, there is nearly no magic and the language is quite strict and type safe so it works well with a large team. And that "team" nowadays may also consist of many AI agents. In my experience Claude Code for example works very well with a typed, slightly boring language with lots of framework and library support. Because it doesn't compile when you get something wrong, instead of getting a vague runtime issue that Claude can't always see.
- BoppreH 17d ago> there is nearly no magic I agree with the rest, but there's definitely a lot of magic in Java. This is from both what features the languages makes available (many) and how the community uses them (often). I've had so many hard-to-debug issues in Java over the years due to reflection, annotations, and bytecode manipulation shenanigans. And another positive point for Java: checked exceptions. It's verbose, but knowing exactly in which ways a function can fail is extremely helpful for building robust applications.
- msluyter 17d agoI haven't really been in the java space for a while now, but I recall there being a fair bit of criticism[1][2] of checked exceptions over the years. [1] https://www.javacodegeeks.com/2026/01/javas-checked-exceptions-the-20-year-experiment-that-failed.html https://www.javacodegeeks.com/2026/01/javas-checked-exceptio... [2] https://reflectoring.io/do-not-use-checked-exceptions/ https://reflectoring.io/do-not-use-checked-exceptions/ WRT magic, I've generally thought that was a result of frameworks - Spring, for example. In the past, my feeling was that these impose a sort of meta/configuration language that itself is not checkable at compile time, so you'd get weird runtime errors that are somewhat inexplicable. This was like... 2018 though, so perhaps things have improved.
- voidfunc 17d agoChecked exceptions are controversial mostly because a lot of the core APIs use them in places where it's pointless to check, like IOException. Using them correctly can be great tho.
- deleted 17d ago[deleted]
- marginalia_nu 17d agoNot at all a bad choice. It's stable to the point of boring, and there's no shortage of people who know the language and can work with it, it's got best in class tooling, decades worth of libraries almost all very mature. Most of the language's issues are from legacy code bases coded in a style that isn't really relevant to a greenfield project.
- gentlewater 17d agoIt’s still missing null safety, right? Which means it’s still a hard no for me.
- marginalia_nu 17d agoHave you tried not returning null or constructing incomplete objects?
- gentlewater 17d agoCan I trust code I’ve written myself with no guarantees from the language? Maybe. Can I trust code written by dozens of other developers (and/or agents) working on the same project over multiple years? Definitely not.
- marginalia_nu 17d agoWhy don't you have any coding standards? If you're working with agents in particular, catching and enforcing this stuff should be easier than ever.
- saghm 17d agoMost engineers do not have the ability to impose rules by fiat on all of their coworkers. It seems like you're misunderstanding the nature of working on a codebase as an IC when other developers contribute to it. If all of my coworkers don't want a lint rule I propose, I don't get to add it. If all of my other coworkers want to write code in a certain way and approve each other's MRs with code written in that way, I don't get to veto it.
- foolfoolz 17d agojava is a great language for server side projects. it is actively maintained, the biggest issues with it have JEPs, and it’s very friendly to AI authors
- soco 17d agoWhoever works with, or chooses Java, is not doing it for the language itself, be it beautiful or not. Java has a huge ecosystem, from battle tested integrations to optimized images to build pipelines to whatever, so at the same you're buying access to all this world (yes, more than an environment). And of course transferable skills. I'm not saying Java is alone offering this, also not saying every feature is the best, but you can have them all, and even choose from different options.
- marcosdumay 17d agoJava's ecosystem is lingering since Oracle brought the language, and it's at the point where you should really look if the things you want to use are still in the state of the art, or if they felt behind every other language. And if you are starting from scratch, whatever part of the ecosystem you use, I'm not optimist on its situation improving with time.
- za3faran 16d agoIt hasn't been lingering since they were bought by Oracle. We've seen a rapid increase in the pace of feature and performance development.
- rzmmm 17d agoI use Java for hobby projects, I think it's design choices make it a nice minimalist language for "classic OOP" style: dynamic dispatch, encapsulation etc. Nowadays a lot of code is written with mostly procedural style with some functional characteristics, I wouldn't use Java for that.
- skeletal88 17d agoSame question for .net or C# Why should anyone use it over Java? Ms is hostile towards its developers, it creates new versions of things, deprecates previous versions, uses confusing naming for newer versions.. etc.
- hirvi74 17d agoBecause your employer is dick-deep in Microsoft psychosis. I've been a .NET dev for a decade now. It's perfectly serviceable, but I wouldn't say I truly love the language anymore, but I would take it over Java any day. Entity Framework and LINQ are gifts from the Gods. I have never used an ORM that even comes remotely close. Also, C# is big in the gaming world. I am working on a game right now, and I was not impressed with what many other languages had to offer. It seems like the kings are still C(++) and C#. Of course, Java can create games, but I would argue that is a "could vs. should" kind of decision. Unity, Godot, Monogame, Raylib, XNA, FNA, etc. all can use or rely on C#. I have not seen Java be compatible with any of those -- except maybe Raylib? I do not know of anyone nor any games that use it though.
- cromka 16d agoASP.Net Core is also a pretty good alternative to the ubiquitous nodejs? Especially wherever multi threading is required.
- bitgeist 17d agoMicrosoft has come a long way since Satya Nadella took over in early 2014. The open-sourcing of .NET Core that same year was a huge step forward. Seeing a 'Microsoft Loves Linux' slide that year was something I did not have on my bingo card. VS Code and the GitHub acquisition demonstrated Microsoft's interest in fostering good relations with developers instead of alienating them. I do wish GitHub had stayed independent, though. Microsoft is a business and will always put their business objectives first. In my opinion, they have a non-zero amount of evilness. I do not support them jamming Copilot into every available crevice. I still think they make dumb choices, like every imperfect organization. However, C# is a powerful and intuitive language, and for Microsoft shops that already run a lot of Windows and SQL Server it makes a lot of sense. No shade to the JVM. I've mostly enjoyed my time in that space. I do believe the choice between Java and Kotlin, the wide variety of vendor JDK distributions and IDE fragmentation make the JVM stack a bit more difficult for newcomers to break into.
- rwyinuse 17d agoJava & Spring is a good choice whenever you want your application to work and be maintainable 10 years from now, without having to replace the framework and half of the libraries you used. I see few good reasons to ever use something with unstable ecosystem (like Javascript with NodeJS) over Java these days.
- ulimn 17d agoNot just the time, but the environment, the OS as well. Where you can run JVM, there's a pretty good chance you can run your app.
- cavoirom 17d agoIf your app requires a specific JDK version and your OS wont support, you can run that JDK version in a modern JVM: https://www.graalvm.org/latest/reference-manual/espresso/ https://www.graalvm.org/latest/reference-manual/espresso/
- samus 16d agoThat's important since this capability has been removed from OpenJDK a long time ago.
- jjice 17d agoStability is a good point, although I am curious where JS and Node stand there now. They're not at the level of Java or .NET by any means, but the JS ecosystem has definitely begun to slowdown over the last few years. I've used express for the server and winston for logging for years and years now and they've very stable at this point. I guess I'm asking this as an open question: Where are we in the "move fast vs stable" spectrum with Node these days? Definitely not rock solid, but it's moving in that direction I feel.
- eranation 17d agoI wrote about it 13 years ago, some of it still stands true. https://news.ycombinator.com/item?id=5857495 https://news.ycombinator.com/item?id=5857495
- pron 17d agoThese days, Java is mostly used in greenfield software that has to be very reliable, very performant, and last for many years. So it's often the first choice for banking, telecom, finance, government, defence, manufacturing control, logistics and shipping, media streaming, retail, hospitality, healthcare etc.. It's usually not a first pick for more exciting software, such as Python type checkers, JS bundlers, or TUI file managers.
- astrodust 17d agoWhy not Go, Rust, or C#?
- pron 17d agoThey lack in performance, stability (compatibility), observability (telemetry), productivity, or some combination thereof. They are chosen, of course (especially C#; Go and Rust are far behind), but not as much as Java.
- brabel 17d agoI think you have a biased view. The number of stuff written in Rust in the last couple of years has absolutely exploded. For example, I see a lot of projects now that provide SDKs in Rust but don’t bother with Java. And I say this as someone who still writes most of my code ( or tell my LLM to write) in Java.
- pron 17d agoThere's a difference between number of programs and number of LOC (the latter is related to the number of people involved). I am not aware of any SDK targeting the industries I mentioned that "doesn't bother with Java". It's not only a popular choice in those industries, it's not only among the top choices, but it's the top choice by a large margin. Look at wanted ads in those industries to see that. Overall, there are only two languages as popular as Java or more, and they are JS and Python: https://www.devjobsscanner.com/blog/top-8-most-demanded-programming-languages/ https://www.devjobsscanner.com/blog/top-8-most-demanded-prog...
- pjc50 17d agoJavaFX is fairly high up for "I want to run the same UI on Mac and Windows, and I don't want it to be an Electron web app in a box".
- whartung 17d agoJavaFX is a hidden gem. I really like the programming model with its binding and scene graph and CSS. It's not as portable as Swing, as it has some platform specific binary components to it. But it works fine on mainstream platforms. For me Swing portability is not worth giving up the FX model. Just be aware that if you happen to bundle in the Web view component, you're basically adding WebKit to your distribution. I did this with a small project because I wanted to have a "help" screen with Markdown -> HTML. Easy, but "expensive". It simply adds a big chunk (10-20Mb) to your distribution. (Now I have a very crude Markdown renderer for this task, which is a 100 lines code, and I'm working on a better one -- but I have yet to pull the trigger on the latest FX with its new Rich Text component, which could change everything.) One hot tip with cross platform FX, however. Embed your fonts. The font suite is not common across the distributions, and the CSS does not honor the font fall back (i.e. if not XXX font, then YYY font), so if the runtime doesn't have your specific font, it collapses to the System font. So, embedding the fonts you use helps a lot with cross platform stability. Plenty of free fonts, I have not had a real problem with this. But it can be one of those O.o moments when you test on other platforms and encounter it the first time.
- nonethewiser 17d agoHere is a niche one: When you want to make a game and support modding with pretty much zero development effort.
- pie_flavor 17d agoJava-the-language blows, but Kotlin does not, and Java-the-platform is on the Pareto frontier of oldest-yet-most-usable open-source ecosystems. I prefer Rust, and the gaps where it doesn't apply, C# fits my use cases better, but Kotlin/JVM is a rock solid development platform.
- hobo123 17d agoI once tried Kotlin for a pet project, but after a while switched it back to Java, since it's good enough, IDE support is better, it's much faster. I guess if you use/like Intellij it's ok.
- DanielHB 17d agoJava and C# seem to be the best ways of making code-first OpenAPI based servers. C# LINQ also seem to be the best compromise between ORM and raw SQL queries, although I never used it myself. I have been severely disappointed in all similar solutions for Go at least and I imagine Rust does not have something better given it has a smaller community-base. Python and NodeJS have some very neat solutions for this stuff too, but both are "slow" dynamic languages. I personally dislike python with a passion and NodeJS stuff is extremely community-driven and therefor often unreliable. Prisma (NodeJS ORM) for example just did a major overhaul and is now pushing a completely different API. If you are making boring REST API to SQL Database it seems like Java and C# are the best options.
- CharlieDigital 16d agoC# gRPC story is really, really good, too.
- mikert89 17d agoWhen you’ll have tons of low skilled devs contributing to an important but boring application that will last a while
- chasd00 17d agoIt's a stable known stack. It's not hard to find Java developers and the AI Agents are probably pretty good at writing Java too. A Java backend will just sit there and do its job happily forever and you can bolt on whatever front-end you want. Spring Boot has been kind of the standard way to do Java web applications for probably a decade if not longer. It works fine has all the bells and whistles when you're ready for them and most Java developers who work on the web know Spring already. As for an individual developer doing a side project, you should use Java if you haven't used it before to get exposure to it. It's a fundamental component of enterprise software and if you've never used it before take the time to learn something new.
- exabrial 17d agoroughly 100% of the time
- DarkNova6 17d agoYeah. Why use a statically typed reliable language with a good ecosystem if I can also vibecode in Python.
- mands 17d agoGood question - am using for a greenfield AI startup in SF. Been a great decision so far: great ecosystem, bulletproof runtime, fantastic performance and new quality features arriving on a steady schedule. "Boring technology" at its finest. At the risk of a shameless plug - blogged about it recently at https://mandeepgill.net/2026/08/31/java-for-an-ai-startup/ https://mandeepgill.net/2026/08/31/java-for-an-ai-startup/
- stickfigure 17d agoOften? It's a relatively modern language with enough functional programming features to keep mid-high blub programmers happy. Yeah there's cruft; all mature languages have cruft. Kotlin is the obvious replacement, but the tooling isn't as good and the community isn't as large. Java keeps getting better, and in ways that diverge from Kotlin - eg, virtual threads vs async/await/coloring. From the perspective of language design, I prefer Kotlin. But I keep picking Java anyway, and I don't see that changing soon. Go is openly hostile to functional programming. Dynamic languages aren't even in the running. Rust is too low-level for line-of-business software. C# is too Microsoft. The remaining alternatives are too obscure.
- deleted 17d ago[deleted]
- mahboi 17d agoIt's decent for backends. I'd rather use JS, but there can be performance or ecosystem reasons to use Java. They fixed a lot of the gaps it had. JS used to have a big edge in async-await while Go had n-m multithreading, but now Java has the latter.
- ivan_gammel 16d agoanecdotal evidence: I‘m working on a product in circular economy space at the moment (chemical trader). I chose Java because it just works and allows us to focus on business, no npm supply chain drama, no „how can I integrate my go microservice with a customer SOAP endpoint“ problem, time to hire under 2 months etc.
- dwaite 16d agoJava is still excellent when you need to have software that ships and gets integrated into a customer's environment, or need to support a diverse set of such integrations yourself.