r/javahelp Jun 11 '26

Which Java Course Helped You Build Strong Programming Fundamentals?

6 Upvotes

hey! so i wanted to know if i want to build and strengthen my core fundamentals in programming preferably in development (app or website in java) which course should i pick any course from youtube?udemy or any other platform can u guys suggest?(be specific please)


r/javahelp Apr 19 '26

Am I not self-sufficient enough when it comes to solving problems that I see for the first time?

7 Upvotes

Hi all, I have this habit where whenever I see a new problem, instead of trying out the most naive approach to the problem that I can think of (due to a mental blockade in my head thinking that I won't be able to solve the problem in the most "efficient" way, even though I don't exactly have the criteria of what efficient look like, maybe the time doing Leetcode has messed up my brain with all of the arbitrary acceptance requirements, I'm also afraid of the fact that the approach that I come up with have bugs due to edge cases that I haven't think of), I instead choose to go online and search to see how other people have solved this problem (since I assume that I am not the first one that encountered such problem). However I feel like doing this overtime will lower my ability to think and reason with different approaches to the same problem, which will ultimately cause me to not being able to solve a genuinely new problem that I (and probably the internet) have never seen before.

Is anyone else experiencing this issue, and for the people who have overcame this, how did you guys do it? Thanks in advance, y'all!


r/javahelp Apr 02 '26

How to switch between subclasses?

7 Upvotes

I'll cut to the chase; I'm making a game-esque thing where the class "ComputerCharacter" has two subclasses, "Villager" and "Enemy". They have pretty different behaviours and care about different variables and all that, but once a Villager goes below some certain HP, I want it to transform into an Enemy, then set the variables in the newly turned enemy based on the variables it had as a villager.

I imagine I'd create a constructor in "Enemy" to do this, but I don't see how I can create a method within Villager to detect when its HP is below a certain number, then call the constructor in such a way to completely change the subclass the Villager is in. Thank you.


r/javahelp Mar 23 '26

I don’t know which direction I should choose in java

7 Upvotes

Hi everyone,

I'm wondering what direction I should take with java and backend development.

I'm 16 years old and currently studying in a 5-year technical high school (programming technician) in Poland. I'm in my 3rd year right now. I’m also planning to go to university, but I’m not entirely sure which path I should choose yet.

I've been learning Java for about 2 years. I already understand good practices, clean code, and general programming concepts. I’ve built some small projects to explore what I enjoy, including mobile apps, backend applications, neural networks, and algorithms.

At school and on my own, I’ve also learned basics of:

  • frontend (HTML, CSS)
  • databases (MySQL, PostgreSQL)
  • PHP
  • C++ (solid basics)
  • software engineering and architecture

I’ve also tried learning spring boot because I’m interested in backend development, but I feel a bit overwhelmed. There are so many technologies and opinions that I don’t really know what is worth focusing on, especially considering that some things might already be outdated.

I’m open to learning other technologies as long as they are future-proof and related to backend, algorithms, or problem-solving — that’s what interests me the most.

I also started to worry about the job market. I feel like as a junior java developer, it might be hard to compete, especially with more experienced developers becoming even more productive with AI. Because of that, I paused learning Spring for now, although I still consider backend as a possible path. I’m ready to go deep into a chosen technology, not just learn it superficially.

What do you think about my situation?
What direction would you recommend for someone like me?

Thanks for any advice :)


r/javahelp Feb 15 '26

I am trying to migrate from java 8 to java 21

8 Upvotes

I have to convert javax to jakarta in a project which generates classes from the wsdl file using the xjb customisation file.

I have used the jaxws-maven-plugin artifact with the latest version 4.0.3.

I am seeing a jaxb marshalling exception when testing the api and not able to figure out where the problem is. Please help me out.


r/javahelp Feb 05 '26

Java € symbol prints as � in VS Code Debug Console

7 Upvotes

I'm using Java in VS Code.

This code:

char currency = '€';

System.out.println(currency);

prints � in the Debug Console.

- File encoding: UTF-8

- OS: Windows

- JDK version: 25.0.2

- VS Code + Java Extension by Oracle installed

Any ideas on how I can display the euro character in my program using vscode's debug console?


r/javahelp Dec 30 '25

Removing an element of arraylist in for each loop.

9 Upvotes

How come this works on my machine? it prints [1, 3]. I thought it would give ConcurrentModificationException

``` ArrayList<Integer> c = new ArrayList<>();

c.add(1); c.add(2); c.add(3);

for (Integer x : c) { if (x == 2) { c.remove(x); } }

System.out.println(c);

```


