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!
JoinJCH
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!
Joinbst
I have a list containing 52431 elements, and another list with the same elements.
When I create my BST, the tree can be built.
But when I try to search for the number 4, I get a problem.
The issue is that when the root becomes 2, it only gets a left leaf (2 -> left)....
Fix try catch
Pls hepl me fix that
try {
LocalDateTime today = LocalDateTime.parse(events.getFirst(), DateTimeFormatter.ofPattern(dft));
System.out.println("--- Statistics ---");...
CSRF Protection in java microservices app
Hello I have troubles setting up csrf protection in my microservice app.
The architecture is that I use web service which is for desplaying the web content and it also contains login and register forms which are connected to auth service responsible for generating jwt. I also have eureka naming server for load balancing and api gateway in which all requests go throught and in filter the jwt token in validated. It is important to note that jwt is stored in cookies. How do I implement csrf token because I tried adding security config in web service but that resulted in 403 Forbidden for non get requests. It is important to understand that web service do not contain validating user credentials so it may be the case. Do I use api gateway for adding csrf header? Or do you have any idea how to solve my problem.
this is my config in web service
```...
Code review
Hi, I recently started working on a new project (reddit clone) I'd like to get some feedback on my code so far https://github.com/IamMax279/Chatter/tree/main
RoadMap request
I am a lite advance java person so will anyone tell me what road map i should follow for becoming dev , softwar dev, ai dev
while i know
1 oops
2 collections
3 exception ...
What should i focus on as a Freshman
Hi guys im a freshman majoring in computer engineering.
we're already at the middle of the semester and im kinda confused. ( I had no programming experience at the start of the semester.)
what should i focus more on?...
Keycloak 403 realm users query
I'm using keycloak with spring security as resource server with OAuth2, i created a user in this realm, and when this user tries to query the other users I get this :
403 Forbidden on GET request for "http://localhost:8282/admin/realms/master/users"
From what I found on the internet, there's a suggestion to either get the admin token but I'm not sure about the secure part ... or assign for each user the role to query users but this would be rather annoying to do for each user ... any idea what would be the best and secure way to this ?
...
Dynamic Maven Artifact using ASM - Module not found
I generate a maven artifact dynamicly. In order to modularize the Artifact I need to generate a module-info.class. This is my code to generate the bytecode:
```public class BytecodeHelper {
public static final String MODULE_INFO = "module-info";
public static byte[] buildModuleClass(String moduleName, String exportPackage) throws IOException {...
DuplicateJsonObjectContextCustomizer object
can anyone tell me how to exclude it i am new
```
Found multiple occurrences of org.json.JSONObject on the class path:
jar:file:/C:/Users/ashir/.m2/repository/org/json/json/20250517/json-20250517.jar!/org/json/JSONObject.class...
changing `.toString()` in subclasses without overwriting everything
```java
// in class Person (personID, name, age)
@Override
public String toString(){
return String.format("Person: %04d: [name:%s, age:%d]", this.personID, this.name, this.age) ;...
MySql jdbc connection error
Im trying to connect my Java program to mysql using JDBC. i wrote the connection code and set the URL, username and password, but the connection keeps failing.
Im getting a classnotfound exception when I try to load the mysql driver. i have installed the MySQL connector/j .jar file, added the driver to my vsc project ,wrote the connection code using Class.forName("com.mysql.cj.jdbc.Driver"). But the program still cant find the driver.
Also, vsc is confusing me. whenever i try to create a java project, the explorer panel creates a new project every single time and it becomes a loop of multiple empty projects.
could someone guide me on what i might be doing wrong?...
pratice problem
import java.util.Arrays;
import java.util.Scanner;
public class L1P01{
public static void main(String[] args){
Scanner reader = new Scanner(System.in);...
Ok i am VERY new to java and programming in Genral and need help for a Minecraft Plugin
OK i am VERY new to java and programming in genral and need help for a mc plugin (papermc)i manly used chagpt to generate the code and i cant find out how to get a main file and just am very confusd only having some basic pyton knowledge
the aim of the project was to create a server plugin that displays the tier of the player since only a mod exists and they allow players to use the API now it is a PvP tier list my aim was to have a /tiercheck command and as a next to the name ex [LT3] username ,in tab (also game mode)ex CPVP_LT3 username , if someone types in chat ex [LT3] username : message
web site this is based of: https://mctiers.com
API website :https://mctiers.com/docs/v1#tag/player
API website i am using :https://mctiers.com/api/search_profile/{username}...
Eclipse IDE not opening Process.
Hey! I'm developing a Minecraft Client! (That isnt that important to my issue) But the issue i have is that after i added discord RPC my game window wont load. It will load the RPC, the JDK processes and all the stuff needed but wont let me load the game, ive tried everything i can and cant get it to work. Would be nice if i could get some help. (i have no errors in my code) And i dont think im using gradle cause i decompiled with MCP and have a start.java and no gradle files
Manifold and formater
I currently use spotless with google java format. i wanted to use the manifold preprocessor but i can't find a way to setup spotless to be happy with it. Without butchering my code with //spotless off comment.
Can manifold be used with a code formatter ? ( i don't really care which one It's more about consistency inside the project )...
Transitioning from IT Support to Java/Spring Boot — What should I focus on next?
I worked in IT Support for almost 2 years and recently shifted my focus to backend development.
I’m currently learning Java 8, SQL, Spring Boot, and building basic APIs to understand the request → controller → service → repository flow.
For someone moving into backend roles, what should I prioritize next?
Spring ecosystem (Spring Data JPA, Security)?...
