/r/java

Photograph via snooOG

News, Technical discussions, research papers and assorted things of interest related to the Java programming language

NO programming help, NO learning Java related questions, NO installing or downloading Java questions, NO JVM languages - Exclusively Java

Submit Text

Seek Programming Help

News, Technical discussions, research papers and assorted things of interest related to the Java programming language

NO programming help, NO learning Java related questions, NO installing or downloading Java questions, NO JVM languages - Exclusively Java

These have separate subreddits - see below.

Please seek help with Java programming in /r/Javahelp!

Subreddit rules!

Upvote good content, downvote spam, don't pollute the discussion with things that should be settled in the vote count.

  • Do not post tutorials here! These should go in /r/learnjava.
  • No programming help questions here! These should be posted in /r/javahelp
  • No surveys, no job offers! Such content will be removed without warning.

Join us on IRC
freenode.net #reddit-java

Where should I download Java?

With the introduction of the new release cadence, many have asked where they should download Java, and if it is still free. To be clear, YES β€” Java is still free.

If you would like to download Java for free, you can get OpenJDK builds from the following vendors, among others:

Adoptium (formerly AdoptOpenJDK)
RedHat
Azul
Amazon
SAP
Liberica JDK
Dragonwell JDK
GraalVM (High performance JIT)
Oracle
Microsoft

Some vendors will be supporting releases for longer than six months. If you have any questions, please do not hesitate to ask them!

Related Sub-reddits:

Programming
Computer Science

CS Career Questions

Learn Programming
Java Help ← Seek help here
Learn Java
Java Conference Videos
Java TIL
Java Examples
JavaFX
Oracle

JVM Languages

Clojure
Scala
Groovy
ColdFusion
Kotlin

Want to practice your coding?

DailyProgrammer
ProgrammingPrompts
ProgramBattles

List of useful Frameworks / Libraries / Software

Awesome Java (GIT)
Java Design Patterns

/r/java

323,081 Subscribers

2 Comments
2024/03/28
12:32 UTC

50

Are modern monoliths really that dead?

https://preview.redd.it/kvxtszz1f2rc1.png?width=695&format=png&auto=webp&s=b179c183935ac8dd6457ee3c0d51a04486970e8b

I recently saw a tweet that caught my eye.
Now, I get the frustration.

Monoliths can be cumbersome, especially as projects grow. But throwing the baby out with the bathwater? Maybe not so fast.

I believe that modern monoliths can work, especially for certain types of projects. They offer advantages like tight integration, faster development cycles, and easier data sharing.

The key is understanding the trade-offs and using the right tools.

What do you think? Are modern monoliths a relic of the past, or is there still a place for them?

86 Comments
2024/03/28
12:04 UTC

13

Microsoft RulesEngine

I currently have an application that uses Microsoft's RulesEngine where the rules are hosted as JSON in an external service so that rules can be changed without the need for a code change. I am re-writing the application in Java and wondering if anyone with Java experience has a suggestion for a very similar rules engine that supports JSON. I've looked over a couple and Drool seems like the best candidate, but also quite complex to configure it for my needs.

I know rules engines are quite common, but I really need one that can parse the expressions from JSON. If anyone has any suggestions, I'd really appreciate it!

12 Comments
2024/03/27
20:58 UTC

53

Release of Minum v3.0.0 - now at nearly 100% mutation test coverage

Minum on GitHub

Minum is a minimalist web framework written in Java, developed over five years by a TDD practitioner of fourteen years experience. Provides an all-in-one foundation for a highly-maintainable single binary web application. For TDD, by TDD.

  • Has its own web server, endpoint routing, logging, templating engine, html parser, assertions framework, and database
  • Has nearly 100% test coverage that runs in 30 seconds and does not require any special setup (make test_coverage)
  • Has nearly 100% mutation test coverage, using the PiTest tool. (make mutation_test)
  • Relies on no dependencies other than the Java 21 SDK - No Netty, Jetty, Tomcat, Log4j, Hibernate, MySql, etc.
  • Written from scratch
  • Well-documented throughout
  • Cleverness avoided* where possible
  • No reflection
  • No annotations
  • Uses no mocking framework - integration tests preferred, occasional use of simple interface mocks.
  • Has examples of framework use:

This framework enables high-maintainability through minimalism and simplicity. Developers using this framework will achieve the most benefit if they are of a similar mindset. Frameworks like Spring, which provide capabilities as large blocks with high guardrails, offer a different paradigm.

FAQ:

  • Are you saying we shouldn't be using Spring?

No, I am not saying that. However, there is need for a minimalist web framework. You can build a fully-functioning web application with high sophistication with either Spring or Minum, but Minum is five thousand lines of code and Spring is a million. For quality-oriented long-view practitioners, the benefits of minimalism outweigh its drawbacks.

  • Yet another minimalistic framework? Why??

This is a misunderstanding - Minum is five thousand lines of code - the "minimalist" competitors range from 400,000 to 700,000 lines when accounting for their dependencies. I have not found a similar project.

  • What is the point of minimalism?

Easier debugging, maintainability, lower overall cost. Most frameworks trade faster start-up for a higher overall cost. If you need sustainable quality, the software must be well-tested and documented from the onset.

  • Why not just use Java's built-in httpserver?
    • httpserver is larger and more complex, consisting of 6000 lines versus Minum's 1800.
    • There are no easily-available fast and thorough tests on httpserver, ruling out fearless refactoring.
    • There are examples of sophisticated web applications in Minum.
    • All the components in Minum work in tandem to support a web application.
  • In your templating engine, where is the logic (e.g. looping, escaping, etc)?

