r/java

I made a small Bash wrapper that reduces successful Maven output by 99.7%
▲ 54 r/java+2 crossposts

I made a small Bash wrapper that reduces successful Maven output by 99.7%

Successful Maven builds can produce thousands of lines that mostly confirm routine lifecycle steps.

That output is noisy when working in a terminal, clutters CI logs, and becomes especially expensive when build output is passed to a coding agent.

I built mvn-lite, a small deterministic Bash wrapper that keeps successful Maven output to one line while preserving the original exit code and complete raw log.

On a real four-module application:

  • Standard Maven output: about 6,753 bytes
  • mvn-lite output: 16 bytes
  • Result: PASS · 3.944 s
  • Reduction: more than 99.7%

Failures still return a nonzero exit code and show bounded diagnostics, while the full unmodified Maven output remains available in the raw log.

For example, an invalid lifecycle error was reduced by 91.6% while retaining the actual Maven error.

There is no LLM summarization, API key, or Maven extension involved. It is just a local Bash wrapper with deterministic text extraction.

Source and script: https://github.com/ejboy/agent-scripts

Benchmark details and design notes: https://pvrlabs.xyz/articles/introverted-maven.html

I’d be interested in feedback on Maven failure cases where compact output could hide something essential.

u/fykup — 1 day ago
▲ 35 r/java

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

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

u/maxxedev — 1 day ago
▲ 251 r/java

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

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?

reddit.com
u/gufranthakur — 3 days ago
▲ 66 r/java

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

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.

reddit.com
u/shorns_username — 4 days ago
▲ 18 r/java+1 crossposts

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

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.

u/MoonWalker212 — 4 days ago
▲ 315 r/java+3 crossposts

Apache Fory™ JSON: 10x Faster JSON Serialization Framework for Java

Apache Fory JSON is a high-performance JSON serialization framework for Java. It maps Java objects to and from standard JSON text and UTF-8 bytes.

In the published benchmarks, it reaches up to 10.91× Jackson’s throughput and 10.89× Gson’s in java-json-benchmark, and up to 5.55× and 10.00× respectively in the jvm-serializers MediaContent benchmark.

It supports JDK 8+, Android, and GraalVM Native Image. JDK17+ Record is also supported.

fory.apache.org
u/Shawn-Yang25 — 8 days ago
▲ 14 r/java+3 crossposts

Events-Caravan, an event-sourcing framework that trades the global event log for horizontal scalability (DynamoDB/SNS/SQS reference impl, Spring Boot starters)

Over the past months I've been building my pet project, and today I'm open-sourcing its core: Events-Caravan, an event-sourcing framework for Java with Spring-boot starter modules.

The framework is built around an opinionated bet made for the sake of horizontal scalability: there is no global sequence of events. Events are ordered within a single entity.

Axon's default, for comparison, keeps a totally-ordered event log, and that log eventually becomes the ceiling: the one component every write has to pass through. Give up the global ordering, and everything can partition at the entity level: the storage, the change feed, the consumers.
Events-Caravan has no central sequencer, no outbox table either: inserting an event into the database is publishing it, and the database's own change stream carries it to consumers.

Nothing is free, of course. The price for horizontal scalability is at-least-once unordered delivery and strong consistency only within one entity. I've documented every traded-away guarantee in the README's "Compromises" section, along with how to compensate.

The project is modularized. The core is plain Java interfaces to use or implement, no DSL. Reference adapters ship for DynamoDB and SNS/SQS, but the design isn't tied to AWS: any technology fitting the framework's principles can substitute AWS.

The library also brings:
- Entity state snapshotting, to avoid replaying all historic events.
- Sharding of long entity histories, so no partition grows into a bottleneck.
- An adaptive, scalable queue-polling mechanism.
- An optional, eventually consistent entity-stream that compensates for the absence of a global event log.

Apache 2.0, on GitHub with an opinionated README: https://github.com/SagynyshBaitursinov/events-caravan
Maven Central: dev.baitursinov:events-caravan

If you've run event-sourced systems in production, or are just interested in software architecture, I'd genuinely value your opinion on the design, its interfaces, and the 11 principles it's built on - all in the Readme.

u/nervous-comment — 6 days ago
▲ 18 r/java

Monitoring Spring Boot Actuator on low-resource VPS nodes without running a second JVM

When running small Spring Boot applications on 1-2 GB VPS instances, a full observability stack can be a significant amount of additional infrastructure for what may be a fairly simple deployment.

