r/java 16d ago

Java in the Small

Thumbnail horstmann.com
100 Upvotes

r/java 15d ago

Is the JVM on the Path to Obsolescence? Will GraalVM Take Its Place?

0 Upvotes

So, the JVM was created to solve the platform-dependency problem, but over time, it introduced its own problems. Then came GraalVM as the potential savior. Does this mean the JVM has lost its purpose? Has the mantra of 'Write Once, Run Anywhere' (WORA) lost its relevance?


r/java 17d ago

Java DataFrame library 1.0 GA release

Thumbnail github.com
61 Upvotes

r/java 17d ago

I just released ChatKeeper, my first commercial Java application

105 Upvotes

Hi all, I've been writing Java code since the late 1990s (you might be familiar with some of my open source projects, like Nailgun and JSAP), and I just released a tool I wrote for myself as my first commercial side project.

It's called ChatKeeper and it syncs your ChatGPT export files to local Markdown files. This allows for easy and permanent local storage, searchability, and integration with note-taking applications like Obsidian (which I use). Syncing again will find your conversation files even if you moved or renamed them, and will update them in place if you continued them since your last export, so you can reorganize them to your heart's content.

ChatKeeper is written in pure Java and compiled to native code using graalvm native-image. Built for Linux, Windows and Mac x86_64 all on my Fedora 40 Linux desktop, and for Mac arm64 on an on-demand M1 at Scaleway. I am thinking about writing a blog post about all that if I can make it interesting enough. 🙂

It's local software that's free to try and follows a shareware-like model for full features (modest price, NOT a subscription). It runs on Windows, Mac, and Linux.

In my case, I use ChatKeeper in combination with Obsidian to link conversations or specific parts of conversations with my notes, and keep my notes from being scattered across different platforms. I've found this very useful. It should work just as well with any other tools that handle basic Markdown files, or can simply provide readable backups of your conversations.

I hope ChatKeeper is useful to you, too, and would love to hear your thoughts on it, how you might use it or might like to see it improved, etc. Please check it out!

- Marty


r/java 17d ago

NoSQL Database Integration in Java With Eclipse JNoSQL 1.1.3

Thumbnail dzone.com
11 Upvotes

r/java 18d ago

Valhalla - Java's Epic Refactor

Thumbnail inside.java
175 Upvotes

r/java 17d ago

New release for open source Trinity eXplainable AI analysis tool

1 Upvotes

New full release for the Trinity XAI analysis tool just in time for the holiday season 💙

Trinity XAI

Nebuchadnezzar

The emphasis of this release is to provide and enhance tools for Deep Fake imagery problems, with a focus on enhanced clustering and rapid content traversal in the latent space.
Major feature additions are below.

As always its free and easy. Have fun you fine young cannibals.

- ShapleyValue Collections and 3D image rendering
- Group Point selection for manifold generation
- Cluster Builder Tool with the following algorithms
DBSCAN, HDDBSCAN, KMeans, KMediods, Expectation Maximization, Affinity Propagation and more
- CoCo Annotation serialization
- Content Navigator
- Asteroids 3D Minigame Easter Egg
- Video Playback via EmptyVision
- Automatic file type detection and recommendation
- Optional HTTP data injection and command & control (disabled by default)


r/java 18d ago

Post-Quantum Cryptography in Java

Thumbnail infoq.com
45 Upvotes

r/java 19d ago

Spring Boot 3.4 supports multiple Docker Compose files

Thumbnail medium.com
58 Upvotes

r/java 19d ago

Are there any risks in using a WatchService in a container?

21 Upvotes

I'm reviewing a lot of possible solutions to architecting a particular feature. One solution im considering relies on using a WatchService to observe a directory for specific file changes.

This will be happening in a containerized environment. Specifically it will happen in a container running in AWS EKS, and the target directory is a shared persistentvolume provided by AWS EFS. My question is what kind of landmines can this potential result in?

The main one that comes to mind is if there is some kind of connectivity problem between the container and the EFS volume. However, if that were to happen, the entire feature I'm working on would fail in general, so as a criteria for whether or not to use WatchService I don't consider this to impact my decision.

