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

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

Spring Boot Error

guys im trying to learn spring boot im creating my first project using postgresql as database and when i try to run the application i get this error how can i fix it : Database JDBC URL [Connecting through datasource 'HikariDataSource (HikariPool-1)'] Database driver: undefined/unknown Database version: 17.2 Autocommit mode: undefined/unknown Isolation level: undefined/unknown...

Spring Boot Security Hell

Currently I am building some web app. The problem is that I have a login method dedicated for anyone to use: ```java @PostMapping("/login") public @NotNull ResponseEntity<@Nullable String> requestNormalLogin(@NotNull @RequestBody UserLoginModel model) {...

Java 2D Game Transition between Maps

Greetings. I am having trouble with teleporting between maps in my game. My issue is that even though the value of the currentMap is changed in the EventHandler class, it seems like it is not passed in other methods or class. I have already added a method that refreshes the data of the map. However I am getting an ArrayIndexOutofBound Error or NullPointerException Error. It seems like it is reading the maxWorldCol and maxWorldRow of the original value of the currentMap, map 0.For instance: When Map 0,...

Code runs using IntelliJ but not in Visual Studio Code

I have a project me and my friends were working on. we initialized the project in Intellij using Gradle. when I try to run the program in vsc it gives an error. the cause of this error I believe is VSC cannot detect the resource folder where a part of the program needs to read to get input from. for some context here is the method: ```Java public void importTOF(String filename) { try (Scanner fileReader = new Scanner(Paths.get("src/main/resources/"+filename))) {...

Java GUI not loading images/ImageIcons help

Hey, so im going through the basics of GUI. At first it was going great but right now Ive been trying to a) set the ImageIcon of the frame and also setting the ImageIcon of a label but with my current implementation none of the pictures load and I dont know why. I have included both the code and the file strucutre (ps. i have also set the Pictures package to be Resources Root Directory): ``` import javax.swing.; import java.awt.;...
No description

Need help with calculator VScode 3 week project UI for the calculator

I am brand new and a friend told me to do this and so here I am doing it need help with the code needs to do it all division, multiplication, addition, subtraction able to divide by 0 (what he said) with a ui layout

Vscode Java Extension Errors But Gradle Extension Works Well

I want to read the spring framework source code and am ready to build up the environment in vscode. However, I confronted with the configuration errors. Why the vscode cann't resolve the class in gradle repo?
No description

Github Repo Question [Beginner]

I am continuing a previous project that has been a repo on github, but now want to make another repo for the direction I'm going with my project, is this possible? I'm familiar but still a beginner with Github. I have a project that I'm going to continue on, but want to make a new repo on Github for a clean slate. Is this possible? I'm afraid it will conflict but unsure if it will? How do I go about? Many many thanks!!...

[Philosophy] SE, Why we don't do it correctly ?

I've been thinking about this question for years, without truly finding the answer to it. In real world experience I've seen many engineers (developers, networkers, business analysts) from different levels (certainly most are juniors), most of the time where they get assigned to an issue or a task, they read description for maximum 30 mins, discuss a bit to clarify or add something in description, create their code branches and dive directly to code. Another example, I've seen it so much, in...

How can I dynamically change a plugin's version depending on certain criteria?

We have a multi platform project, however each platform has its own platform-dependent implementation of some classes. In our case, 2 of these target platforms require the same plugin, however they rely on different versions. So far, I have tried to dynamically set extra[pluginVersion] via either -PbuildingForB and gradle.taskGraph.whenReady , then setting a classpath in the dependencies block of the buildscript block, and finally applying the plugin after the plugins block. Unfortunately, this errors with Cannot get property 'pluginVersion' on extra properties extension as it does not exist. ```gradle.build.kts...

Help Required

got a practical exam tomorrow and i need some tutoring on double dimensional arrays, especially sorting of rows/columns in a matrix

How do you test GUI on a modern JavaFX application?

Hello, I was wondering how you are currently testing your moderns JavaFX applications. I am currently writing a JavaFX app with JavaFX 21 and Java 21. The build tool I am using is Gradle 8.x I have successfuly deployed JUnit 5.x for unit tests but I am struggling to put up something for GUI testing. I saw TestFX but the project seem quite abandoned and even the docs for setting it up is not up to date. ...

JavaFX UI won't update

```java public class BoardView extends GridPane { private final BoardPresenter presenter; private final SelectorView selector;...

Project Feedback

I would like to clarify, I am asking for feedback not help with my final project :get_gunned: . So I am not so new to java, I have had the opportunity to learn it before but I'm not so good at the OOP stuff. So straight to the problem, I have a project I had to build for my OOP Class finals, the project is FINISHED, but I think I need some feedback to improve my code etc. and since this project is for my OOP Class finals, I hope everything I did here so far counts as proper oop. So the project is a simple cli quiz program built with gradle that reads a txt file to get the questions from. there are 2 types of quizes, multiple choice and true or false. here is the link: https://github.com/alvinskylers/oop-finals.git...

Generate table images

hey, im trying to create table image of scorecard data, i used jswing to turn my HTML table into an image, but it's kinda slow – takes like 4-6 seconds any ideas on how to speed this up/ alternative method ? Would be a big help!
No description

How to properly implement scrolling a distance e.g with robot.mouseWheel()?

Hi, I am trying to recreate mouse scrolling behavior, but my current approach is only to set the amount of wheel turns with done with the wheel (using Robot). As far as I know it's dependent on the mouse settings given by the OS, that states what a notch turn does. However, does somebody know if it's possible to recreate behavior, that scrolls a certain amount of pixels? I need a fairly precise scroll where I can set the distance and I'm not sure how to achieve that. Hope my explanation was sufficient, any help is appreciated!...

Minecraft Client

So i am making a minecraft client in eclipse and im running into this problem when i run it: [18:43:28] [Client thread/INFO]: Setting user: Player296 [18:43:28] [Client thread/INFO]: (Session ID is token:0:Player296) [18:43:29] [Client Shutdown Thread/INFO]: Stopping server does anyone know how to fix it?...