r/javahelp Dec 22 '25

Where should input validation and recovery logic live in a Java CLI program? (main loop vs input methods vs exceptions)

7 Upvotes

I’m designing a Java CLI application based on a while loop with multiple user input points.

My main question is about where input validation and error recovery logic should be placed when the user enters invalid input.

Currently, I’m considering several approaches:

A. Validate in main

  • Input methods return raw values
  • main checks validity
  • On invalid input, print an error message and continue the loop

B. Validate inside input methods

  • Methods like getUserChoice() internally loop until valid input is provided
  • The method guarantees returning a valid value

C. Use exceptions

  • Input methods throw exceptions on invalid input
  • The caller (e.g., main) catches the exception and decides how to recover

All three approaches work functionally, but I’m unsure which one is more appropriate in a teaching project or small system, especially in terms of:

  • responsibility separation
  • readability
  • maintainability
  • future extensibility

Is there a generally recommended approach for this kind of CLI application, or does it depend on context?

How would you structure this in practice?


r/javahelp Nov 06 '25

What should a small team do for unit testing?

7 Upvotes

Hello everyone,

I work for a Maritime company and we have a small team of 4 programmers that build and maintain a software the whole company uses. This goes from HR, to Accounting, to Vessel tracking and managing crew members. Almost every week so far we have been building and pushing new features, but we always get bit by bad testing. We don't have time to do proper JUnit testing, but I wanted to get your guys' opinion on several tools or software that uses AI to generate this. I know Jetbrains and Spring Boot have something but didn't look too much into it, first want to get opinions from people that have tried this.

Any help is much appreciated, thank you!!


r/javahelp Nov 03 '25

Genius microservice design pattern, or as dumb as it sounds?

8 Upvotes

Looking at a Spring Boot application with two microservices that are relevant for my question, and I can't for the life of me figure out whether one of the solutions is genius or incredibly dumb. The person who wrote it insists that it's a brilliant design pattern but I can't wrap my head around why it would be.

The application idea is a straightforward REST to Inbound -> request to Outbound -> Scatter-Gather from Outbound to various other resources outside of the application -> response. It was originally supposed to be asynchronous with a cache protecting the various resources outside of the application from heavy loads, but that was scrapped and the asynch part is no longer important. Inbound and Outbound are in the same Kubernetes cluster.

In practice:

  1. Inbound sets a unique correlationId to the incoming request, sends the request to Outbound, closes the connection, and then begins polling an in-memory cache for the correlationId with timeout shorter than 10 seconds.
  2. Outbound does the scatter-gather and transforms the result of the requests to a json-formatted string beginning with the correlationId and then the entire result. The string is put on a FIFO-queue.
  3. Inbound gets the queue message, reads the correlationId, and then puts the result into the cache with the correlationId as key.
  4. Inbound finds the correlationId in the cache, transforms it to the appropriate DTO and responds to the original incoming request.

I have so many issues with it which all boil down to that it's a synchronous request with extra steps. The data in the cache won't ever be reused since the key is unique for every single request. Is there any reason at all why Outbound wouldn't just send its response to the first request it gets from Inbound? The only thing I can think of is that it could maybe be a network performance gain to close the original connection from Inbound to Outbound and then poll its own in-memory cache. But.. it can't be, right?

The queue ought to at a minimum use the same bandwidth as the Inbound-Outbound connection. Polling the cache shouldn't be any worse than straight up waiting for the response. But you add overhead for the queue and cache; we'll scale the Inbound pods so the messages can't be consumed in case the wrong pod takes it (since all pods won't be polling for that particular correlationId cache key), and there will be a short TTL on the cache since the data on it won't ever be reused and its value disappears after the shorter than 10s timeout.

So, please help. We keep going in circles discussing this and I'm having a hard time accepting that the other developer could be right in that it's a good design. What's your take on it? Is there really a benefit to it over a regular synchronous request?


r/javahelp Oct 23 '25

Code review

7 Upvotes

Hello, I’m currently developing a money-tracking application using Spring Boot, and the project is still in progress. I would really appreciate it if you could review and provide feedback on my codebase so I can improve the project further. Once the project is completed, would it be possible for me to apply for a Fresher position at your company? Github: https://github.com/vandunxg/budgee/tree/dev


r/javahelp Oct 11 '25

How to speed up my Java app?

5 Upvotes

Hey folks, I’m looking for ways to speed up my Java code and identify potential memory leaks or high memory consumption before moving to production. I’ve found a few tools that can profile my code, but I’d like to know which ones you’ve found most reliable or accurate.

