JCH
Java Community | Help. Code. Learn.
We are a Community full of Java developers. You can come here to connect other devs, get help, help others and do many more things!
JoinJCH
Java Community | Help. Code. Learn.
We are a Community full of Java developers. You can come here to connect other devs, get help, help others and do many more things!
Joinjava: cannot find symbol symbol: method builder()
before you ask, I've already enabled annotation processing in my spring boot project. I don't really know what else I can do
Best Design Approach
So im making an API for a marketplace and i have different kinds of listings (footwear, clothes and accessories) where the enum attributes "subcategory" and "size" would change based on what kind of listing it is, what would be the best design approach for creating these listings? inheritance? factory? Thanks
N+1 Hibernate.
I've got problem with fetching data. Here is my code:
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter...
i have a problem understanding nested for loops
```for (int i = 1; i <= 5; i++) {
for (int j = 1; j <= i; j++) {
System.out.print("*");
}
System.out.println();...
Increasing max stack size
Trying to increase the max stack size, but when I do it said it "Could not find or load main class org.conspiracraft.game.Main"

How to switch a JavaFXML project from JDK 22 to Java SE 8?
I have imported a project on NetBeans to analyze but all the classes come out as errors and such. The best Java version I can use is Java SE 8 which has JavaFX 8, but I don't know how to switch the platform for the project. I already installed OpenJDK 8u432 but the IDE can't recognize it to have JavaFX 8. Any help on that?

unable to import Gson java dependency to my Maven JavaFXML Project
I have imported a code for a Maven JavaFXML Project and can't add a Gson jar file to my project. it is a required dependency and right clicking the Java Dependency folder doesn't have any options to offer. I have installed the Gson jar file for use and I just need to add it to the project. Ignore the Gson in the 'Dependencies' folder as it was a solution that didn't help.

Type Handler Issue in MyBatis of Spring Boot
I have a problem about Type Handler Issue in MyBatis of Spring Boot. How can I fix it?
Unable to build a JavaFX code on NetBeans 17
I have installed and used JavaFX 21 on NetBeans 17 and wrote simple coding to build an interface. I ran the program but gave me an error saying that the program failed to build. My initial thought was that the versions are included in JavaFX 21 but I have my doubts. Someone recommended that I work with JavaFX 8 but I couldn't find a source to download it from. Either helping me to solve the error or to install JavaFX 8 would be appreciated.

Display an Image in a New Dialog When a User Enters a Keyword
I am working on a Java Swing application where I want to display an image in a separate dialog when a user enters a specific keyword in a form.
Here’s what I have so far:
A JDialog for the form, with a JTextField where users can input a city name and a button to confirm.
I want the program to check if the input matches a predefined keyword (e.g., 'Barcelona')
If the keyword matches, it should open another JDialog displaying an image of that city (e.g., 'barcelona.jpg')...
Mockito: mockStatic is underfined
No matter what I try I get the error "mockStatic(Class<FacesContext>) is undefined for the type TestMainPage". I've tried several differnet combinations of dependencies. I'm using Eclipse and Maven. Here is what the dependency section of my POM currently looks like:
```
<!-- JUnit for tests -->
<dependency>...
I have a configuration in my Spring that includes a logging level:
logging:
level:
'[org.hibernate.persister.entity]': ${LOG_LEVEL}
logging:
level:
'[org.hibernate.persister.entity]': ${LOG_LEVEL}
Gradle H2 issue with MSSQLServer Mode
Our app is in Spring boot 3, with Gradle in a multi module project and in our test conf we're using ghe datasource url with MODE=MSSQLServer
Now we tried refactoring our code to make it a monolith, but the H2 database now has issues with all the Sql server sql's (like SP_RENAME)
I checked everything 3 times and I don't see any changes that could cause this, and I even found that even H2 with the mode should not be able to handle these kind of sql commands, but how was it working before ?...
Memory Leak Help
I'm the sysadmin for a heavily modded Minecraft server, keeping all of the different mods playing nice with each other through my own patch mod. I've been using Java for about 7 years now (sidenote: christ), and even worked with it professionally for a while. I'm trying to track down a memory leak that's running the thing to a halt.
Basically, Player objects are getting retained even after the players they correspond to have already disconnected, causing their packets to back up and overflow the heap. I opened the heap dump in Eclipse MAT and was able to figure that out after a lot of OQL, but I can't see what's retaining them. The shortest paths to all GC roots are weak references, and the incoming connections page is crowded by objects that will be freed when the player is.
Would anyone be willing to look over the heap dump with me, or otherwise help out through a call? I'm completely stumped, and I have 50 people relying on me to fix it, so I really need some help....
Error when running .jar on Raspberry Pi
```pi@pi4:~/apps/Boss-Beta $ java -jar
Boss.jar -noGui
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)...
Loom, Postgres, Hikari
Does anyone already solve problem with virtual threads and hikari + postgres?
A create semaphore for connections but it didn't help well...
Hey guys,
I am trying to solve a problem on Leetcode that asks to retrieve the number that occurs the most from an int array. I managed to put all numbers into a hashmap as keys, and values as their occurrence, but I can not figure it out how to retrieve values of n element from a map. (Just started learning Java, maybe I am completely off here :D). Is there a way to get the value of the n key of a map, or only for keys I know what their actual value is? Hope my question makes sense...
SpringBoot missing certain fields on auto generated repository
Hello,
I have a maven springboot project using an H2 database. I have a module class with three fields; name, code and mnc
You can see the first few lines of this class below
...