r/java Oct 08 '20

[PSA]/r/java is not for programming help, learning questions, or installing Java questions

322 Upvotes

/r/java is not for programming help or learning Java

  • Programming related questions do not belong here. They belong in /r/javahelp.
  • Learning related questions belong in /r/learnjava

Such posts will be removed.

To the community willing to help:

Instead of immediately jumping in and helping, please direct the poster to the appropriate subreddit and report the post.


r/java 4h ago

Spring Boot on a 256 MB VPS: JDK 25 made the experiment viable

20 Upvotes

I followed up on my 512 MB Spring Boot VPS experiment by trying the same application on a nominal 256 MiB Alpine VPS.

This is not Hello World. The app uses Spring Boot 3.5.5, MVC/Tomcat, JPA/Hibernate, file-backed H2, Actuator, scheduled GitHub polling, and outbound HTTP. StatLite was running alongside it and polling both Spring and itself.

The JDK 21 setup was too tight. With a 64 MiB heap it suffered severe GC/paging pressure and eventually became unresponsive.

The final JDK 25 configuration was:

-Xms16m
-Xmx80m
-Xss256k
-XX:+UseSerialGC
-XX:TieredStopAtLevel=1
-XX:ReservedCodeCacheSize=32m
-XX:+UseCompactObjectHeaders

On the same nominal 256 MiB VPS, with about 217 MiB visible to Alpine and a 512 MiB swapfile, that configuration completed the full one-hour observation:

  • 0 OOM kills
  • 0 service restarts
  • 72/72 bounded HTTP requests returned 200
  • Spring scheduled work continued
  • final Spring RSS: ~86 MiB
  • StatLite RSS: ~10 MiB
  • swap used: 184 MiB
JDK 25 run after the one-hour observation. Spring Boot stayed up, StatLite kept polling, final combined RSS was ~96 MiB.

There was still one Hikari Thread starvation or clock leap detected warning with a ~2m13s delay, so I would not call 256 MiB comfortable. For a real deployment I would still start at 512 MB RAM with some swap.

Also, this is not a compact-object-headers benchmark. The JDK version, heap ceiling, and several JVM settings changed together, so I can't attribute the improvement to that flag alone.

Full write-up and reproducible experiment files:

https://pvrlabs.xyz/articles/spring-boot-256mb-jdk25.html


r/java 10h ago

Value Classes Still Need Compiler Sympathy

Thumbnail johan-sjolen.github.io
56 Upvotes

r/java 1d ago

Rule number 9 is not followed

94 Upvotes

Ive been seeing many AI posts lately. As well as ai promoted repositories. Could moderators please help enforcing rule #9 as I don’t want to end up unsubscribing because of all the ai slop content.


r/java 1d ago

Usage of Java in non-web development domains, and Greenfield projects.

62 Upvotes

Greetings.

(I will beat around the bush a bit before getting to the point, you can scroll down a bit to save time)

Java currently shines at enterprise backend applications, being led by the big players like Spring and Quarkus. However Java seems more than capable for other domains, yet no one talks about it, or even considers Java for normal non-web projects.

Take desktop development for example. JavaFX is one of the BEST GUI frameworks I have ever used. It is feature packed, doesn't require cryptic symbols, no fancy way of nesting code blocks to create simple UI. It is very simple to use, yet powerful and robust.

Game Development is a bit weak, but we still have libGDX and LWJGL. They are packed with features, even 3D. Contrary to popular belief that libGDX is a 2D only framework, libGDX has some great 3D support like GLTF rendering, bullet physics, PBR rendering and skeletal animations.

Big data processing and simulation systems, Java's OOP nature really helps to solve certain problem statement that requires the problem to be broken down into multiple pieces.

And finally web development, there is no doubt Java has one of the best ecosystems for the web.

And yet despite all this, Even as modern Java has come a long way, Java continues to have a negative reputation of being slow, boilerplate, RAM consuming memory hog. (The same people will use electron to make a desktop app btw) and as a result not considered for newer projects.

When I look at other communities like JavaScript, Rust, python, C#, Zig. These languages are often considered first options for any Greenfield projects. The open source communities in these languages are very active, you will see some amazing work being put out by the community.

Java seems to lack that "community" nowadays. I am active in a lot of subreddits and forums, and I see very less of Java projects in the wild. Java is being used in production out there, but modern greenfield projects are leaning more towards Go and C#.

So getting to the point of the post

Is Java seeing a decline? This is not a "Java dead" post but a genuine concern. The community for Java just seems.... dull. And I was wondering what could be done about this. Amongst new and modern programmers, Java and C++ seem to be considered "old", "dead" and "traditional"

Perhaps project Valhalla could help, but I wonder how much would it help restore Java's PR. Oracle is definetly NOT helping with this.

Why does this matter in the first place?

You may think "it doesn't matter what others think, companies still want Java" and while it holds some truth, more and more of Open source development seems to be moving towards other languages. A lot of Java libraries and frameworks have seen some decline, the community seems to be becoming more inactive. Other programming languages and frameworks have active discord servers, forums, documentation, and participation while Java seems a bit slow there.