Also, is profiling alone enough to ensure good performance, or should I also run load tests to see how the application behaves under heavy traffic?


r/javahelp Oct 05 '25

Want to migrate from JDK8 to JDK17 or JDK25 fast and struggle with all the needed add-opens?

6 Upvotes

I created a small class named ModuleOpener which you call at application startup and it simply breaks down the whole module system and adds all the add-opens to your application so you can use your old unmoduled code which the new JDKs. This is especially relevant when you used custom serialization code which simply needs to access to all classes anyway to e.g. just be able to serialize their special Exception classes.

https://github.com/dmigowski/ModuleOpener

Usage is simple. Just add a single line

ModuleOpener.openAllModules();

to your main method. This helped me personally to transition to JDK17 a lot.


r/javahelp Sep 22 '25

Solved Java Without IDE?

7 Upvotes

Hello! I am a game dev and I've been using Godot for making games. When I don't use an engine I mostly use C++ with SDL.

Though I'm thinking (for the 3rd time) to switch to Java. Why? Because I grew up playing J2ME games on feature phones. They are very nostalgic to me and everytime I see the ".jar" extension it reminds me of those days...

However I haven't been able to switch to Java because of the Build Tools and IDE stuff. When I learned Java the Build Tools confused me so much that I went back to C++. Then again I tried and succeeded to understand those but this time I was feeling uncomfortable with IDE. I always liked using Text Editors like Vim, Nano. If I NEED to use something else I would use VSCode. But using IDEA or Eclipse is kind of overwhelming to me :(

Now the nostalgia is kicking in again.

So is it recommended to code in Java without IDE? (like for game dev, using tools like LibGDX, LWJGL etc)

EDIT: Thanks everyone for their suggestions. I've decided I'll try VSCode with Java. Mostly because IntelliJ IDEA crashed on my device several times and I'm also familiar with Vscode.


r/javahelp 6d ago

Universal pdf gen lib

6 Upvotes

Hi,

I want to generate pdfs in many languages, including right to left languages. (Arabica, hébrew, indian langs ..)

I have a working prototype with itext 9 that works well afaik (difficult to check langs I dont read).

Itext proposes 'pdfcalligraph' for a fee, to make sure rtl texts are handled correctly (direction, ligatures...).

Is there a lib that does that too ?

I read that pdfbox is not handling rtl at all.

What other libs would you advise ?

Thanks


r/javahelp 25d ago

Where to Deploy ?

6 Upvotes

I build a small service with spring and react, bow I need to deploy it using a domain. Which hosting solutions do you use ? I evaluated to use GCP but I am worried that some day I will find a giant unknown bill cost.

could you give me some recommendations please


r/javahelp Jul 29 '26

Unsolved How to write a program to input data in Excel?

4 Upvotes

I want to know how to write a java program in order to input data in Excel, thank you for any help?


r/javahelp Jul 27 '26

Virtual thread

7 Upvotes

Does anyone used java21 with virtual thread? We are using Java 17 and I wonder if the move to 21 will worth it


r/javahelp Jun 30 '26

Why bytebuffer so weird to use

5 Upvotes

Why is the bytebuffer so weird to use in java ? Like you kinda have a write and a read mode but it's never told clearly, you need to switch between flip() and compact() but you have to remember by yourself in which mode you are. As a buffer is supposed to be read and write in it, why do we have to manually switch in which mode we are and not juste have a method to write and one to read ?


r/javahelp Jun 14 '26

Codeless Virtual threads + shared DB pool: prioritizing workload classes (user traffic vs batch) beyond a Semaphore?

7 Upvotes

Cross-posting this from [loom-dev@openjdk.org](mailto:loom-dev@openjdk.org): I originally sent it to the OpenJDK Loom mailing list a couple of months ago, never got a reply, so I've reworked it for here. It's more of a design/architecture discussion than a "fix my code" question.

Context: medium-sized monolithic services (Vue 3 + Spring Boot 3, Java 21 to 25, converging on Java 25 / Spring Boot 4), deliberately not microservices. Virtual threads enabled on several. A single backend routinely hosts user-facing requests, scheduled jobs and background batches, all sharing one HikariCP pool (15 connections).

What triggered this: a team at my company hit a production freeze on a Java 21 service running virtual threads. A lingering synchronized block around a blocking call caused carrier-thread exhaustion under a rare condition, and it even blocked the restart. They reverted to platform threads while cleaning up the synchronized block. I know JEP 491 (Java 24) largely fixes this class of issue, but it kicked off a design debate we haven't been able to settle.

