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

I dont know anything about java, why wont this let me install NeoForge?

this is the latest version of java and ive reinstalled it twice and this NeoForge installer and its just giving me this same error
No description

help with JDK installation

I had jdk 23 and jdk 17 version and i needed jdk 17 version but i couldn't get system to switch to jdk 17 so i just deleted jdk 23 folder. But now when i try java -version ir jus gives me a blank line and i don't know what to do. I tried changing enviorments. I tried restarting and reinstalling. Nothing seemed to work. Maybe you have some suggestions?

Java constructors

As Ive read constructors are automatically run by java, but so is main () method, so whats their point and why cant I just put all of constructor code in front of main() method?

Syntax questions

Id like to know what these syntaxes mean: javadoc -d doc Hello.java jar -cf hello.jar Hello.class java -cp hello.jar Hello...

Help a newbie

I'm having trouble with setting up my Eclipse and I need to get my assignments done

Figuring out path to resources in built jar

Im currently doing this to read my shader files:
Utils.readFile("src/main/resources/assets/base/shaders/scene.vert")
Utils.readFile("src/main/resources/assets/base/shaders/scene.vert")
and it works when just testing in intellij, but if i build the jar it no longer works as the src/main/resources part of the path doesnt exist. Any solutions?...

How to organize build.gradle files and class structure in gradle project?

I want to make a plugin for teamcity and jenkins, but i'm not sure how I should be structuring my project to best fit that. I've seen examples where there are multiple build.gradle files at various levels of the project, but some plugin/dependency definitions seem redundant between them as opposed to being in a more top-level build.gradle (if that makes sense). I'm not familiar with gradle or java at all. Any pointers would be incredibly helpful! I also don't know how classes should be structured in a gradle project. I know there may be differing methodologies here, but I'm thinking the project structure might look like this:...

Need help converting Java file to Class.

Im not a code wizard or anything but i like to dive into minecraft mod packs are change values for better gamplay. I was trying to edit this mod and noticed that the file i was tring to edit was a CLASS file and not a Java one, so i used an online converter to change the Class into a java but now im wondering how to make the Java into the Class again. PLEASE, I NEED HELP!!!

Need help with GUI (swing)

This is my first project where I use swing and I need help making the textArea in bankStatementInterface larger in y axis. I've attached images with relevant code and with the interface.
No description

I am getting TLE in Leetcode on question 29. Please help me optimize.

I am using the most efficient code that I could understand. Please suggest how to optimize it for the test case where the dividend is int_max and divisor is -1. ```java public int divide(int dividend, int divisor) { // if(di(1<<31))...

MapStruct updater not compiling properly

I'm creating a REST API that handles product management. I currently have 3 Mapper (from MapStruct) for classes: Account, Product, and Variant. The branch I'm working on if you need to understand the structure: https://github.com/vianneynara/kuenyawz-api/tree/feature/21-initialize-product-variant-image ...
No description

Hi, I am having trouble in java with a project. Need help.

My code is only outputting one line. need help....

Any java window I open does really weird stuff

First off, I have no idea if this is something I should post here. I am by no means a java developer, I just want to figure out what is happening and if I have a virus. Any time I open a java application that opens a window, the background, buttons, etc start to change color, saturation, etc (example in image linked). Whenever I hover over a button, that button's color fixes, but then continues to do the thing. I don't know what is happening anymore, but thought I would ask people that know more than me about java. I have tried changing the java version it uses with no change in what happens. Is this some sort of virus, or did I just do something really stupid?...
No description

Preferences and Suggestions on when to use Java or Kotlin?

I am not trying to be controversial. Just thinking about writing a plugin for teamcity that seems to be able to use either. I think my work writes them with Kotlin and Gradle which I was leaning towards, but I can imagine Java has a more mature ecosystem. I haven’t used much of either, I’m not worried about my ability to learn, just want to know if there are situations where you might want to use one over the other. Is this custom plugin one of those situations?...

Override Java awt repaint system (or at least make a paint listener)

I'm trying to hook up Java awt to a glfw window. I have a container (no parent) with some children, like a button. I want to know when the container is trying to repaint an area, then make my own repainting system that sends the painted content to a texture to be rendered. How can I do this? I've tried overriding repaint and paint in the container, and they don't get called. I don't want to have to insert code for all components that I add to the container. Is there some paint listener thingy I can use to do this? Also, kinda related question. If the container is trying to paint a specific section, I create a BufferedImage, create a graphics for it, then tell the container to paint to it, right? But it would just paint the whole window to that image, but I only want that specific section. And is there a better way than the BufferedImage? I need the output to eventually go to a ByteBuffer. Hope this is clear enough...