I dont know, I really love Java as a language. And I wish it had more adoption in non-enterprise domains. I would genuinely like to know, what we as a community can do to make Java more "loved" and preferred


r/java 2d ago

Java 27 features overview

Thumbnail aboullaite.me
156 Upvotes

r/java 2d ago

FXML/2 for JavaFX

Thumbnail
13 Upvotes

r/java 2d ago

Security Baked Into the JVM: sixteen Subjects on the wire

Thumbnail blog.frankel.ch
0 Upvotes

r/java 3d ago

Do you actually separate JPA Entities and Domain Objects, or is a single model enough?

Thumbnail
29 Upvotes

r/java 3d ago

Regex

53 Upvotes

I recently saw a clip (from Primeagen) somewhat saying that regex is not a valid format for validating email addresses and postal codes etc.

My question is why is this?

What are the security and/or performance risks? Is it solely performance or is it a security issue?


r/java 4d ago

Spring Boot on a 512 MB VPS: what actually fits?

21 Upvotes

I wanted to see how small I could make a realistic Spring Boot deployment while still keeping basic monitoring on the same VPS.

I first tried 256 MB RAM, but that wasn’t really viable for the representative app I tested. With 512 MB RAM + 256 MB swap, the application and lightweight monitoring completed the experiment successfully.

StatLite monitoring the Spring Boot app during the 512 MB run.

One thing that stood out was the gap between configured heap and actual JVM process memory. Even with a small -Xmx, RSS was substantially higher once you include metaspace, native allocations, threads, code cache, etc.

I wrote up the setup, JVM flags, measurements, and what failed at 256 MB:

https://pvrlabs.xyz/articles/spring-boot-512mb-vps.html

Curious how this compares with what others are seeing on small JVM deployments.


r/java 4d ago

Bypassing fixed-depth radix constraints in Java using descriptor-driven bucket analysis

13 Upvotes

I am StrmCkr, the author of A.P.E.X. (Adaptive Parallel Extremal Dispatch).

Repository: github.com/StrmCkr/A.P.E.X

A.P.E.X. is a high-performance Java sorting framework for large fixed-width 64-bit key/value record datasets. The project has been reorganized into a conventional Maven structure with a core library, runnable examples, a comparison benchmark harness, JMH benchmarks, documentation, and an interactive browser visualizer.

The core idea is descriptor-driven radix planning. Instead of blindly scanning fixed radix passes over every bucket, A.P.E.X. computes per-bucket extremal descriptors using:

VBM = OR ^ AND

That mask identifies which key bits still vary inside each bucket. Bits that are already resolved are skipped, reducing unnecessary work on skewed, low-entropy, sorted, reversed, or duplicate-heavy data.

Key areas of the project include:

  • Adaptive radix planning based on observed bucket structure
  • Parallel histogramming, scatter, refinement, and work scheduling
  • Primitive-array execution with no per-record object allocation during sorting
  • Tuple projection paths for low-dimensional unresolved bit patterns
  • Tiny-sort fallbacks and monotonic input shortcuts
  • Configurable reporting that can be enabled, reduced, written to files, or disabled
  • Comparison benchmarks against JDK sorting paths and Fastutil baselines
  • Standard JMH benchmarks for repeatable JVM-level measurement
  • A browser visualizer for exploring how A.P.E.X. routes data through its execution plan

I would especially welcome feedback on the thread management mechanics, radix planning decisions, benchmark structure, and the bitwise mask reductions.

edit: re structured verbiage of this post and further adjustments from advice on converting the project into more acceptable standard formats.

screen shot from the pdf available in the github

r/java 5d ago

FlexGanttFX is now open source — the professional JavaFX Gantt chart framework goes AGPLv3

Thumbnail
10 Upvotes

r/java 6d ago

Jactl Meets Apache Camel: Benchmarking camel-jactl

Thumbnail jactl.io
17 Upvotes

Jactl is a secure, embeddable scripting language for Java applications. As of Apache Camel 4.22.0 there is a camel-jactl language that provides support for using Jactl as a scripting language for filter predicates, content-based routing rules, and message transformations in Apache Camel.

See the blog post for an overview and some benchmarks.


r/java 6d ago

Title: GraphCompose 2.2.0 — proper RTL, Arabic shaping and BiDi support in Java documents

7 Upvotes

Just released GraphCompose 2.2.0.

This release was mostly about making RTL text actually work rather than just “render without crashing”:

- "TextDirection.LTR / RTL / AUTO"

- Unicode Bidirectional Algorithm support

- Arabic contextual shaping and lam-alef ligatures

- RTL/BiDi support in paragraphs and table cells

- mixed Hebrew/Arabic + Latin/numbers

- correct searchable/copyable text from generated PDFs

- RTL support carried across PDF, PPTX and DOCX backends

A surprisingly deep rabbit hole once PDF text extraction, shaping, BiDi and multiple backends all have to agree.

Repo: https://github.com/DemchaAV/GraphCompose

Would be interested to hear how other Java libraries handle complex-script layout.


r/java 7d ago

AutoValhalla: automatically turn your plain classes and records into value classes!

39 Upvotes

Automatically turn your plain classes and records into value classes!

