1,918,271 questions
0
votes
0
answers
11
views
Is there a way to automate user input with JLine's LineReader?
When handling user input through Scanner(System.in), you can use System.setIn() to automate user input.
Like this:
package edu.ntnu.idi.idat;
import java.io.ByteArrayInputStream;
import java.io....
2
votes
1
answer
47
views
How to efficiently flush and write large amounts of data to a file using BufferedWriter in Java?
I'm working on a Java project where I need to write a large number of lines to a file. I know BufferedWriter can improve performance compared to writing character by character, but I am unsure about ...
-2
votes
1
answer
37
views
Getting incorrect output in my Java solution for HackerRank “A Very Big Sum”
Body:
I am trying to solve the “A Very Big Sum” problem on HackerRank using Java.
The task is to sum large integers (long values), but my output is not matching the expected answer.
Here is my code:
...
2
votes
1
answer
91
views
Is it possible to load a function symbol from an executable
I have 2 files:
foo.c:
#include <stdio.h>
int Main(int a) {
printf("A%dB",a);
}
int main() {
return Main(1);
}
bar.c:
extern int Main(int);
int main() {
return Main(2);
}
...
-2
votes
0
answers
28
views
mesibo Compilation Error: Unresolved reference 'MessageParams' in Mesibo Android SDK 2.7.19 (Kotlin)
I am integrating the Mesibo Android SDK (version 2.7.19) into my Kotlin application. I need to implement the Mesibo.MessageListener interface to receive real-time messages, but I am facing a ...
-4
votes
0
answers
61
views
why it is showing the exp 2 value 4 it should be 5 not 4? [duplicate]
public class Test {
public static void main(String[] args){
int x = 2, y = 5;
int exp1 = (x * y / x);
int exp2 = (x * (y / x));
System.out.print(exp1 + “ , ”);
System.out.print(...
0
votes
0
answers
41
views
Full screen intent on Lock screen stopped working when Samsung Android upgraded to 14/145/16
My VoIP Android app shows a full-screen incoming call UI using Android’s full-screen intent (FSI).
On Samsung Android 16, the FSI works perfectly when installing the debug build — but fails completely ...
1
vote
0
answers
64
views
AudioSystem,isAudioLineSupported returns false
I am trying to use some Java audio code that worked back in 2019. I am now using the Eclipse IDE with JavaSE-21 running on Windows 11. The following code is not working:
AudioFormat af = ...
-1
votes
1
answer
71
views
Java OOP association SQL equivalent
I have two classes: Student and Group.
Student attributes:
private String registrationNumber;
private String firstName;
private String lastName;
private Date dateOfBirth;
private String password;
...
0
votes
0
answers
46
views
Java project dependency jar - only part of new code being recognized
I have a Java service that relies on a dependency jar that I have modified. Within the dependency I have updated 2 different sections of code for unrelated functionality. I have updated the version of ...
1
vote
1
answer
104
views
Cant open more than 8000 tcp connections with Java
I am trying to open to open 10K+ connections to a server, but my app stops at 8K connections when looking at the server logs. When using two remote servers it will struggles when reaching between 8K ...
1
vote
0
answers
89
views
getResource returns null for a resource that does exist
I have resurrected a program written in Java using Eclipse: I last worked on it in 2016. I am now using JaveSE-21, and this code no longer works- the returned URL is null.
String name = "res/...
-4
votes
0
answers
40
views
What is setAllowUniversalAccessFromFileURLs(true) [closed]
What are vulnerabilitites can occur by this and prevention tech in code level ?
0
votes
1
answer
60
views
`Filters.eq(fieldName, value)` not actually creating `$eq` causes issues
I'm not sure if this is a MongoDB issue, an issue with the mongo-java-driver or if I'm doing something worng.
The issue is that MongoDB can behave differently in case there is a $eq operator or if a {...
1
vote
0
answers
55
views
How to add 64-bit OS check for Java 17 JavaFX app when packaging with launch4j-maven-plugin?
I'm working on a JavaFX application that requires Java 17+, which only supports 64-bit operating systems. I'm using the launch4j-maven-plugin to create an EXE file, and I need to ensure that when ...
0
votes
1
answer
78
views
Why can I not seem to get gradle to work? [closed]
I am trying to make an app for android, just a small little "Hello World" app to assess how it all works. I have tried on numerous occasions to get gradle to wrap the app but I just keep ...
0
votes
1
answer
60
views
Exclude map name when parsing GSon to JSON
I have something like this:
String data = new Gson().toJson(myCoolObject);
myCoolObject has a HashMap. The resulting string ends up containing not just the keys and values of the map, but also the ...
1
vote
3
answers
107
views
Using Pagination & Sorting in Spring Boot 4 with CrudRepository & PagingAndSortingRepository on JDBC
I am doing the learning on Broadcom's Spring Academy to be up to date with the latest best practices. I bumped Spring Boot to 4.0.0 instead of the 3.0.0 on Spring Academy. But I am having some issues ...
-6
votes
1
answer
84
views
Formatting the first symbol of a string to be upper case - a private method or formatting on the go?
In a class that has a bunch of functions, should I be making a separate private method specifically for formatting or should I just be formatting in every function that requires a string to be ...
0
votes
0
answers
34
views
HTTP-403 when authentication in spring authentication server after /login in spring cloud gateway
I trying to setup cooperation of gateway and authorization server.
help me to find error in the program, when i authenticate me and enter to web authentication form username=admin and password=1 i ...
2
votes
0
answers
65
views
m2e Workspace Resolution Broken After Upgrading from Eclipse 2021 to 2025
I’m upgrading an old Eclipse setup and ran into a strange issue with m2e workspace resolution.
I moved from Eclipse 2021 to Eclipse 2025.
I created a completely clean Eclipse installation and ...
0
votes
1
answer
63
views
How to copy a fully qualified method reference in VS Code (like IntelliJ’s "Copy Reference")?
I’m coming from IntelliJ and I’m used to the “Copy Reference” feature, which lets me copy a fully qualified reference to a method, such as:
com.mycompany.project.service.UserService.getUserById
I’m ...
1
vote
0
answers
52
views
Need help understanding why this Locksupport.park hangs indefinitely
I have the below code (whole code is here) that polls a queue for runnables and parks itself if the queue is empty.
public void waitAndDrain() throws InterruptedException {
throwIfInterrupted();
...
0
votes
0
answers
30
views
Losing MDC in Quarkus ManagedExecutor
I'm starting an async-process through a REST request. As soon as the REST requests returns, I'm losing the MDC context inside my async execution code. I tried to "copy" it over with ...
0
votes
0
answers
50
views
Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
I'm using an old version of Android Studio, 3.1.6.
This error appears when the gradle project sync failed. I also have a new version of android studio installed, I dont know if this could be related, ...
0
votes
1
answer
72
views
"command is either misspelled or could not be found" with Win 11 but not Win 10
A year ago I created an Eclipse project (Eclipse 2020-06, Java 8, Win 10) that uses the GIS LAStools libary to e.g. extract data from a couple of files.
I'm now using Win 11 on a different PC and want ...
3
votes
0
answers
109
views
Memory leak in JNI with AttachCurrentThread() and DetachCurrentThread()
I have a Java application that calls a native function. That native function contains a loop, and in each iteration it launches 10 threads and waits for them to complete. Each thread performs a number ...
0
votes
1
answer
88
views
How does the JVM instruction getfield work?
ThreadA getfield Stop.flag is false. At a certain point, another thread modifies Stop.flag to true, but ThreadA getfield Stop.flag always returns false.
I don’t understand: Under the CPU MESI protocol,...
0
votes
1
answer
75
views
Intercepting user toggle button clicks
Can you intercept JToggleButton clicks, making the selected property change conditional? If you add ItemListener or ActionListener, you can't veto the change, it's already happened. Switching the ...
0
votes
1
answer
108
views
Spring Boot: 400 Bad Request when sending JSON to POST endpoint (request body always null)
I’m building a Spring Boot REST API and I’m stuck on an issue that I can’t figure out.
I have a simple POST endpoint that should receive a JSON payload and map it to a DTO, but every time I call the ...
1
vote
1
answer
126
views
How to fail at startup in Spring Boot 4 if the base-url property is not set?
With Spring Boot 3, I created a @ConfigurationProperties record with @NotBlank validation to manually set the base URL on the RestClient that is passed to the HttpServiceProxyFactory For example:
@...
0
votes
0
answers
32
views
Errors while starting Wildfly 35.0.1 server which is configured for jasper reports 9.0.0
I have deployed jasperserver-pro.war in Wildfly deployments folder and trying to start the server. But I am getting lot of WARNING server logs and I am not able to start the server.These are the ...
0
votes
0
answers
37
views
Hugging Face /hf-inference/v1/chat/completions returns 422 in Eclipse plugin
I'm building an Eclipse plugin for code completion using the Hugging Face API. My plugin sends a prompt to the endpoint:
https://router.huggingface.co/hf-inference/v1/chat/completions
I replaced the ...
0
votes
0
answers
39
views
Spring Boot CORS preflight request returns 403 "Invalid CORS request" for POST /login
I’m trying to connect my React frontend (hosted on Azure Static Web Apps) to my Spring Boot backend (hosted on Azure App Service), but the CORS preflight request is failing with HTTP 403.
When I run ...
-3
votes
0
answers
47
views
How do I code a binary search involving two arrays of words? [closed]
I have two arrays (one going from 0-49 listing every US state, and another one going from 0-49 listing the US capitals.) and I need to binary search the second array to match a selected US state to ...
-1
votes
0
answers
58
views
Facing error while creating CSR certificate using Openssl inside a javacode using process builder [closed]
ProcessBuilder process3 = new ProcessBuilder(
"openssl" ,
"req",
"-new",
"-key&...
1
vote
1
answer
106
views
+50
How do I prevent a Maven mojo parameter from being encoded on write to XML?
I'm writing a custom Maven plugin for building a Flatpak from a Java project. In a Maven mojo I understand we use @Parameter annotations to parse pom.xml file configurations. For example:
pom.xml:
<...
-3
votes
0
answers
76
views
Tournament Sort Correction [closed]
Im making a presentation as homework about it, there's barely any information of it, i been working with chatgpt and some youtube video, my question is, whenever i write same numbers, for example, ...
0
votes
1
answer
70
views
How to configure HTTP Service Clients with Protobuf in Spring Boot 4?
I want to use HTTP Service Clients with Spring Boot 4, but using Protobuf instead of JSON. How can I configure this?
0
votes
0
answers
46
views
BigQuery data is not inserted in tables
I'm having random data missing/not showing up in BigQuery issues. I would seemingly write data without issues, but SELECT * would return nothing.
The control panel shows no errors. None of the quotas ...
2
votes
1
answer
87
views
Force full expression evaluation or disable short-circuiting logic in SpEL expressions
I am working on an application where it dynamically generates and executes some Spring Expression Language (SpEL) expressions.
I am facing a few performance issues, and after tracking it down a bit, I ...
-3
votes
0
answers
63
views
Spring aspect method Not Called [closed]
I am trying to create a Spring aspect around method, but it is not getting called.
In my GeoLocationUpdateService.java:
@Autowired
private GeocoderService geocoderService;
...
geocoderService....
1
vote
1
answer
92
views
Springboot custom validator in Service class is executed twice
I created a custom validator called @UniqueElementsById which I am applying as an annotation to Service method parameter like:
public interface MenuDetailService {
List<MenuDetail> ...
1
vote
1
answer
120
views
Rendering Text to an Image in Java
This may be a case where things are just inherently difficult, but I've run into a roadblock. I'm working on a simple image to ASCII converter, and instead of writing to the console, I'd like to ...
0
votes
0
answers
55
views
Casting collection<implementation> to collection<interface> [duplicate]
In Java, having two interfaces:
public interface SomeAbstractResult {}
public interface SomeInterface {
Collection<SomeAbstractResult> someMethod();
SomeAbstractResult someMethod2();
}
...
0
votes
1
answer
83
views
Constructor not accepting list of derived class as argument [duplicate]
I have tried using both base class and interface and in both instances I am told a constructor that takes my arguments does not exist. I have two classes that are related to each other and I want to ...
-4
votes
1
answer
60
views
How to change Intellij Terminal font colors
terminal ss
i am using the default intellij theme but inside the terminal colors of the font i type and the response i get are a white pale yellow color which is often hard to read while testing or ...
0
votes
0
answers
40
views
How to trigger "Copy" on notification
How do I sent an email in Java so that when Outlook displays it as a notification it will automatically show a "Copy" button like when logging into ChatGPT?
Here is what I have tried. It ...
-1
votes
0
answers
59
views
How to draw Class diagram of class which includes only main() [closed]
I have a class with only a main(), but inside that many variables are there. Should I include all those variables inside the main function into class diagram or just specify only:
Class name
nil
+...
1
vote
1
answer
99
views
Why does my Java code behave differently inside a loop when checking conditions using a HashSet?
I am trying to solve a coding problem where I need to repeatedly double a number (original) as long as it exists in an integer array. To make the lookup faster, I am inserting all elements of the ...