Over the past few weeks, I've been looking at how to keep operational visibility lightweight when polling standard Spring Boot Actuator endpoints. A few trade-offs stood out:

  • Bound the data you ingest. Even a lightweight collector should not assume every management endpoint will always return a small response. I ended up putting an explicit 1 MiB limit on Actuator responses and collecting a focused set of metrics, such as JVM memory, threads, HTTP errors, health, and restarts.
  • Polling frequency matters. A 30-second default gives reasonably responsive health and JVM trends for small deployments without constantly polling the application. For more resource-conscious production setups, slower intervals are usually perfectly reasonable.
  • The monitoring process has a footprint too. On a 1-2 GB server, I would rather not dedicate another JVM or several monitoring services to basic operational visibility. StatLite typically stays under roughly 15-20 MB of memory, while using local SQLite for recent history.

I built a small open-source implementation of this approach called StatLite.

StatLite dashboard in action

It runs as a single Go binary or Docker container, reads standard Spring Boot Actuator endpoints, stores recent history in SQLite, and serves a self-contained dashboard.

The latest release also adds multi-platform Docker images, bundles all dashboard assets locally for offline and air-gapped use, bounds historical queries and Actuator responses, and pauses browser refresh when the tab is hidden.

GitHub:
https://github.com/PVRLabs/statlite

Technical write-up:
https://pvrlabs.xyz/articles/lightweight-spring-boot-monitoring.html

I'm curious how others handle observability for small or single-node Spring Boot deployments. Do you use a full Prometheus/Grafana or APM setup, Spring Boot Admin, custom scripts, or something lighter?

I'm also considering making StatLite useful beyond Spring Boot by providing a small generic Java metrics exporter for regular Java web applications. It would expose a focused set of JVM and application metrics that StatLite could consume without requiring Spring Boot Actuator. Would that be useful, or is Spring Boot coverage enough for the kinds of deployments where a tool like this makes sense?

reddit.com
u/fykup — 8 days ago
▲ 0 r/java

How we keep Java bytecode encrypted through execution

This is arguably the best protection solution currently available for Java code and applications, effectively resolving the issue of Java code being decompiled.

youtu.be
u/george-lin — 8 days ago
▲ 21 r/java+1 crossposts

I made a website that automatically collects images of our favourite mascot duke!

Hello my fellow java enthusiasts!

 

I made a cool side project that automatically searches the web for images of our beloved java mascot duke. The website shows a random image from the archive. It will also have a full gallery available soon!

 

How it works:

- It uses the Brave search API to find pages based on some keywords I came up with.

- It uses Openverse and Wikimedia APIs to search for images related to duke.

- Each image gets checked by a custom classifier I have built on top of OpenCLIP and trained on more than 200 Duke images.

- The classifier filters out unrelated results. Because it's not perfect, some images go through manual review. I want to catch unusual duke images without filling the archive with junk!

 

I will most likely make this open source soon after I'm done implementing all the features I want.

Unfortunately, the backend isn't made with java, I went with python for the easy use of ai models

Currently there are 338 duke images and the archive is still growing!

 

URL: https://duke.directory

 

I would love to hear your feedback! If you have any duke images that it hasn't found or collections that it should discover, please let me know!

u/Java_Programmer1337 — 8 days ago
▲ 30 r/java+2 crossposts

Hey everyone!

It has been a while since the last update, but we have been working hard on making the Java bindings for SimpleBLE even more reliable for production environments.

For those who don’t know, SimpleBLE is a cross platform Bluetooth library with a very simple API that just works, allowing developers to easily integrate it into their projects without much effort, instead of wasting hours and hours on development.

We have been working on the Java bindings to make them feel more natural for developers and more robust to use in real applications. These are not flashy changes, but hopefully show our commitment towards becoming the trusted option for Bluetooth development for Java.

If you want to try it out, you can look at the SimpleJavaBLE examples on GitHub and see for yourself how easy it is to get started.

What changed

We added support for CompletableFuture wrappers around blocking operations. This should make SimpleJavaBLE much easier to fit into the rest of an application using async flows without having to build extra wrappers first.

We also made an important change to the JNI layer. JNI API calls are now safely wrapped so that C++ exceptions are caught and bubbled up as Java RuntimeExceptions instead of crashing the JVM.

Another small change that makes the bindings nicer to work with is that EventListener interfaces now provide default empty implementations, so if you only care about one callback, you can implement that one and move on.

We also cleaned up a few rough edges across platforms. The missing macOS x64 .dylib artifact is now fixed, JNI symbol issues have been resolved, and the jvm.dll initialization conflicts some users were seeing on Windows have been addressed.

Licensing Stuff

SimpleBLE is licensed under the Business Source License 1.1 (BUSL 1.1) and is free for non commercial use. We gladly offer free licenses for small projects, so do not hesitate to reach out. Java licenses are currently on a special offer for companies interested in shaping SimpleJavaBLE, so if you are interested in a commercial license, hit us up!

If you’re building BLE products or projects, we’d love to hear from you.

Want to know more about SimpleBLE's capabilities or see what others are building with it? Ask away!

u/kevindewald — 10 days ago