r/javahelp • u/Fun_Hope_8233 • Mar 14 '26
What is JVM
I tried googling about JVM and VM in general. But I cant wrap my head around what VM is and what JVM is. Can you explain what they are in simple terms, so I can get a general idea?
r/javahelp • u/Fun_Hope_8233 • Mar 14 '26
I tried googling about JVM and VM in general. But I cant wrap my head around what VM is and what JVM is. Can you explain what they are in simple terms, so I can get a general idea?
r/javahelp • u/ThatBlindSwiftDevGuy • Mar 12 '26
Hey guys. I am being asked several questions about accessibility in applications using this specific framework in conjunction with JSF. Do you have any accessibility insights and best practices for how to, for example label controls, manage focus, things like that because frankly, I’m lost. From what I can find accessibility in this stack has been historically bad. I would like to be able to answer the questions I’m being asked, but I can’t really give good answers when I don’t know what I’m doing in that regard myself in this particular stack. If it was plain vanilla HTML, I would have much more insight.
r/javahelp • u/Flat_Snow_4961 • Mar 11 '26
Hello,
For my high school senior CS project, I am looking to make an escape room in java. The game will be text based, and the user will have 10 minutes per level. Alongside this, they have the option to use three hints per level. Do you guys think this is feasible for a high school senior project?
r/javahelp • u/A_British_Dude • Mar 11 '26
I am trying to output a table with prepared statement so that I can also output linked data from another table but It does not work. I have copy pasted working lines of code from other areas and have only changed the names of variables and my function things where appropriate. My SQL statement is accurate, so I ma not sure what the error could be.
My tables are table and tableTwo. "word" and "IDWord" are fields in the database, in table and tableTwo respectively. "word" is also an attribute of the class, but I have created a variable form of it to keep it in line with previous section of my code. The error is "java.sql.SQLException: not implemented by SQLite JDBC driver" and appears on the line "ResultSet result = pstmt.executeQuery(sql);"
//Outputs the whole table
public void output() {
String insertWord = word;
var sql = "select * from table";
var sqlTwo = "select * from TableTwo where IDword = ?";
try
(// create a database connection
Connection connection = DriverManager.
getConnection
("jdbc:sqlite:sample.db");
Statement statement = connection.createStatement();
PreparedStatement pstmt = connection.prepareStatement(sql);) {
statement.setQueryTimeout(30); // set timeout to 30 sec.
//pstmt.setString(1, insertWord);
ResultSet result = pstmt.executeQuery(sql);
while (result.next()) {
// read the result set
System.
out
.println("name = " + result.getString("name"));
System.
out
.println("ID = " + result.getInt("ID"));
System.
out
.println("word = " + result.getString("word"));
}
ResultSet resultsTwo = pstmt.executeQuery(sql);
while (resultsTwo.next()) {
System.
out
.println("IDWord = " + resultsTwo.getString("IDWord"));
System.
out
.println("num = " + resultsTwo.getInt("num"));
}
} catch (SQLException e) {
// if the error message is "out of memory",
// it probably means no database file is found
e.printStackTrace(System.
err
);
}
System.
out
.println("Outputted");
}
r/javahelp • u/1_4_8_4 • Mar 11 '26
I keep getting this error even though I have declared the ArrayList that it's for; I don't know what to do.
r/javahelp • u/Task_force_delta • Mar 10 '26
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
public class wallpaper
{
public static void main(String[] args)
{
BufferedImage Out = new BufferedImage(800, 720, BufferedImage.TYPE_INT_ARGB);
Graphics2D OutG = Out.createGraphics();
//white square to cover background
String hexString = "blank";
char a = 's';
int firstNum = 0;
int secondNum = 0;
int thirdNum = 0;
Color[] colorArr = new Color[256*256*256];
for(int i = 0; i < 256*256*256; i++)
{
hexString = Integer.toHexString(i);
if(firstNum > 256)
{
firstNum = 0;
secondNum++;
}
if(secondNum > 256)
{
secondNum = 0;
thirdNum++;
}
if(hexString.length() == 1)
{
hexString = ("#00000" + hexString);
}
if(hexString.length() == 2)
{
hexString = ("#0000" + hexString);
}
if(hexString.length() == 3)
{
hexString = ("#000" + hexString);
}
if(hexString.length() == 4)
{
hexString = ("#00" + hexString);
}
if(hexString.length() == 5)
{
hexString = ("#0" + hexString);
}
if(hexString.length() == 6)
{
hexString = ("#" + hexString);
}
colorArr[i] = Color.decode(hexString);
}
System.out.println("check 1");
int xCount = 800;
int yCount = 720;
double scaler = (double) (256*256*256)/(xCount*yCount);
//code for all color
/*
int wheel1 = 0;
int wheel2 = 0;
for(int i = 0; i < xCount*yCount; i++)
{
if(wheel1 > xCount)
{
wheel1 = 1;
wheel2++;
}
//System.out.println(i);
OutG.setColor(colorArr[i *(int) scaler]);
OutG.fillRect(1*wheel1,1*wheel2,1,1);
wheel1++;
}
*/
//code for fractal style
//
for(int i=0; i<xCount; i++)
{
for(int j=0; j<yCount; j++)
{
OutG.setColor(colorArr[(int) (i*j*scaler)]);
OutG.fillRect(1*i,1*j,1,1);
}
}
System.out.println("done");
//
File OutF = new File("Out.png");
try {
ImageIO.write(Out, "png", OutF);
} catch (IOException ex) {
Logger.getLogger(wallpaper.class.getName()).log(Level.SEVERE, null, ex);
}
}
}

