Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

With more than 20,000 members, join one of the biggest and most active Java Communities on Discord! ☕

Join

java-help

❓︱qotw-answers

Program Randomly Quitting After Font.createFont() statement

After I try to get the font "ggsans", which is in the src/main/resources folder, the program randomly quits with exit code 1. Code ```java static {...

Unpacking packed int

I came up with these methods to pack and unpack ints: ```java public static int packInts(int first4, int last4) { return (first4 << 16) | last4; }...

Maven Archetype Catalog

Having some trouble getting a remote archetype catalog created. I figure it could be automatically managed by maven when I push an archetype but there doesnt seem to be good documentation around it. I'm using AWS CodeArtifact as my remote repo, which means I need to have all files inside a package, where the docs outline the archetype-catalog.xmlshould be at the root of the repo Anyone have any experience with this?...

Detecting only the first letter in a scanner

I made a course (Like it teaches and Tests Users Knowledge). And I just want to detect the first part of what they write. Like I made commands such as /start or /learn. But if they add a space or adds anything. It won't be able to detect it using switch. Is it possible to just detect the first part? Or the first letter? Because The Exams to answer the exam. You just put a letter like a, b, c, d. If they add a space it will say Unknown input.

Docker Issue in Spring Boot with Couchbase

I try to run my app as Spring Boot with Couchbase on Docker Here is my docker-compose.yml ``` version: '3.9'...

How do I handle an assignment like this folder structure wise?

Hi, Just have a very aching problem rn with an assignment I need to work on. Disclaimer: I am not looking for solutions as to code wise and how I should write the code, I am just looking to figure out how I would organize the folder structure for it? Please look through the images they provide some more information....
No description

Good source to study threading for newer JDK releases(17 and greater)

dev.java does not seem to have a page for threading, can someone please suggest me a source for it for newer JDK version(17 and greater)?

I am trying to create a simple java project Student Management System

I have a problem in compiling 2 java files I can't seem to connect them both. Those 2 java files are under the same folder
No description

Regarding career growth in java

Hello folks , I am Sriram and i have been practicing java since 2 years. Now i am at my finaly year of college. I have passion in java development and started Spring boot. I thought Cloud Java Full Stack developer is a good option for me. But now, i am so much confused about the job market today . I need to find the right path which focus both growth and future scopes. So please suggest me Is the options is worth and what i need to do to get there (Cloud Java Full Stack Developer).

IntelliJ or Visual Studio Supporting Java

How do I make Visual Studio/IntelliJ support java, like I can run the code and the terminal shows up. and contain Auto Complete, etc.

Career Options In java

Hello folks , I am Sriram and i have been practicing java since 2 years. Now i am at my finaly year of college. I have passion in java development and started Spring boot. I thought Cloud Java Full Stack developer is a good option for me. But now, i am so much confused about the job market today . I need to find the right path which focus both growth and future scopes. So please suggest me Is the options is worth and what i need to do to get there (Cloud Java Full Stack Developer).

Error in remove Node method in Java

```java public boolean removeNode(int key) throws Exception { AVLNode parent = null; AVLNode current = root; AVLNode newSubRoot = null; while (current != null) { int cmp = Integer.compare(current.key, key);...
No description

Hey guys,

I am trying to sort a String Array by the length of it's elements. I found only this solution: Arrays.sort(strs, Comparator.comparing(String::length)). Is there a more 'elegant' way to do it (strs is the name of the Array)?

Spring Boot SAML2 with Microsoft ADFS

Hello everyone, I have a problem with Spring Boot SAML2 with MS ADFS. It seems everything is working fine, but after a while the request will be too long and I get an error with message: Header field too long. I've realised that in the header more saml cookie are created over time. After every call of ADFS, SamlSession cookie size increasing a bit. What cause this size increasing and how can I solve this problem?...
No description

LWJGL missing EGL .dll

I hope someone here can help me with this. I just tried to add EGL to my game (for shared contexts), and it can't find the egl .dll file. Build.gradle: ``` val lwjglVersion = "3.3.3" val jomlVersion = "1.10.7" ...

VSCode and RedHat Java: wrong JDK for gradle tasks

Dear community, I've installed OpenJDK 21. I have configured JAVA_HOME and JDK_HOME accordingly, setup the JDK Runtime under Project Settings (JavaSE-21, which correctly points to the Eclipse Adoptium's jdk 21 folder). The build.gradle file is configured to run with Java version 21 (see following config). I have no clue why, when I start the Gradle tasks via the Gradle integration tab, it uses the java.exe included in the redhat's extension (java v. 17). Running gradlew from the shell, it works correctly (i.e. .\gradlew.bat init)...

Math in Java. What a struggle. Help. Please. Fast.

I am solving complicated mathproblems in an application that solves highly sophisticated geometrical tasks. Now i am struggeling, because I have to solve the following term to get the two x-values for zero. Is there some kind of util I can use to solve this?
0=x^2+-2*x*a+a^2+((R^2-r^2-c^2-d^2+a^2+b^2+-x*(-2*c+2*a))/(-2*d+2*b))^2+-2*b*((R^2-r^2-c^2-d^2+a^2+b^2+-x*(-2*c+2*a))/(-2*d+2*b))+b^2
0=x^2+-2*x*a+a^2+((R^2-r^2-c^2-d^2+a^2+b^2+-x*(-2*c+2*a))/(-2*d+2*b))^2+-2*b*((R^2-r^2-c^2-d^2+a^2+b^2+-x*(-2*c+2*a))/(-2*d+2*b))+b^2
...

Pls help. No operator is defined in streaming topology. Cannot execute.

So my task is to set up a Apache flink in my Linux Ubuntu wherein I should be having two data bases as postgress and MySQL . The 2 data bases should be connected in such a way that any change or update in my postgres database should I immediately reflect in my SQL database. But this is error I'm encountering while running my flink job. Pls help guys. I've some error in Java code only.....

Spring sessions with Redis

Hi, I have these 2 endpoints: ```java @GetMapping("/signin") public ResponseEntity<String> signIn(@RequestParam String username, @RequestParam String password) { var auth = authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(username, password));...
Next