Anyway, I'm really just wondering what if anything I may be overlooking. Thanks in advance.


r/java 19d ago

Java code simplification tool

29 Upvotes

Few weeks ago, I had posted : https://www.reddit.com/r/java/comments/1h1a4sj/java_code_simplification_tool/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

After going through the comments and spending some more time analyzing probable solutions - I came up with a strategy to create a refactoring tool box.

This is beyond what existing tools like Intellij refactoring, openrewrite, sonarlint offer.
Strategy : To create small scripts (tools) to do small refactoring tasks correctly. After invoking every step to run tests and validate - fix any possible issues.

First goal : Cleanup & Move Java 8 spring services to Java 21 spring boot 3

  1. Custom script to Exclude duplicate dependencies. Upgrade dependencies to latest versions.
  2. Custom script for Migration of xml beans to annotation based
  3. Removal of unused code within classes (intellij refactoring etc helps here)
  4. creation of custom recipes on openrewrite for internal dependency migration.
  5. Custom script for combining stray unorganized properties files to application.yml
  6. Custom script to combine smaller over abstracted classes into one and removal of the old classes. Removal of unused interfaces by making inline.
  7. Manually rearrange classes into proper directories.
  8. Manually copy src classes to a new spring boot 3 repo.
  9. Openrewrite spring boot3 java 21 automated upgrade.
  10. Openrewrite automated code cleanup recipes

Please note that this is only for the codebases I currently manage and many more tools can be added to this toolbox later on.

I realized the a strong developer is of utmost importance and cannot be completely removed from the refactoring process - having better tools makes the job easier.

Is my attempt futile? What do you think is lacking? What do you think I can do better? How are you solving such similar problems? If this works out, I'll probably try making this opensource in some way. Feedbacks welcome.


r/java 18d ago

I made my own config library (and it changed my life)

0 Upvotes

It works using reflection and Gson. You can make all your configs in 3 lines of codes.
Try it here: https://github.com/tbvns/EZConf4J


r/java 20d ago

TeaVM 0.11.0 with support for WebAssembly GC released

95 Upvotes

I just released TeaVM version 0.11.0. It's the first release which supports WebAssembly GC. See release notes and getting started.

TeaVM is an AOT compiler of Java bytecode to JavaScript and WebAssembly. Unlike j2cl/wasm, it takes bytecode, not Java source code, which allows to support other JVM-targetted languages in the browser. And unlike Kotlin/Wasm and Scala.js, it supports even mixed projects.

Other advantages over j2cl/wasm:

  1. Has Maven and Gradle plugins out of the box
  2. Does not require experimental JS String builtins support, so runs in all major browsers without extra setup.

r/java 21d ago

Clean Code: The Good, the Bad and the Ugly

Thumbnail gerlacdt.github.io
90 Upvotes

r/java 22d ago

Primitive wrapper constructors in JLS

26 Upvotes

I noticed that the JLS is still using the constructors of the primitive wrapper classes, despite them being deprecated for removal.

5.1.11 String Conversion

A value x of primitive type T is first converted to a reference value as if by giving

it as an argument to an appropriate class instance creation expression (§15.9):

If T is boolean, then use new Boolean(x).

• If T is char, then use new Character(x).

• If T is byte, short, or int, then use new Integer(x).

• If T is long, then use new Long(x).

• If T is float, then use new Float(x).

• If T is double, then use new Double(x).

Note that "creation expression" is the term used for constructor calls, so this whole section relies on a system that may be removed in the near future.

Code example 8.1.2-2 uses "new Integer(1)" and "new Double(1.5)"

Should I look up how to report these, or is it something nobody would care about?


r/java 22d ago

Advancements made in Eclipse GlassFish under the Eclipse Foundation

Thumbnail omnifish.ee
25 Upvotes

r/java 22d ago

Apache NetBeans 24 released

Thumbnail netbeans.apache.org
105 Upvotes

r/java 21d ago

Detoxifying the JDK Source Code