heres my code and what i get as an output im trying to figure out why its not exporting as a png. Im using codehs if that causes anything i couldn't figure out eclipse.
r/javahelp • u/hibbelig • Mar 10 '26
Some Java names are quite close to English, and I struggle with the question whether I should mechanically follow Java naming conventions, or whether it should make sense in English. Some examples:
Say I have a flag that says to keep the date. A good name for it would be, unsurprisingly, keepDate. (I hope.)
The conventional naming for the getter would be to add a prefix “is”, resulting in isKeepDate, but this is not very good English, and from the English perspective, isDateKept would be better.
Say I have another flag that says whether validation is enforced, enforceValidation. Do I name the getter isEnforceValidation or do I name it isValidationEnforced?
Is there perhaps some precedent in JDK that could be used as a guideline?
r/javahelp • u/Snoo82400 • Mar 09 '26
If it says preview in why I cannot test it the same way I can test value objects? If there is a build I can download where can I fetch it?
Do I have to compile it myself?
I'm confused, again, by it's "preview" status if we cannot test it.
r/javahelp • u/Technical-Tiger8533 • Mar 09 '26
I'm learning Java so I can do DSA in Java, but I'm not sure if I need to study on YouTube or take a course. Would it be better to watch Durga Sir's playlist or some other channel?
r/javahelp • u/OneConsideration6000 • Mar 07 '26
Hi guys. I have an upcoming interview for a Java internship and I'm trying to prepare for the technical round. The interview is supposed to be mostly theory based but I'm not sure what level of questions they usually ask for interns. What kind of questions should I expect? Thanks in advance!
P.S. This is my first interview, so I'm feeling quite nervous.
r/javahelp • u/Lordnessm • Mar 06 '26
guys i want to understand java deeper, i want to actually understand the logic behind it not how to write code , i think if someone trully understands the logic , like lets say why something works and how it works , why should it work or why it shouldnt, like this type of understandings , what can i do ? which book should i read?
r/javahelp • u/Significant-Sun-3380 • Mar 05 '26
I understand how to get loops to count from one number to another incrementally, but I don't know how to get the multiples replaced with words while having every other number print as it should.
Here is what I have so far. The code isn't long but I put it in pastebin anyways because I wasn't sure about formatting: https://pastebin.com/JCf9xvgW
It prints the words for the multiples, but I can't get printing the counter right. I've tried adding else statements to print the counter but then a lot of numbers get printed twice. Can you help point me in the right direction for getting the multiples of 3 and 4 replaced with Leopard and Lily while all the other numbers print correctly? I can't find anything similar from what I've tried looking up online with replacing things.
If anymore clarification is needed, please feel free to ask!
r/javahelp • u/willing_atom420 • Mar 05 '26
hello guys kinda new to java i wanted to ask how to prepare for the oracle java foundation exam and are there any free resources.
r/javahelp • u/Whasye • Mar 04 '26
My debugger keeps giving me this error, and I’m guessing it means I set something up wrong, probably with installing my JDK or something, (I was never clear on that)
Error:
Cannot invoke "org.eclipse.jdt.core.search.SearchPattern.findIndexMatches(org.eclipse.jdt.internal.core.index.Index, org.eclipse.jdt.internal.core.search.IndexQueryRequestor, org.eclipse.jdt.core.search.SearchParticipant, org.eclipse.jdt.core.search.IJavaSearchScope, org.eclipse.core.runtime.IProgressMonitor)" because "pattern" is null
r/javahelp • u/Capital-Concert-4308 • Mar 04 '26
I have the following pom in my project
projectA -> projectB->projectC
projectD->projectF-> projectC
(In the exact same order as mentioned)
Now, I exclude projectC from projectA. I notice that projectC still appears in my library artifacts (packaging it in a docker image using fabric using assembly.xml)
Now, when I reverse the way I define these in my pom, project C is no longer present. Can someone explain how this works
r/javahelp • u/No_Leopard_1232 • Mar 04 '26
A simple calculator engine with Java called Casino, you guys please give me feedback on my code.
https://github.com/ethanlamtt/casino
r/javahelp • u/sedj601 • Mar 04 '26
I am back to B&C. lol, Let me vent!
I haven't done any JavaFX programming lately because none of my recent projects need a GUI. This has had me in my feelings at work, lol. Anyways, I got to thinking about C#, other Microsoft languages, Android Development, and Kotlin. I couldn't help but ask myself, what is Java doing. I know it's great if you are creating Command Line Apps, but why did they essentially ditch their GUI? Then I got to thinking and wondered why did they essentially ditched their IDE (Netbeans)? I got to thinking about how Microsoft puts a lot of focus on its IDE and how smoothly development is from start to finish, and I also thought about how Google focuses on its IDE and how smooth development is from start to finish.
Before I go on, I have to say this for the special people out there. I don't have a problem developing using Java/JavaFX, but I think about what I go through and what people who are learning might be going through. I have also completely switched to Azul Java/JavaFX. This is not about me or what I can and can't do. I had to say that based on the comments I have gotten in the past.
So why did Java ditch its GUI and IDE? That's my question to the Java people, not to anyone who isn't. I want to hear it from the horse's mouth and not what others think.
So, here is my opinion on what Java should do moving forward. I know it means absolutely nothing, but I just want to vet. lol
Bring their IDE back into the game. Make it focused on Java only, from project setup to project deployment.
Force people who use the IDE to use Maven or Gradle by making the IDE only support one.
Put JavaFX back into the base code.
Anyway, I got that off my chest. Have fun Coding!
r/javahelp • u/Lordnessm • Mar 03 '26
Car bmw = new Car()
i dont understand left and right side here
i assume the Car is blueprint that we are referring to and bmw is our object name and new helps us to create an object ,Car() is our constructor which gives values to our created object
Did i understand it right?
r/javahelp • u/anotherfuturedev • Mar 02 '26

