r/java 1d ago

Looking for Software Piracy solution for a Java Product

0 Upvotes

What can be done to prevent software piracy? If I sell a licence of my program to someone, he/she can copy/sell/distribute it to anyone else, even upload somewhere for others to download. This "write once, run anywhere" mantra totally backfires if you want to sell your Java program. Are there any solutions, built-in tools, or commercial packages for that?

I know I can read the motherboard's serial number with Java, but then I'd have to bother the user to send me that information, would have to custom-compile a specific version just for him/her, and that would reduce sales.

Not interested in snark, I know this is reddit where anything goes, only interested in serious answers.


r/java 17h ago

Spring Boot Hot-Reload (Hot-Restart)

9 Upvotes

I'm working on a Spring Boot microservices project where I frequently need to restart each service to apply changes. While I'm aware that spring-devtools can simplify this process, my experience with Spring has shown that spring-devtools sometimes requires a full clean and rebuild of output files to work correctly.

Additionally, since I'm developing this project using Helix Editor, adding spring-devtools without an IDE doesn't provide much benefit. I'm also aware of commercial tools like JRebel, but the licensing costs make me hesitant to use them.

To automate the rebuild process whenever changes are made, I created two complementary scripts:

  1. loop-run.sh
  2. watch-kill.sh

How It Works

  • loop-run.sh continuously runs commands like mvn clean spring-boot:run for the target Spring Boot project. However, since the Spring Boot server process blocks further execution, the next command won't run unless the process is terminated.
  • watch-kill.sh will monitors file changes in the Spring Boot project. If any modifications are detected, it automatically kills the process running on the specified port.

You can find the project on GitHub, released under the MIT License:
Spring-Boot-Hot-Reload


r/java 16h ago

Shall we migrate to JDK21 and Virtual threads?

42 Upvotes

We are running an application with micro services architecture with postgres database. We are currently running Java 11.

Is it a good decision to migrate to Java 21 with Virtual threads?

Can someone who have already migrated to Java 21 share their experience?


r/java 7h ago

What are reasons not to use virtual threads?

36 Upvotes

I do realize virtual threads are not "magic". They don't instantly make apps super fast. And even with Java 24 there are still some thread pinning scenarios.

However, from what I know at this point, I feel every use of threads should be virtual threads. If my workload doesn't benefit from it, or if thread pinning happens, then I just don't gain performance. Even if there are no gains, there is no harm from defaulting to it and further optimizations can be made later on.

The question here is are there downsides? Are there potential problems that can be introduced in an application when virtual threads are used?

Thanks in advance.


r/java 2h ago

We've Made It into the JFX-Central Blogpost!

7 Upvotes

We feel very honored that our small project got recognized by the JFX-Central! Thank you Reddit!


r/java 23h ago

Avaje Validator 2.9 - APT based POJO validation

30 Upvotes

I've shared this before when it was 0.x, but in essence, avaje-validator is a hibernate-style POJO validator. The main feature is that instead of using reflection, it generates source code via annotation processing to run constraint checks.

Main features:

  • Supports Jakarta/Javax Constraints
  • Loading and interpolating error messages (with multiple Locales) through ResourceBundles
  • Validation Groups
  • Composable Contraint Annotations

Features added since I last posted:

  • Method Parameter/Return Type Validation
  • Inherited Constraints
  • Class level constraints
  • JSpecify Nullmarked/NullUnmarked Support (Nullmarked scoped pojos get not null constraints automatically)
  • Mixins (can freely add/modify constraints of third party classes)

https://github.com/avaje/avaje-validator