Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

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

Join

java-help

❓︱qotw-answers

Need help with padding(i think?)

My program uses string.format to print a table out line by line from a file, which works fine, but it doesn't line up well I tried to fix this by making the end of each column add spaces onto the end, so that they would all be the same length - however I cant figure out how The closest ive gotten is by using 0 padding, but #1 this only works with integers, and two this only seems to work on the left side...

Naming convention question

I have a quick question on naming convention for an object that is the same structure (same fields, etc..) for a response and request object. Should I call it ObjectRequestResponse or just Object or just ObjectResponse? I'm wondering if any of them are better?

im trying to figure out why the key input work randomly,

``` random = new Random(); this.score = score; this.borderHeight = borderHeight; this.borderWidth = borderWidth;...

Shapes drag and drop

Hii, does anybody know how I can make those shapes on GUI? My program must allow users to create a flowchart, but I've never worked with shapes or drag and drop and I've been looking for videos or resources and I'm confused 😭 any help will be greatly appreciated 🙏...
No description

How do I run sql scripts in yaml docker?

I have automation task where I want to initialise table ,data in Spring . I have made the sql scripts in a single sql file but it's not executing the scripts . I found answer jn stackoverflow but it's not working in java 21 . ...

Excluding Gradle plugin dependencies in submodules

I have two different gradle plugins, one in the root project, and another in a submodule. The thing is, I'm getting a reflection related stacktrace when loading the Gradle project which originates from a dependency (I think it was something like Jackson faster xml or something). Removing said plugin in the root project fixes this issue. My conclusion from that is that the plugin in the root project has a different version of that dependency than the one used by the plugin in the submodule. How do I exclude plugin dependencies in submodules? (Sorry for minimal information on that stacktrace, I'm traveling at the moment)...

why cant i make requests to my endpoint?

hey guys. in java spring i have endpoint localhost:8080/sol/payments. and i want to call it with Postman. my body is: ``` { "transactionId": "111", "clientId": "111",...

Looking for a right partner

Time is our most valuable asset, yet so many hours are lost—whether in sleep, unproductive moments, or distractions without progress. Yes, enjoyment is important, but once you reach your goals, you’ll have endless ways to enjoy life. Playing isn’t the only way to find fulfillment. Your current income might be enough for living, but with the right mindset, you can achieve so much more. Don’t doubt your abilities—your potential is limitless....

ClassNotFound: When using VirtualMachine.loadAgent

Hello im trying to dynamically load an agent with virtual machine but when I load on a non custom class loader jvm it works but when I load on a custom one it throws a ClassNotFound and my agentmain is not called is there a way to load the agent on the custom class loader or not

cant figure out how to setup vscode with javafx

I've created a java project and added the lib files from javafx on the project settings, still getting package does not exist, am I forgetting something?

Is anyone using testcontainers for tests?

Is anyone using testcontainers for tests? If so, what are some cool things you have done with it over something like with in-memory db?

about halting paintComponent() on window resize

when using Java Swing. What would be the way to halt the paintComponent() from being called when the frame gets resized/minimized/extended Basically the default model is paintComponent() gets called at the start but also upon window resizing. This is why the graphics disappear upon any manipulation of the frame. I tried asking Perplexity Pro but I was not able to implement running any of these options of code....
No description

Implement discord authentication

Hi, im tring to add login with discord in my nextjs and springboot application but i can't find what should be the best way to implement it, i reimplemented in a lot of different ways but nothing seems the right way to do it.

graphics

im trying to learn java graphics what class has graphics

Lombok Not Generating Getters in Spring Boot with MapStruct & Maven (Java 21)

I'm working on a Spring Boot project and facing an issue where Lombok is not generating getters for my entity class. Despite using @Data or @Getter, the getters are missing at compile time, leading to errors like "cannot find symbol getEmail()". My Setup (Dependencies & Plugins in pom.xml): ```xml <dependency>...

Thoughts on this ER-diagram?

Hi everyone, I'm working on a workforce scheduling system as part of my bachelor's thesis project, and I'd love some feedback on the ER diagram I designed. The system is designed to automate and optimize employee scheduling in workplaces where employees have different roles, work percentages (e.g., 40%, 60%, 100%), and preferences for shifts.
The goal is to allow managers to efficiently allocate shifts while considering constraints like availability, location, and shift types. Employees should also be able to express scheduling preferences (e.g., preferred working hours or locations).
ER Diagram Breakdown: ...
No description

help for javascript (code.hs) beginner

hey! if anyone can explain this to me as I’ve been struggling thank you!
No description

Rendering too resource-intensive

I am using Swing to render a graph in a window; however rendering is taking too long and is too resource-intensive. What changes can I make to help with performance? Here is the class responsible for rendering my graph: ```java public class GraphPanel extends JPanel { private Graph graph; private PathfindAlgorithm algo;...
No description

Not getting right platform details

I am working to get game presence data via discord but i am not getting right platform details. How to get is any other package or functions or classes in java?
Next