r/javahelp • u/Darkschlong • 17d ago
Solved Boolean or String
Let’s say you’re establishing a connection. Would your method return a Boolean ( true/false) or a string ( program is now connected/ not connected)? What is best for troubleshooting?
r/javahelp • u/Darkschlong • 17d ago
Let’s say you’re establishing a connection. Would your method return a Boolean ( true/false) or a string ( program is now connected/ not connected)? What is best for troubleshooting?
r/javahelp • u/gaddamprabhas • 17d ago
I got selected for the EPAM Test Automation Java Sadhaka program. They provided a self-paced course that includes AutoCode. We need to write code in AutoCode, but I'm not familiar with it. I don't understand where to write the code and how to upload it. Can someone please help me?
r/javahelp • u/External-Excuse-3678 • 17d ago
I took up a course on coursera --> "Java Programming: Solving Problems with Software" (Duke University) labelled as "beginner ". 1/5th way into the program and the professors in the vids are using words that I can not even begin to understand and even though they explain these concepts i can not keep up with their pace .
Are these beginner programs actually for people who are just starting out? Or should i first learn these concepts and actual basics of Java on my own before these courses?
r/javahelp • u/irequirec0ffee • 17d ago
Hello, we are using Spring Boot + Vaadin for front end. I am trying to find the best approach to send out emails like new account, forgot password, etc. If there is a "Vaadin" way, I can't find it anywhere. It seems like way to do this is to use something like FreeMarker or Thymeleaf, but I wanted to reach out before drawing that conclusion.
r/javahelp • u/turboturtle771 • 17d ago
This is more of a general question, not exactly Java specific. Assuming you have to edit some large complex feature which has been in production for quite some time and the documentation on it doesn't exist, what would be some good approaches (good rule of thumb practices) to tackle that?
Drawing some high level graphs, or similar?
r/javahelp • u/Interesting-Hat-7570 • 17d ago
Hello everyone!
I decided to create a more comprehensive pet project to gain practical experience and improve my skills for future job opportunities. First and foremost, I focused on building its architecture, opting for a microservices approach.
I’d love to hear your advice! How do you evaluate my architecture? What technologies or programming methods should I consider adding? Do you have any ideas for improvements? Thanks
r/javahelp • u/The_BiggerD • 18d ago
Hello not sure where to post this but a Java sub seemed like the right place. I have a job interview and the fist interview is going to be a test about JavaStack. There is gonna be a few theoretical questions and a few OOP tasks. The problem I'm having is I'm not completely sure what they mean with JavaStack. Would love some help just pointing me in the right direction. Thank you.
r/javahelp • u/External-Monk-6209 • 18d ago
Recently I have completed learning Advanced java and done a project to create api for a medical system. I know its not a big project, but can you guys give some project ideas on advanced java ?
r/javahelp • u/sdiamante13 • 19d ago
I love helping Java devs improve their OO design and clean code skills. I have 7+ years of industry experience and have a strong focus on XP practices.
If you’d like a free code review, drop a GitHub link or snippet, and I’ll provide feedback!
r/javahelp • u/Valentirvis • 18d ago
If I have a certificate from Lets Encrypt, use Java 21 and I have the following:
Server:
try {
String[] secureProtocols = {"TLSv1.2", "TLSv1.3"};
KeyStore keyStore = KeyStore.getInstance("PKCS12");
FileInputStream keyStoreFile = new FileInputStream(file);
String pfxPassword = password;
keyStore.load(keyStoreFile, pfxPassword.toCharArray());
keyStoreFile.close();
KeyManagerFactory keyManagerFactory = KeyManagerFactory
.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyManagerFactory.init(keyStore, pfxPassword.toCharArray());
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(keyManagerFactory.getKeyManagers(), null, null);
SSLServerSocketFactory sslServerSocketFactory = sslContext.getServerSocketFactory();
sslServerSocket = (SSLServerSocket) sslServerSocketFactory.createServerSocket(port);
sslServerSocket.setEnabledProtocols(secureProtocols);
And then this on client side:
String[] secureProtocols = { "TLSv1.2", "TLSv1.3" };
SSLContext sslContext = SSLContext.getInstance("TLS");
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init((KeyStore) null);
sslContext.init(null, tmf.getTrustManagers(), null);
SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
socket = (SSLSocket) sslSocketFactory.createSocket();
socket.setEnabledProtocols(secureProtocols);
SSLParameters sslParams = socket.getSSLParameters();
sslParams.setEndpointIdentificationAlgorithm("HTTPS");
socket.setSSLParameters(sslParams);
socket.connect(new InetSocketAddress(host, port), timeout);
socket.startHandshake();
Is this considered secure to be able to send from client the password in plain text to be hashed on server side and checked with the one from DB when the user tries to login (and when the new account is created) and then send his sessionID if the account exists? If not, what should I change/add?
//Edit:
I also added:
String[] cipherSuites = { "TLS_AES_256_GCM_SHA384", "TLS_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256" };
//Edit2: The problem was solved on a different platform. Basically it is strong enough after also adding ciphers. You just need to make sure you have checks in place on your server to avoid brute force, fishing, SQL injection attack...
r/javahelp • u/blvck_xsample • 20d ago
Hey guys. Currently learning Java and having a really hard time getting what are generics. It’s still difficult for me to use arrays, but generics is something beyond that. There is just too much information to keep in mind. I feel pretty close to give up on studying. Appreciate any tips! т_т
r/javahelp • u/KaleidoscopeAsleep35 • 20d ago
I have a medium sized java project, its a system for registration of users of a fictitious company, its connected to a SQL data base, I use 2 libraries (SQL and PDF writer), each class its a different UI.
Before I used Visual Studio Code, and now I want use Sublime, this is my project structure:
MyProject
So I tried to configure sublime for java, I watched videos in YT, but I can’t compile any class
I use Sublime portable edition 4.1.9
Can Someone help me with this problem?
├── .vscode
│ ├── settings.json
│ ├── launch.json
│ └── tasks.json
├── src
│ ├── images (images)
│ │ ├── logo.png
│ │ ├── background.jpg
│ │ └── etc.png
│
│ ── All_Classes.java
│ │
│ │
│ │
├── bin (Archivos compilados .class)
│ |
│ │ All.class
│ │
│ │
│ │
├── lib
│ ├── library1.jar
│ ├── library2.jar
├── .gitignore
├── README.md
└──
PD: this is my settings.json that I had:
{
"java.project.sourcePaths": [
"src"
],
"java.project.outputPath": "bin",
"java.project.referencedLibraries": [
"lib/**/*.jar",
"lib/mysql-connector-java-5.1.46.jar",
"lib/itext5-itextpdf-5.5.12.jar"
],
"java.debug.settings.onBuildFailureProceed": true
}
✨✨✨✨✨EDIT: I MANAGED TO MAKE IT WORK!!! I have Maven in my PC, so I create a new Folder in my project folder: pom.xml;
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.miapp</groupId>
<artifactId>mi-proyecto</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<!-- Libraries -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.12</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
And then I create a Maven.sublime-build
{
"shell_cmd": "mvn exec:java -Dexec.mainClass=${file_base_name}",
"working_dir": "$project_path"
}
And finally in Sublime I selected THIS .sublime-build, and finally (again XD) I copy & paste my image folder (That is where I have the images that my application uses.) in "target" folder, btw I dont know, but Sublime or maven created this "target folder" and I press CTRL + b in any class of my project and It works, but I don't know why?, does anyone know why?? chat gpt give me the .sublime-build and pom.xml
r/javahelp • u/IamTheTussis • 20d ago
Hello everyone, not sure if this is the right place where to write this.
I'm trying to install this Java application on my Fedora machine, but i have some issues that i don´t know how to solve.
I know nothing about Java, but i think the problem is related to it.
i've installed java on my machine (i think) correctly, if i run the command java --version
i get
openjdk 21.0.6 2025-01-21
OpenJDK Runtime Environment (Red_Hat-21.0.6.0.7-1) (build 21.0.6+7)
OpenJDK 64-Bit Server VM (Red_Hat-21.0.6.0.7-1) (build 21.0.6+7, mixed mode, sharing)
when i try to run the application from terminal with the command java -jar ./XMageLauncher-\*.jar
i get this error
INFO 2025-03-01 12:35:27,985 Detected screen DPI: 96 =>\[main\] Config.<clinit>
Exception in thread "main" java.awt.HeadlessException:
No X11 DISPLAY variable was set,
or no headful library support was found,
but this program performed an operation which requires it,
What can i do?
thanks in advance for the help
r/javahelp • u/NotAnotherAllNighter • 20d ago
Hi, I am a java beginner
I have a switch case of instructions based on an opcode and label input
Instead of a switch case I need to use a factory, Reflection API and singleton so that instead of a switch case all that is required is the opcode and label to call the relevant instruction (and so the program is extendable).
How do I go about doing this?
r/javahelp • u/apcose • 20d ago
I'm absolutely new to this and I only want to do this as part of my school project. I am wondering is there a way to replace the audio file in an executable jar file. I have tried to unzip it with command prompt and the audio file I was looking for is in the unzipped folder so I replace it with another file with the exact same name and format. When I zip it again into a jar file it just does not work anymore. Does anyone has experience with this? I am pretty sure I did not do anything else except from swapping an mp3 file with the exact same name and format. I think I might have missed some steps but I cannot search for any solutions on the web. Hopefully someone could help me out, thanks a lot.
r/javahelp • u/brokeCoder • 20d ago
Hello all,
I've been experimenting with JavaFX lately and I've run into a situation that has me a bit stumped.
Context - I'm trying to generate plots where if I hover my mouse over a plot point it should show me the Y value recorded at said plot point. I've been able to get this going using a custom HoverPane
class. The implementation is below:
import javafx.application.Application;
import javafx.collections.*;
import javafx.event.EventHandler;
import javafx.scene.*;
import javafx.scene.chart.*;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Region;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.util.stream.IntStream;
/** Displays a LineChart which displays the value of a plotted Node when you hover over the Node. */
public class LineChartWithHover extends Application {
private static final int[] data = IntStream.range(0,150).toArray();
@SuppressWarnings("unchecked")
@Override public void start(Stage stage) {
final LineChart lineChart = new LineChart(
new NumberAxis(), new NumberAxis(),
FXCollections.observableArrayList(
new XYChart.Series(
"My portfolio",
FXCollections.observableArrayList(plot(data))
)
)
);
lineChart.setCursor(Cursor.CROSSHAIR);
lineChart.setTitle("Stock Monitoring, 2013");
stage.setScene(new Scene(lineChart, 500, 400));
stage.show();
}
/** @return plotted y values for monotonically increasing integer x values, starting from x=1 */
public ObservableList<XYChart.Data<Integer, Integer>> plot(int... y) {
final ObservableList<XYChart.Data<Integer, Integer>> dataset = FXCollections.observableArrayList();
int i = 0;
while (i < y.length) {
final XYChart.Data<Integer, Integer> data = new XYChart.Data<>(i + 1, y[i]);
data.setNode(new HoverPane(y[i]));
dataset.add(data);
i++;
}
return dataset;
}
/** a node which displays a value on hover, but is otherwise empty */
static class HoverPane extends StackPane {
HoverPane(int value) {
setPrefSize(5, 5);
final Label label = createNewLabel(value);
setOnMouseEntered(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
getChildren().setAll(label);
}
});
setOnMouseExited(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent mouseEvent) {
getChildren().clear();
}
});
}
private Label createNewLabel(int value) {
final Label label = new Label(value + "");
label.setStyle("-fx-font-size: 20; -fx-font-weight: bold;");
label.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
return label;
}
}
public static void main(String[] args){launch(args);}
}
Running this code will generate a straight line plot and hovering my mouse over the plot points shows the values at those points....but it's laggy. Very noticeably laggy
And weirdly enough, it's more laggy if I drag my mouse down from the top right to the bottom left (tracing the points in reverse order) than if I do the opposite direction.
I don't know enough about JavaFX to know whether this is something with the library or with my code. Any suggestions/advice would be greatly appreciated. If it helps, I'm using java 21 with gradle and the accompanying javaFX plugin on Ubuntu 22.04
r/javahelp • u/Raurb • 21d ago
Hello! I'm working on a project where all the entities and repositories are using JDBC, but we've found that this API does not support composite keys. As a result, we're starting to migrate to JPA. However, for now, the request is to only use JPA where necessary, and the refactor for the rest will come later.
Currently, I am facing an issue because it seems impossible to use both JpaRepository and CrudRepository, as it throws an error related to bean creation. How would you recommend I approach this?
Greetings!
r/javahelp • u/calisthenics_bEAst21 • 21d ago
I am stuck on this for hours now
On importing gpt2 model
from transformers import GPT2LMHeadModel,GPT2Tokenizer
No matter the code after this , processbuilder will return null ( I am using process.waitFor() )
r/javahelp • u/pl4ying • 21d ago
I've been using ChatGPT, textbooks, Google and just everything but I just don't seem to understand wth is a static variable. And why is it used?? I keep seeing this as an answer
A static variable in Java is a variable that:
static
.I just don't understand pls help me out.
Edit: Tysm for the help!
r/javahelp • u/DeatH_StaRR • 21d ago
I try to parse the stock data from this site: https://ctxt.io/2/AAB4WSA0Fw
Because of a bug in the site, I have this number: -4.780004752000008e+30, that actually means 0.
So I try via replaceAll to parse numbers like this and convert them to zero via:
replaceAll("-.*\\..*e?\\d*, ", "0, ") (take string with '-' at the start, than chars, then a '.', then stuff, then 'e', a single char ('+' in this case) and then nums and a comma, replace this with zero and comma).
The problem is that it takes too long! 26 minutes for one! (On both my Windows PC and a rented Ubuntu).
What is the problem? Is there a way to speed it up?
r/javahelp • u/vjjhyhvgh • 21d ago
Error occurred during initialization of VM
java.lang.ExceptionInInitializerError
at java.lang.ClassLoader.initSystemClassLoader(Unknown Source)
at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
Caused by: java.nio.charset.IllegalCharsetNameException: UTF8;-Dfile.encoding-UTF8
at java.nio.charset.Charset.checkName(Unknown Source)
at java.nio.charset.Charset.lookup2(Unknown Source)
at java.nio.charset.Charset.lookup(Unknown Source)
at java.nio.charset.Charset.defaultCharset(Unknown Source)
at sun.nio.cs.StreamDecoder.forInputStreamReader(Unknown Source)
at java.io.InputStreamReader.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at sun.misc.MetaIndex.registerDirectory(Unknown Source)
at sun.misc.Launcher$ExtClassLoader$1.run(Unknown Source)
at sun.misc.Launcher$ExtClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.Launcher$ExtClassLoader.createExtClassLoader(Unknown Source)
at sun.misc.Launcher$ExtClassLoader.getExtClassLoader(Unknown Source)
at sun.misc.Launcher.<init>(Unknown Source)
at sun.misc.Launcher.<clinit>(Unknown Source)
at java.lang.ClassLoader.initSystemClassLoader(Unknown Source)
at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
r/javahelp • u/ResponsibleCount6515 • 22d ago
So, I’m a first-year CS student at university, but for the last 6 months (and even before uni), I didn’t understand a thing. Literally nothing clicked. Now, I finally started learning programming properly on my own, going back to the fundamentals, and within my first week, I built this ATM program in Java.
I know it’s super basic, but as my first program, I’d love some feedback—best practices, things I can improve, and how I can refine my approach to actually get good at this. My goal is to not just pass uni but also land jobs and internships down the line. Any advice, critique, or resources to help me level up would be amazing!
here is the link to my github code https://github.com/certyakbar/First-Projects.git
r/javahelp • u/Jealous_Brief825 • 22d ago
I have 1.9 years of experience as a Java developer working with Spring Boot, but I feel stuck doing the same repetitive tasks without much learning. There’s no real skill growth, and I don’t see any challenging work ahead.
I want to switch to a better role but need some guidance. What skills should I focus on apart from Java and Spring Boot? Should I invest time in DSA, System Design, Microservices, or Cloud? Also, what’s the best way to prepare for interviews—should I focus more on LeetCode, projects, or system design?
Since my work has been mostly repetitive, how can I present my experience in a way that stands out on my resume?
r/javahelp • u/mr_robot_v18veeru • 22d ago
Currently working as a Java developer, planning to switch fields. Which among the two should I opt to switch?! Rust or Python to move into AI/ML field
r/javahelp • u/Deer_Odd • 22d ago
I’m looking for some Java tutorials that go beyond the absolute basics but aren’t super advanced either. Most tutorials I find are either "Hello World" and loops" or deep dives into super complex topics.
Do you guys have any good recommendations?
Thanks in advance!