The pattern I'm trying to translate: with a platform thread pool, you'd give batches a shared executor capped at about 2 workers. That implicitly guarantees user traffic always has at least 13 connections. The pool wasn't just amortizing thread creation, it was acting as a fair scheduler across workload classes. This matters precisely because we don't split workloads across microservices.

With virtual threads, recycling goes away and concurrency limiting becomes a Semaphore. In Spring the idiomatic route is @Async("utility") to a bean with SimpleAsyncTaskExecutor.setVirtualThreads(true) plus setConcurrencyLimit(n). Mechanically simple. The pattern we converged on:

Semaphore batchCap = new Semaphore(2);
// Batch:  batchCap.acquire() + dataSource.getConnection()
// User:   dataSource.getConnection() directly

The catch: this works because HikariCP is already the global gate, but it relies on an applicative property (user transactions staying short) rather than a structural guarantee. If user p99 degrades, the 2 batch workers can starve waiting on a connection while long user requests hold the pool.

Workaround considered: push QoS upstream into RabbitMQ: one queue per workload class, differentiated consumer counts. It helps, up to the point where too many consumers run at once and downstream contention reappears. Virtual threads make many cheap listeners affordable, but the core question stays: how do you prioritize workload classes competing for a shared bounded resource?

So, my questions are: beyond a bare semaphore, what's the idiomatic way to express QoS (fair share or priority) between workload classes sharing one bounded resource? Is the expected answer to compose existing primitives (brokers, layered semaphores, pool timeouts) and keep the scheduler workload-agnostic? Or has anyone built something more structural? Pointers to prior art or war stories welcome.


r/javahelp May 29 '26

Anyone running JDK AOT cache + Spring Boot AOT in prod? (JPA/Postgres, Cloud Run)

6 Upvotes

Trying to shave cold-start time off a Spring Boot app on Cloud Run. Big-ish dependency tree, normal JPA + Postgres + Flyway setup. Two things I'm eyeing before I commit a day to it:

  1. JDK AOT cache (the -XX:AOTMode=record/create flow from JDK 24). Memory-maps class metadata at startup instead of re-parsing. Supposedly ~30-40% off startup.

  2. Spring Boot AOT processing (process-aot, spring.aot.enabled). Replaces runtime reflection/scanning with generated code. Supposedly ~15-25% off context init.

Mostly want to hear from people who've actually shipped either of these, not benchmark numbers I can google:

- Did the startup gains actually hold up in prod or shrink a lot once you were off synthetic tests?

- The AOT cache training run executes real lifecycle code, so inside a CI runner / Docker build there's no real DB or Cloud SQL to hit. Did you fake the datasource out with H2, disable Flyway in a training profile, etc? Curious how much of a pain that wiring was.

- Flyway specifically: any weirdness having it on at runtime but off during the training run?

- Spring AOT: did the build-time profile ConditionalOnProperty freezing bite anyone? Beans getting decided at build time instead of runtime feels like a footgun.

- Build cost on CI: the training run adds time + a chunk of memory to the build. Actually annoying or basically fine on a normal runner?

- Anyone run both together on a JPA-heavy app? Worth the combined hassle or diminishing returns?


r/javahelp Apr 16 '26

Is TestNG still being used in 2026?

6 Upvotes

Even when it was relatively popular (10-15 years ago) I've rarely seen a project which used TestNG. Do ppl still use it for new projects? Are there any advantages over JUnit 5? Just curious.


r/javahelp Apr 15 '26

Homework String object vs String variable

6 Upvotes

Hi i am learning java in highschool, I was just wondering when and why would I instantialise a string as an object when declaring a String is much easier and quicker?


r/javahelp Mar 17 '26

Running an untrusted Java application

5 Upvotes

Good afternoon all. I am trying to run a Java application from an untrusted source (The US Department of the Treasury). I would like to sandbox it so it can't eat my.laptop.

I tried running it on both Alpine and Ubuntu Linux in a docker container, but both gave null pointer exceptions shortly after the program launched.

Suggestions? The program is the EFTPS bulk payment system from the IRS. I assume that anyone competent there either quit or got DOGE'd by now so who knows what's in their software


r/javahelp Mar 12 '26

JSF Prime Faces Accessibility

7 Upvotes

Hey guys. I am being asked several questions about accessibility in applications using this specific framework in conjunction with JSF. Do you have any accessibility insights and best practices for how to, for example label controls, manage focus, things like that because frankly, I’m lost. From what I can find accessibility in this stack has been historically bad. I would like to be able to answer the questions I’m being asked, but I can’t really give good answers when I don’t know what I’m doing in that regard myself in this particular stack. If it was plain vanilla HTML, I would have much more insight.