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

prepping for an exam, new to java & might need help understanding some stuff

im just gonna put in questions here as I study ill probably not ask a whole ass program explanation unless its fully indecipherable to me ill bold whatever is the tldr version if you dont want extra context...

system doesn´t end once I enter -1 in the console how can I change that

`´import java.io.*; public class Solution { public static void main(String[] args) throws Exception { ...

Need help fast pls (minecraft code)

java.lang.NullPointerException: Cannot invoke "im.furious.utils.drag.Dragging.getX()" because "this.dragging" is null This error does not allow drawing hood elements. ds: 196devblog...

[Spring] Should I have a custom Objectmapper as a static attribute in my service class?

Currently have an Objectmapper, from the JSON jackson serialization api, from my configuration class used in my Service class. Using lombok, realized the @AllArgsConstructor doesn't create a constructor for static attributes. It makes sense to have it be static in the conventional sense, since it should be shared between service instances. It is making it hard to do unit tests. As best practice, should I be having the objectmapper attribute in my service class be static or not? I'm thinking I can forgo making it static since I'm getting a universal Objectmapper from the spring context anyway....

Gradle & Java Version

Im searching for the correct garde & java version to run thsi repo: https://github.com/boazy/TWEditorEnhanced currently i tried gradel v8: java 20 7:java20 6.22 java20...

scanner blocking thread close

in a project im working on i have a client with a sender and receiver thread. When the server send the quit command im also sending the clients the "quit" message which should intterupt their sender and receiver threads. The receiver ends just fine but the sender (that has the scanner) is stuck waiting for the next line. What's the appropriate way to handle this? i tried closing the senders' scanner in the receiver among other things but nothing worked

PMD Java source analyzer insights in code insights section

Hi I was trying to see if it's possible to use pmd and display the error as a highlight like intellij ones . I found for vs code...

i need help for my code

Hi everyone i need help for this code my teacher want to do a pyramid with star in java with while and if not whit for ! can someone help me to result my problems
No description

Java Hibernate with Negative Enums

I'm using Hibernate for JPA for persisting objects to my database. One class has four possible statuses that I want to represent with an enum, and I want to use a negative status for DELETED for consistency with previous classes: ``` public enum Status { PENDING (0) APPROVED(1)...

Beginner to Java - Help

Hi! This is not a question concerning one line of code, so if there’s a more suitable place for this please redirect me. I would also like to state that I’m a beginner at Java! I have started my first project being a text adventure game in Java and I am wondering if someone more experienced could be kind and let me sit down and talk over it? I’m hoping to learn from it, get some input on how I can improve structure and format classes, something I find a little confusing. It would mean a lot! Thanks 😄 Feel free to dm me or @ me!!...

Problems with dates

Anyone can help me? i want this patterns in my LocalDate but always get a exception
No description

Public class error

Hello! This is probably a stupid question, but I am trying to follow a tutorial on unit-testing but am getting an error on my public class. I do not understand what is wrong, as the class name is matching the file name- please help me out! Thank you. I'm a beginner!...
No description

keeping track of clients connected to server

i have a server class that implements the runnable method, and i want to keep track of the clients connected to it so i can disconnect all of them via server class method. I've seen that a common practise is to use clientHandlers that are Runnable so that each client can run concurrently with the others, but i still dont get how to store the connected client object to the server (if its even possible)...

I want to understand the need of keys in JPA (beginner)

Hi , Jpa entity in java to me is an interface for Database operations for classes . But , I don't understand need of defining primary key/foreign key in entities. It could be managed by database engines. To me , it seems like Database is a Data at rest concept while Entity is a data in transit concept...

Kerberos, SSO authentication doubt

I have an internal Java 17 spring-boot application with SSO validation using Kerberos and SPNEGO. Our setup includes the following: AD: Azure AD KDC: Multiple (Local) Application Host Server: Azure cloud...

What is inherited from ?

how do I find out which class is inherited from this I don't have anything
No description
Next