It does not exist - logic-free templating was intentionally chosen. Any logic must be written explicitly as code, which makes maintenance easier.

  • Does it provide HTTP v2? Web sockets?

It currently does not. Those features may be built in the future. The choice was made to minimize scope for now.

​

* Due to the necessities of structuring a web server for test-driven development, some parts of the socket / http handling code had to be written a bit more cleverly than preferred.

33 Comments
2024/03/27
20:09 UTC

8

Feedback on Vaadin?

Hi all, I am looking for people who have had experiences with Vaadin. Good or bad. I am considering it as an alternative to go Thymeleaf+Spring boot for a personal project.

Having a javafx background, this framework feels more familiar than htmx & thymeleaf on top of Spring boot. And on the plus side, it comes with a couple of ready to use ui components.

Any feedback is appreciated

38 Comments
2024/03/26
21:58 UTC

55

macOS 14.4.1 Released - should fix Java bug

https://support.apple.com/en-us/109035 has just dropped, which should fix the bug in 14.4 that was causing problems with the JVM's JIT and causing process crashes.

8 Comments
2024/03/26
08:39 UTC

37

Windows 32-bit support in newer versions of OpenJDK

Hey friends,

I am about to propose the complete removal of Windows 32-bit support in OpenJDK following JEP 449, which deprecated-for-removal the support.

This would only impact newer versions of OpenJDK (such as OpenJDK 23 and future).

Let us know if you have a critical use case where you are still upgrading OpenJDK to the latest, on Windows 32 bit environments, and why you have to update OpenJDK, as well as why you can't move to a Windows 64 bit environment.

44 Comments
2024/03/25
18:25 UTC

47

How do you think would OSGi be designed today

I've been going down a rabbit hole this weekend reading the OSGi specification.

It's a bit fascinating in the ratio of how confusing it is to internet ink claiming that "no, it's simple really." The extremely salty infoq articles were a great read too.

But for anyone that has experience in OSGi + the dynamic capabilities it has, how do you think that system would have been designed if JPMS modules were in the language from day 1.

I've seen the OSGi connect spec, but even without understanding everything it feels kinda tacked on.

59 Comments
2024/03/25
13:27 UTC

13

Coat 2.0.0 with way better performance

A few weeks ago I posted a link to Coat, a config library I have written.

There u/jeyjeyemem mentioned the performance benchmark he wrote and Coat is now contained in it. Coat 1.0.0 already performed very well. Even though that was not a design goal of Coat there wasn't much missing to raise performance even more. Coat already had all config information on creation time of the config object, but still did the conversion from String to the actual type on each access. This is changed now and Coat performes way faster than before and is now the fastest config library (of the ones in the benchmark).

This change is so big that I even decided to spend a section in the user manual on that topic.

This change requires that the validation of config entries is done on creating the config object and not afterwards. Therefore the validate() method was removed and the creation of the object may now throw a ConfigValidationException. Since this is a breaking change I took the opportunity to introduce other small breaking changes. But all of them are easy to migrate as is explained in the release notes.

So, if someone is already using that library, sorry for the breaking change so shortly after the last release, but I think the small adaptations are worth it.

3 Comments
2024/03/25
06:13 UTC

18

Why so many crc32c implementation

I was looking around few open source projects and I found one thing strange. They are implementing their own crc32c. Hadoop, snappy-java, guava...

Even though Java provides of its own.

I just made a quick benchmark and found out that the java's implementation is the quickest.

Can somebody put some light on this.

I am noob and a non native English speaker.

Edit One added question, is there a data structure like bloom filter but with 100% guarantee. Currently I am working on a problem where I have n byte arrays. A bunch of byte arrays will be stored inside files. I want to quickly know if the byte array is present inside that file or not. Currently thinking of including crc32c checksum.

Edit 2 Thanks guys for all the info

16 Comments
2024/03/23
13:20 UTC

35

Released Bob 0.1.0

Bob is small utility annotation processor that acts as an alternative for Lomboks Builder annotation without byte code magic.

https://github.com/jonas-grgt/bob

36 Comments
2024/03/23
11:27 UTC

32

Gradle 8.7 Release Notes

Gradle 8.7 is there bringing support for running Gradle on Java 22 and other things: Gradle 8.7 Release Notes

57 Comments
2024/03/23
05:29 UTC

0

What's wrong with VSCode?

why is everyone suddenly recommending to use other IDEs for java? I've been using vscode for a while without any issue, and so far it's the easiest and smoothest experience out of all and i prefer it over others like eclipse and intellij

91 Comments
2024/03/22
15:23 UTC

1

AssertJ for program flow?

Initiated by the following thread:

https://www.reddit.com/r/java/comments/1bgzyf6/comment/kvwer6o/

Is using AssertJ not just for Junit testing but also for normal program flow a good idea? Like checking if a textfield value is null,empty or not instead of using .equals and the rest?

18 Comments
2024/03/22
08:38 UTC

33

JDK 22 Security Enhancements by Sean Mullan

4 Comments
2024/03/21
12:15 UTC

Back To Top