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

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

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