Thumbnail stuartmarks.wordpress.com
1 Upvotes

r/java 22d ago

The Open-Session-in-View Pattern of Spring Boot - a possible source of problems

48 Upvotes

I have written a Blog Post about two problems that might occur in a Spring Boot project with the Open-Session-in-View pattern, which is enabled by default.

https://robertniestroj.hashnode.dev/two-reasons-why-you-might-want-to-disable-open-session-in-view-in-a-spring-application


r/java 23d ago

Spring AI MCP: A Java SDK for the Model Context Protocol

Thumbnail spring.io
29 Upvotes

r/java 22d ago

Java 24 Performance Improvements & Deprecations - Inside Java Newscast

Thumbnail youtu.be
1 Upvotes

r/java 24d ago

[Discussion] What's the point of making records "easy to migrate" to classes? Wouldn't it be better to make them so distinct that the need never arises?

48 Upvotes

As Java architects and language developers have frequently emphasized, records are designed to be "named tuples"—transparent carriers of data. At the same time, records are just "classes with special rules," which makes it relatively straightforward to migrate from a record to a class if the record becomes too complex.

On the other hand, Java has been advocating for a paradigm called "Data-Oriented Programming" for several years. This approach emphasizes separating data modeling (using records) from data behavior (using classes) and structuring data in a way that invalid states are impossible to represent. When data is well-modeled, reasoning about behavior becomes significantly easier.

With this perspective, it's clear that records and classes serve two distinct purposes. The more specialized and distinct their features are, the less ambiguity there is about when to use one or the other. Specialized features for each make designing applications more intuitive. For example, records having features that classes lack, and vice versa, reinforces their unique roles.

Currently, records offer several features that differentiate them from classes:

  • Deconstruction patterns: These allow records to be deconstructed into their components (though they are currently limited to use with instanceof and within switch statements).
  • Improved serialization: Record serialization leverages the canonical constructor, making it safer and slightly faster.
  • Convenience methods: Records automatically generate accessors, toString, equals, and hashCode methods.

These differences not only highlight the semantic distinction between records and classes but also create functional divergences. However, they can make transitioning from records to classes more challenging. As far as I know, to address this, Java architects are exploring ways to bring some of these features to regular classes, simplifying migrations.

But this raises a question: Wouldn't it be better to give records even more exclusive features (and limitations), so their use cases are unambiguously distinct from classes? If records and classes are "similar enough"—because records are, after all, just "classes with special rules"—might that not make application design and reasoning about their roles more difficult?

For comparison, in languages like JavaScript and TypeScript, there is no ambiguity about when to use a simple object versus a class. These two constructs are so semantically distinct that migrating an object to a class doesn’t make sense and using a class for what an object can do it's possible but also considered a bad practice. Objects are lightweight and simpler, while classes are designed for encapsulating behavior.

What do you think? Would making records and classes more semantically and functionally distinct help eliminate ambiguity in their usage?

I would love to read your opinions :)


r/java 24d ago

Monitoring total and active connections for hibernate and jpa related actions

12 Upvotes

I’m working on a legacy application built on Apache Struts (2.x). The application uses Hibernate and JPA for database interactions. We’re trying to optimize performance and need to monitor the total connections and active connections being used by Hibernate and JPA.

Db : psql Connection pool : c3p0

Is there a straightforward way to find the total and active connections managed by Hibernate and JPA in a Struts application?

Are there specific tools, libraries, or configurations we can use to get these metrics?


r/java 25d ago

Start of JDK 25

Thumbnail github.com
77 Upvotes

r/java 25d ago

Java News Roundup: JDK 24 in Rampdown, JDK 25 Expert Group, Jakarta EE 11 Core Profile, Spring Cloud

Thumbnail infoq.com
53 Upvotes

This week's Java roundup for December 2nd, 2024 features news highlighting: JDK 24 in Rampdown Phase One; the formation of the JDK 25 Expert Group; the release of Jakarta EE 11 Core Profile and Spring Cloud 2024.0.0; and point releases for GlassFish, Open Liberty, Quarkus and Apache Camel.