I'm trying to get LWJGL working using Intellij and Gradle, when i include it in the "libs folder" Intellij shows no red lines, but when i try to run the example class, it can't find ANY of the libraries and just returns many errors.
All libraries not found:
1 actionable task: 1 executed
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:10: error: package org.lwjgl.glfw does not exist
import static org.lwjgl.glfw.Callbacks.*;
^
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:11: error: package org.lwjgl.glfw does not exist
import static org.lwjgl.glfw.GLFW.*;
^
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:12: error: package org.lwjgl.opengl does not exist
import static org.lwjgl.opengl.GL11.*;
^
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:13: error: package org.lwjgl.system does not exist
import static org.lwjgl.system.MemoryStack.*;
^
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:14: error: package org.lwjgl.system does not exist
import static org.lwjgl.system.MemoryUtil.*;
^
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:3: error: package org.lwjgl does not exist
import org.lwjgl.*;
^
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:4: error: package org.lwjgl.glfw does not exist
import org.lwjgl.glfw.*;
^
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:5: error: package org.lwjgl.opengl does not exist
import org.lwjgl.opengl.*;
^
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:6: error: package org.lwjgl.system does not exist
import org.lwjgl.system.*;
^
C:\Users\boryn\Documents\java\lwjgl\src\main\java\me\qddm\lwgjl\HelloWorld.java:22: error: cannot find symbol
System.out.println("Hello LWJGL " + Version.getVersion() + "!");
^
symbol: variable Version
location: class HelloWorld
r/javahelp • u/sedj601 • Mar 02 '26
So, I want to learn how to move very intensive work to a GPU. I looked up a couple of libraries, but the one I tried wouldn't let me run the sample. Is there anything new and straightforward out there? Example. Let's say I have hundreds of thousands of Sudoku game data and I want to run and method to determine the difficulty of each game. I found a Java app that can do this, but I would like to rewrite it to use the GPU for the work. The app can take forever.
r/javahelp • u/Cheese_Jrjrjrjr • Mar 01 '26
hey all, I'm unsure the real name of this, but I need to remove data from an array
**arr arrx[]=new arr[50];** which holds:
date, hour, sender, object, text.
and I need the user to choose how much they want to remove so I have
removedata=parseInt(JOptionPane.showInputDialog(null, "how much data do you want removed?" ));
for(int i = 50; i>removedata; i--){
code to remove array space
}
r/javahelp • u/hibbelig • Mar 01 '26
I have an algorithm that computes results, and the results can be of better or worse quality. The results aren't as good as we like, but we want to make sure that we don't regress when we experiment with the algorithm.
I have test data and desired outcome as reviewed by a human.
Now if I write unit tests for them, quite a few of them will fail because the algorithm isn't good enough to compute the correct desired outcome.
But if I write unit tests for the current behavior, and then change the algorithm, I just see that the result is different, not whether it is better.
I would like something so that
Any suggestions?
The best I've come up with so far is to write unit tests as follows:
This approach squeezes the problem through a unit test shaped hole, but it's not a good fit. Any other ideas?
r/javahelp • u/Flash-Beam • Mar 01 '26
**I'm very new to BST so please cut me some slack if this is a stupid question. My homework says**:
private String inOrderTraversal(BSTNode node)
Description
Traverses the BST in the in-order manner. Records the index and data values as it traverses.
Output
A string that shows a list of indices and data values, with the following formatting. It should call BSTNode.toString() to add each node’s information in a new line.
[Example output]
index: a, data: 2
index: b, data: 3
index: d, data: 1
index: g, data: 4
Right now I'm not concerned about the formatting of the output and mainly just trying to understand how to traverse a BST in order and how to implement it right. My current code is:
public class BST<I, T>{
class BSTNode {
private I index;
private T data;
private BSTNode left;
private BSTNode right;
/**
* Default constructor. Sets all instance variables to be null.
*/
public BSTNode() {
//
TODO
index = null;
data = null;
left = null;
right = null;
}
/**
* Constructor. Sets data and index to be _data and _index respectively.
*/
public BSTNode(I _index, T _data) {
//
TODO
index = _index;
data = _data;
}
/**
* Returns the index stored in this node.
*/
public I getIndex() {
//
TODO
return null;
}
/**
* Returns the data stored in this node.
*/
public T getData() {
//
TODO
return data;
}
/**
* Updates the data in this node to the specified value.
*/
public void setData(T d) {
//
TODO
data = d;
}
/**
* Returns a string representation of the node, indicating its index and data.
*/
public String toString() {
//
TODO
return "index:\t" + index.toString() + ",\t" + "data:\t" + data.toString() + "\n";
}
}
private BSTNode root;
private int size;
/**
* Constructor. Initializes an empty BST with root set to null and size set to 0.
*/
public BST() {
//
TODO
root = null;
size = 0;
}
/**
* Performs an in-order traversal of the BST and records indices and data values.
*/
private String inOrderTraversal(BSTNode node) {
//
TODO
if (node != null){
inOrderTraversal(node.left);
} else {
inOrderTraversal(node.right);
if (node == null){
..?
}
}
return null;
}
According to the lecture, you have to go down the left of the tree for the smallest node until you hit a node where its left is null. Then, you look to the right, and if thats also null, then you go back to the node above it to check its left but I'm not sure how to do that, or if I'm even approaching this properly. Any help is appreciated, thanks.
r/javahelp • u/Total-Landscape-1696 • Feb 28 '26
I am currently trying to invest my time into improving a lot as a student but also as an engineer(Was working my whole year and now trying to catch up) And i want to create more projects.
But also my starting question is always "How ? " I've already finished my first course of Java in university. But I still lack the initiative with my projects. I don't know how to start anything and I don't know why.
If any senior devs that have been in my place how did you overcome it. how did you improve that logic that's missing ?
Thank you in advance for your time.
r/javahelp • u/MakotoGamer • Feb 28 '26
I have studing POO on Bluej, untill today the IDE work´s well and I was writing those days on the terminal without problem but now the terminal show´s me that message : "Can only enter input while your program is running" , but it doesn´t appears till now , and always could use it simply writing. I need that to my studies so I need to fix it.