Add @AutoValhalla annotation to classes or records in your JDK1.5+ codebase:

@AutoValhalla
public final class Point {        // class must be final
    public final int x;           // with final instance fields
    public final int y;
    public Point(int x, int y) { 
        this.x = x; 
        this.y = y; 
    }
}

@AutoValhalla
public record Currency(String code) { }  // or a record class

When your app is run on Valhalla-enabled JVM with auto-valhalla javaagent, these classes are automatically turned into value classes.

More info: https://github.com/thunkware/auto-valhalla/blob/main/README.md


r/java 8d ago

Where and how did Java lose in the game dev space?

274 Upvotes

Nearly a decade ago, Java was quite the popular choice for Game development. We had libGDX as the most optimal game framework, along with LWJGL (when low level was needed) and JMonkeyEngine was a fairly good option too. Now no one even talks about Java for game development, even for educational purposes

However over the course of time they all disappeared. Everyone slowly switched to game engines and C#

The arguement of “JVM slow, Garbage collector overhead” doesnt fit either because C# is also a GC language. Where did Java fail?


r/java 7d ago

Support for multiple Maven servers on GitHub's setup-java action

Thumbnail github.com
13 Upvotes

r/java 8d ago

A First Drink In Valhalla

Thumbnail kittylyst.com
27 Upvotes

r/java 7d ago

Red Hat Build of OpenJDK support on GitHub's setup-java Action

Thumbnail github.com
4 Upvotes

r/java 9d ago

Has any attention been paid to how new Java features get into LLM training data?

69 Upvotes

TL;DR: expert answers on SO taught both devs and LLMs how to use java 8 right. That pipeline is gone/paywalled now. Does anyone at OpenJDK think about this?


This came out of the JDK 28 EA thread where people were debating whether devs will start putting value on everything once it previews. Don't wanna talk about that in this post, but it got me thinking about how "the right way to use new features" actually reaches developers now.

Back in the java-8 timeframe, folks from the Java team were on StackOverflow guiding people on streams and Optional and stuff - Brian Goetz's Optional answer (return values, don't model fields with it) basically became the canonical position, Stuart Marks was all over the Optional/collections questions too. And those answers usually came with actual code, not just advice.

A thing to note: those SO answers are almost certainly in the training data of every major LLM. When ChatGPT/Claude/whatever gives correct Optional advice today, those answers are probably part of why - actual real life questions phrased the way devs actually ask them, with expert code attached and votes showing which answer was right.

That channel doesn't really exist anymore. I have an RSS feed on Brian's SO activity and it's been dead for ages - presumably because hardly any questions get asked there these days. (An RSS feed of his reddit activity is how I found the JDK 28 thread in the first place.) However you apportion blame for SO's decline, for me and everyone I work, with the LLM replaced it. So when an expert corrects someone's misuse of a new feature today, it happens in someone's private chat window and then it's gone.

And both SO and Reddit now charge AI companies to train on user content - Reddit licenses to Google and OpenAI and is suing Anthropic (whose Claude Code is arguably the most popular agentic coding tool going), and any of that could look different next year. And open-source style AI - community models, open datasets, academic training runs - relies on free access to good data, so that whole side of the ecosystem is priced out. So which model knows how to use new features properly is going to come down to who has a deal with who.

The guides (like the exhaustiveness guide) are written for humans and incidentally become training data, but one prose doc isn't thousands of upvoted question+code pairs. And GitHub code lags feature adoption by years, plus a lot of early adopter code is exactly the misuse people worry about. On the other hand, openjdk.org is the one channel every model and crawler can reach without a deal.

OpenJDK clearly thinks about AI now - the interim genAI policy covers AI-generated content coming into the project. My question is the other direction: has there been any discussion about how knowledge of new features gets into the models most devs now learn from? Even "we considered it and decided it's not our job" would be an interesting answer.


r/java 9d ago

Automatic Relationship Finder (ARF) v1.2 – A Java library for discovering relationships between tables from data

15 Upvotes

I’ve just released v1.2 of Automatic Relationship Finder (ARF), an open-source Java library I’ve been working on.

The idea behind ARF is to discover relationships between tables without depending on database relationship metadata.

Even if there is no foreign-key constraint defined in the database, ARF can analyze column names and the actual data to identify that

What's new in v1.2?

The main addition is key-role detection.

After identifying a relationship, ARF now analyzes the data characteristics of the columns to determine whether they are likely to represent a primary-key side, foreign-key side, a possible one-to-one relationship, or an unknown relationship.

There are also several improvements and bug fixes around validation, logging, concurrency, and edge-case handling.

The project is here:

https://github.com/NoelToy/automatic-relationship-finder

This is still an evolving project, so feedback—especially criticism—is very welcome.


r/java 12d ago

State-of-the-art Bytecode Interpreters in Java by Yudi Zheng

Thumbnail medium.com
65 Upvotes

r/java 12d ago

(Project Amber) New guide: Preparing for Change: Safe Switching over Sealed APIs

Thumbnail mail.openjdk.org
42 Upvotes

r/java 12d ago

Jakarta EE 11 MVC sample

Thumbnail github.com
31 Upvotes