Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

We are a Community full of Java developers. Connect with other devs, get help, help others and do much more!

Join

java-help

❓︱qotw-answers

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.
No description

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}
There's an error that says:...

set settings

i installed IntelliJ IDEA but how can i have run application
No description

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 ...

Can someone please explain to me how this works

public class LinkedList { . . . public void addFirst(Object element) {...

SPRING BOOT vs VERT.X

Hello, everyone! I’m starting my journey as a back-end developer in Java, and I’m currently exploring Vert.x and Spring Boot. Although I don’t yet have solid professional experience with either, I’m looking for tips and advice from people with more expertise in the field. I’m a big fan of performance and always strive to maximize efficiency in my projects, aiming for the best performance at the lowest cost. In all the benchmarks I’ve analyzed, Vert.x stands out significantly in terms of performance compared to Spring Boot (WebFlux). On average, it handles at least 50% more requests, which is impressive. Based solely on performance metrics, Vert.x seems to be the best option in the Java ecosystem, surpassing even Quarkus, Spring Boot (WebFlux/MVC), and others. That said, I’d like to ask: What are your thoughts on Vert.x? Why is it still not widely adopted in the industry? What are its main drawbacks, aside from the added complexity of reactive programming?...

Compiling class file to Jar always fails

so, im trying to compile a class file to a jar but I always get an error saying that it couldn't parse file arguments, what do I do?

Adding to unicode

I'm trying to take a phrase from user (EX. "ABC"), and add 2 to the Unicode. After adding two to the Unicode, it would then convert it back to a character. for example: input: ABC output: CDE...
No description

countDigits I need help

Hello I'm studying Computer Science and cant solve this problem right. Write a method that counts how many times a specific digit a appears in the decimal representation of a number b. It is guaranteed that the number b and the digit a are both greater than or equal to 0, with a being at most 9. Even if b = 0, the method should correctly determine whether and how often the digit a appears. ...

Weird Error when running/calling FATJar

What is this so called Graphic Device initialization failed for d3d, sw and Error initializing QuantumRenderer. running the App like following: ``` rem CONFIGURATION...

need help to import pdfbox using gradle

Hello, i need help using pdfbox in java, im trying to import it using gradle, I am using JDK21
No description

Problem Accessing yml elements using java for minecraft

Problem Accessing yml elements using java for minecraft : i'd like to have kits where i give players some blocks defined in the config.yml but when i try it, it doesn't work, the yml is valid, the code too, the list in't null, but doesn't show any element event if i put a basic element at the start of the list (BEDROCK one) Version mc + spigot 1.16.5...