Java Community | Help. Code. Learn.

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!

Join

java-help

❓︱qotw-answers

how do i use automatic module names in vscode?

they appear as a module in the autocomplete, but always say it cant be resolved to a module
No description

Problem of "project setup on java"

Hello, I am reaching out because I have an issue with my Java IDE. I cloned a Git project using HTTPS as usual, and when I opened it on my PC, I could see the entire project structure for the first three seconds. However, after that, everything disappeared as if it were hidden (shown in orange in the screenshot). After investigating, I noticed a notification from the IDE suggesting to exclude some folders from Windows Firewall. Unfortunately, that did not resolve the issue....

ProGuard Guides?

I wan't to shrink the size of my .jar file using ProGuard, but I can't figure out how it works

Springboot ignoring roles

I am new to springboot and decided to follow a tutorial on how to create a JWT RestApi with it. Upon doing this I noticed that it now completely ignores my @PreAuthorize annotations. In a rest controller class: ``` @PreAuthorize("hasRole('ADMIN')")...

Ensure method is called after all subclass constructors have finished but before object used

I am making a game and have a class that could be extended a lot, with multiple levels of classes. The subclasses may implement a wide arrange of interfaces. I have ran into an issue where calling instanceof or Class.isAssignableFrom causes significant overhead. I decided to cache possibly null instances of each interface in the object (this is a "type" object so there won't be many of them), and the fields are initialized at construction, like this: ``` public abstract class Container { public final IThis iThis; public final IThat iThat;...

imported classes not accessable

they are imported and in the maven dependencies, but refuse to work
No description

Library not loading

I have made a java program that includes the JErrorMessage library. It works when i run it in my IDE, but not in the .jar executable
No description

JNI programming

Hi there, what is the best IDE for JNI programming? Also, is there any relevant courses/sources?

How to play a quick noise, and play a low pitched hum until told to stop.

I want it to play instantly instead of taking a second to load like the last time I worked with audio in java, how can I achieve this?

Spring boot security

So I am new to SpringBoot security and have tried searching this but have not managed to find any concrete answers. Upon authorising HTTP requests in the SecurityFilterChain class it has .formLogin() and .httpBasic(). I was wondering what is the difference between these two? Should I use both or just one of them? What circumstances should I use either or in? I am aware that .formLogin() creates a HTML log in page but apart from that what is the difference with these?...

better data structure to handle entity stats

https://github.com/asdru22/Game2D/blob/master/src/main/java/game/stat/Stats.java i have this class that can store stats like damage, health and speed. each every entity has a local stats variable. i dont like my current implementation since it involves a lot of casting. are there better alternatives?...

Common resources folder can't be accessed from different modules.

Hello! Has anyone taken the courses from Spring Academy? I need help with working with classpath across different modules. One of their tutorials include a common resources folder which is later accessed by different labs. For some reason, the code is not working in my pc. ``` @Configuration...

Tools/libraries to make a simple interface in java

Hello, I'm quite new with Java, and I'm having trouble in building the interface for my group project. Is there anyone are able to help teach me how to do it? Thank you.

creating an executable java file

according to Visual Studio Copilot I'm doing everything right, but I keep getting the following error '''jar : The term 'jar' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again....

Hello! Can anybody help me?

I'm creating a JavaFx Application for a project with a friend. He created the .fxml, .css and controllers we needed, buuut... when i try to run the project (we're using gitHub and Visual Studio Code) this error appears: Exception in Application start method java.lang.reflect.InvocationTargetException We're learning 😦 this is our start function in main:...

Importing and compiling issues

I've been aided heavily by ChatGPT and VisualBasic copilot but we can't seem to fix this issue. I'm importing gson which didn't seem to exist, so I downloaded 2.11.0 version of gson and added it to a lib folder in the correct directory, but the compiler seems to not notice it or care about it.

Java cli tool ideas

Guys please suggest me different automation cli tools that I can create using java for linux and windows

Threading issues

How to fix this threading issue that exists only on Windows? https://spark.lucko.me/FlCb0anrpw...
No description

Spring security failing to convert String to RSA keys

getting the following error: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfig': Unsatisfied dependency expressed through field 'privateKey': Failed to convert value of type 'java.lang.String' to required type 'java.security.interfaces.RSAPrivateKey'; Failed to convert from type [java.lang.String] to type [@org.springframework.beans.factory.annotation.Value java.security.interfaces.RSAPrivateKey] for value [${jwt.private.key] not sure what to do and havent been able to find much on this, anyone have any idea? thanks...