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

Spring boot

Hi, I am a beginner at Spring Boot and I tried to configure my API espcially for user connexion. I have a database which is connected and it works. But I try to create a SecurityConfig and I have this error : java: variable userService not initialized in the default constructor In the code (after this message), I use @RequiredArgsConstructor so it should work... ...

Error if i start my bot visual studio code java script index.js

DiscordAPIError[50035]: Invalid Form Body 1.options[2][APPLICATION_COMMAND_OPTIONS_REQUIRED_INVALID]: Required options must be placed before non-required options
at handleErrors (C:\Users\ALYA060711\Downloads\Discord REALL\node_modules@discordjs\rest\dist\index.js:727:13)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async SequentialHandler.runRequest (C:\Users\ALYA060711\Downloads\Discord REALL\node_modules@discordjs\rest\dist\index.js:1128:23)...

ImageIcon returns null when loading image from resources folder in VS Code project

I'm building a GUI for a Java trivia game using JPanel components. I have an image named gaming.png that I’m trying to load using the following line in my MusicTriviaGameMessagePanel.java private static final String IMAGE_FILENAME = "trivia/resources/images/gaming.png"; ImageIcon imageIcon = new ImageIcon(getClass().getResource(IMAGE_FILENAME)); ...
No description

Reflection in a Minecraft mod.

I'm trying to code a compatibility mod for Minecraft that uses mixins to add compatibility with optional dependencies. The mod is an addon to an existing mod called Pet Cemetery and has a mixin that adds compatibility with others mods that add TameableAnimal's. However it also has several lines of code specifically for if a couple of extra mods are added that need special compatibility. These mods should be optional however it is crashing without them because it is calling their classes at runtime. I've been tentatively consulting with ChatGPT on how to ensure that the methods and classes are not directly called at runtime but can still be called if the mod's are loaded. ChatGPT has suggested Reflection and I wanted to get you guy's opinions on this. My old Java professor briefly talked to us about Reflection and all I really know is that it's very advanced and can be dangerous if done improperly so I was hoping you guys could shed some light on this and whether chatGPT is giving me bad advice....

What tech stack choose for pet project?

Good evening, everyone! I want to create a pet project that will help me to get a job, but I have a few questions. So I will be glad if someone will answer them 😄 As I understood it, besides Java, Spring Boot, Security, MVC, Core, Postgres and JPA/Hibernate, Lombok, Mockito, Kafka, I also need to know some front-end framework (Angular or React)? ...

Looking for a Trusted Collaborator! 🌍

I have a job offer. What you will do: - Part-time job : 1-2 hours per day - Remote job...

Small Help

Hey everyone, I’ve retrieved the code from gufram.it and I’m trying to replicate the scrolling effect from the homepage on a test site. I managed to recreate the animation and image scrolling, but I’m facing an issue: everything is stuck in the top-left corner of the site. Since I used the original site’s code, there are probably some bugs, and I can’t figure out what’s preventing the full-screen display. My recoded site, along with my elements, is available here if anyone wants to take a look: https://github.com/Ce1yo/abondance....

does jpa repository use varchar(10) somewhere?

hey guys. i have this DB table: ```sql CREATE TABLE public.sales_orders ( id serial4 NOT NULL, customerid int4 NULL,...

ANSI Escape Code Not Working?

I'm making a recreation of a card playing videogame called Inscryption for my computer science class. I'm using ANSI escape code sequence ("\033[H\033[2J" & flush) to clear the screen in between updating the board state, but for some reason, these ghost characters have appeared that will not clear. They only appear when two specific functions are run in sequence, and appear to be a partially-run result of the first function. They will not clear when the sequence is used, and they're clogging up the board and making the game pretty much unplayable. I cannot find anything in either function that would do this, so after an hour and a half or so of testing, I'm concerned the problem might lie with the escape sequence? This project is due Wednesday, and I linked the code below on a throwaway java sandbox (editable, runnable, viewable). The functions I am referring to are public void printBoard() and public void printUI(boolean instructions), run as printBoard() --> printUI(). https://codehs.com/sandbox/id/java-main-ZJ4ONN...

Feedback on Spring Boot Project

So I’ve been working on this coding challenge for the past few hours but I can’t get it good enough to be deployed. I’ve tried a few different strategies but I either get a bunch of memory errors (which I’ve fixed) or I get a bunch of conditions I can’t meet for it to be good enough for production. My repo is here https://github.com/maltose26/Proxy.git I’d appreciate any feedback or guidance on how to debug this and test it properly locally and maybe there’s something I’ve missed in my understanding of the problem...
No description

Confused Tree help

I'm a beginner programmer learning about trees currently. I have a question about my confused pointer checker for my tree. The rules that need to be followed are as such: ●The root node’s confused pointer is always null. ● Nodes at odd depth have confused pointers pointing to their parent. ● Nodes at even depth have confused pointers pointing to a random node at the same...

can't make a virus that will be tested in "viruses from subscribers"

i'm making virus "bomb.exe/.java" and what i need to use to delete system (only for VM test purpose)

Implementing in java

Hi I am struggling with implementing codes. I understand what data type etc means but, i can't seem to implement a program after reading the question. I have a practice exam question uploaded by my instructor and was wondering if anybody could help me with my issues. My exam is next week Monday and also another exam in the same day....

Programming in Java

Hi I am struggling with implementing codes. I understand what data type etc means but, i can't seem to implement a program after reading the question. I have a practice exam question uploaded by my instructor and was wondering if anybody could help me with my issues. My exam is next week Monday and also another exam in the same day....

Feedback on Domain Model – Programmatic, Naïve, or Well-Designed?

Hi all, I’m currently reviewing the domain model from our seminar (see attached image), and I’d love your input. Would you describe this domain model as programmatic, naïve, or does it reflect best-practice design principles?...
No description

java executable

hey everyone! I'm rather new to this server so I'm still trying to understand how to ask questions: I'm trying to create a standalone executable of my java program, but I can't get the JDK-22 bundled with the executable. I exported the jar file from eclipse and I'm using launch4j to create the executable the executable runs fine on my machine, but I have the appropriate version of java on my machine...
No description

Lists in Java Spring Web and with the Streams API, are they guaranteed to be array-backed?

I am quite confused when working with Java Spring Web as well as the Streams API regarding what kind of Lists are being provided. Especially in the cases when I call Streams.toList() and if I specify a request body to contain a List. Will these lists be backed by arrays in order to provide constant time access? I previously just assumed (not sure why) that they returned Linked Lists, but I have gotten to a point where I need to use .get() on my lists which worries me about performance.

Rest Api Endpoints

Hi guys, i have a theoretical question that it came when i start building a auto repair shop about the Rest Api Endpoints... My question is when i have groups of users beside the authentication that will be implemented accordingly , i should have a single users endpoint or different based on the user's role and in the users to have only the shared functionality?