23,184 questions
Advice
0
votes
17
replies
164
views
Modern websites not working in Java 8 WebView
The Java 8 WebView is too old for nowadays' websites. I've done some research, but nothing works.
JCEF is for Swing. I tried everything to embed it in JavaFX, but nothing works (threading issues, DLL ...
3
votes
1
answer
98
views
How to change the user that registers CUPS as a job requester from the Java Print API?
I'm using the Java printing API [1] to print to a printer using CUPS.
We are using Java 8 for Java client and CUPS 2.2.6.
The Java process is on the same server as the CUPS daemon where all printers ...
3
votes
1
answer
202
views
Is it possible to run JavaFX applications in Java 8?
I have an application written to be used in Java 8 with JavaFX. I tried building it on a new machine today and was surprised to find that JavaFX is no longer bundled with Oracle JDK 8, as of Oracle ...
1
vote
0
answers
57
views
Java 1.8 Jwts token generation and validation migrate to Java 17
I need to migrate a project from Java 1.8 to Java 17 and I have troubles with a token generator.
Actually the generation is this (Java 1.8):
public String generateId(String id) {
return ...
1
vote
0
answers
43
views
Apache POI: Wrapped text rows do not auto-expand in generated Excel (code-only, no manual interaction)
I am generating an Excel file entirely through code using Apache POI (XSSF). The file is never manually opened or edited; it is generated and then directly used (for example, converted to PDF).
Some ...
7
votes
1
answer
312
views
Java Map.computeIfAbsent consuming high memory [duplicate]
I had written a method to update a HashMap, provided an int id value (ex: client id) as key, the method would check if the key is available in the map, if not it would create an entry and associate a ...
0
votes
0
answers
42
views
Wildfly jtds upgrade java gives connection reset using SSL
We have been using wildfly 20 with the old jtds driver for jdbc connection pooling. Any many of our customers have been as well.We just upgraded from jdk 8-265 to jdk 8-462. After the upgrade, nothing ...
0
votes
0
answers
73
views
Why won't my Netbeans 12.4 open on my Macbook M1 Air?
As the title states, my Netbeans refuses to open; it has the opening loading prompt but it closes as soon as the text says "Done loading modules".
I currently have the newest versions of ...
1
vote
1
answer
159
views
java error when trying to compile and execute java programs using intelliJ idea
I am experiencing build failure when trying to compile and execute Java programs using JDK 8 (1.8.0_432). I keep getting the following error from IntelliJ idea:
java: invalid flag: --add-modules
Not ...
0
votes
0
answers
60
views
Springboot 2.2.5 Java8 not exposing GraphQL
My application runs on Java 8 and Springboot 2.2.5.RELEASE and I am using below dependencies to expose a GraphQL service.
<dependency>
<groupId>com.graphql-java-kickstart</...
0
votes
1
answer
82
views
DYLD_LIBRARY_PATH is null [closed]
I'm trying to run a .jnlp file on my Mac, but I keep getting the error:
DYLD_LIBRARY_PATH is null
java.lang.UnsatisfiedLinkError: Can't load /Users/setupuser/Library/Application Support/Oracle/Java/...
0
votes
1
answer
79
views
Doc4j corrupts docx file after inserting paragraph
I am trying to add a simple text paragraph with text ""Hello from Java test!" in an existing simple docx file (contains only one dummy line of text already) using docx4j.
But when I am ...
2
votes
0
answers
118
views
Java web-socket ssl certificate error while cert is valid
Hello I've been facing a weird problem the past few days.
I send out a demo of my app to a few people. however for around 75% of the people the demo didn't work, while for the other 25% it works great....
0
votes
1
answer
66
views
InvalidDataAccessResourceUsageException: could not execute statement [ERROR: column "" is of type jsonb but expression is of type character varying
I am using SpringBoot 3.5, PostgreSQL and Hibernate/JPA as ORM.
While using JSONB column from DB I am having this error.
org.springframework.dao.InvalidDataAccessResourceUsageException: could not ...
2
votes
1
answer
178
views
CharsetDecoder used within InputStream in release Java 8 onwards doesn't seem to honor CodingErrorAction.Replace
Issue can be found in version Java8 onwards. A CharsetDecoder is explicitly configured with CodingErrorAction.REPLACE ; I would expect the replacement character \uFFFD to be applied when decoding ...
1
vote
1
answer
122
views
Why failed when using mockito3 + powermock2 to mock new object
I am trying to mock a constructor method. But failed with messages said unnecessary stubbings.
What modify should I make to succesfully run this unit test? Plus, Better not to modify the version of ...
-2
votes
1
answer
611
views
Can i use spring version 6 and above with Java version 8?
I wanted to upgrade my spring version from 5.3.39 to the 6 series. But when I tried to do that, it didn't compile and threw an error.
This is the error that I'm getting:
Failed to execute goal org....
-4
votes
1
answer
129
views
Is it mandatory to specify the data type of a base class which is declared generic while inheriting?
I'm trying to understand Java generics better. Suppose I have a generic base class like this:
class Base<T> {
T data;
}
Now, if I create a subclass, do I need to mention the parameter type ...
0
votes
0
answers
60
views
java.security.AccessControlException: access denied ("java.net.SocketPermission" "localhost:1099" "listen,resolve")
Facing issue with RMI Registry.
Inititally my code was developed using java 6 or lower version but recently we have upgrade our java to java 8 and came to understand that it has some tighter Security ...
0
votes
0
answers
77
views
JavaMail running on Oracle 19c database and TLS1.2
Running Oracle 19c with Java 1.8.0_451 and JavaMail 1.6.7. I'm attempting to send emails via SendGrid from a stored procedure on the database referring the the following Java class:
CREATE OR REPLACE ...
0
votes
0
answers
53
views
OpenEJB (for Unit-Tests) not working after Upgrade from 7 to 8
we use OpenEJB 7.0.9 for Unit-Testing with Java 8.
Now we switch our Application to Java 11 and tried to Upgrade OpenEJB to 8.0.16.
But since Version 7.1.4 and 8.0.0 (org.apache.tomee -> openejb-...
1
vote
0
answers
6k
views
Running JavaFX Application on JRE 8u451 After JavaFX Removal
I'm facing an issue with a JavaFX application written for JDK 8. My company recently updated to JRE 8u451, and the application no longer runs because JavaFX has been removed from this release. I have ...
2
votes
1
answer
134
views
Java how does searching for a key in a HashMap bucket work?
EDIT: As one of the people commenting mentioned, this question only concerns this specific implementation: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/HashMap.java#...
0
votes
0
answers
163
views
GC pause by Metadata GC Threshold for weeks then turned to Full GC
I have a java application running heavily groovy scripts. After running for weeks, the system encountered Full GC in every day, every time it cost about one second which is not acceptable.
How can I ...
0
votes
1
answer
88
views
Jersey: Disable standard ExceptionMapper
I developed a RESTfull API with Jersey (2.25.1) and my goal is to always return the same JSON even in case of errors.
I then configured a series of exception mappers including one for handling the com....
0
votes
0
answers
131
views
Do Swing dialogs gain focus on opening?
Do Swing modal dialogs gain focus on opening?
They should. However, no log message is ever printed if you execute the demo below. Why?
import javax.swing.JButton;
import javax.swing.JDialog;
import ...
1
vote
2
answers
100
views
Iterating a list once instead of twice
I have a json for students with marks . I need to get the total marks for maths and english per standard . I could do it for each subject like below , but here the list is iterated twice. Is there a ...
1
vote
0
answers
1k
views
How to run JavaFX application using the latest JRE 8u451?
As announced, Oracle removed JavaFX from the latest JRE (8u451 released on 4/15). As a result our customers are not able to start it. Is there any possible workaround for this problem?
We have ...
0
votes
1
answer
50
views
Grouping By Child Class into Map
I had made a list of Parent Class (as Employee) having a parameter of child class (as Department)
class Employee {
Integer empId;
String empName;
Long salary;
String email;
...
4
votes
1
answer
121
views
Error using ternary operator and method overloading of wrapper class in Java 8 only
I am using Java 8 and facing some weird error.
The compiler gives the following error:
error: reference to [method] is ambiguous
Here's my code
StringBuilder sb = new StringBuilder();
Stack<...
0
votes
0
answers
60
views
Converting a jsonString to HashMap
I have a jsonString which is a list of key value pairs.
[
{"id": "123", "url": "ghi"} : 2,
{"id": "456", "url": "def"} ...
0
votes
2
answers
183
views
How to prevent Java21 to forcibly add 'ns2' to namespace?
I have a Java application doing SOAP requests to a WebService (which I have no control of). It is currently running on Java8 and I need to make it compatible for both, Java8 and Java21 (not only ...
-1
votes
1
answer
89
views
How to solve JDK Gradle Config error in Flutter
I tried running few flutter projects but it gives me this same error -
ashvinstech@Ashvins-MacBook-Air untitled1 % flutter run
Launching lib/main.dart on Redmi Note 7 in debug mode...
FAILURE: Build ...
1
vote
0
answers
63
views
Large file download using Servlet with Streaming without browser buffering
I am developing a Java 8 servlet to download a zipped resource. The file size can vary significantly, sometimes reaching up to 700MB. For testing, I am using a 350MB ZIP file.
The expected behavior is ...
0
votes
1
answer
75
views
Java Lambda Expression: How to count elements in List
List<String> l1 = Arrays.asList("ab", "cd", "ef");
long count = l1.stream().count();
System.out.println(count);
I want to use lambda expression instead ...
0
votes
1
answer
155
views
Mockito mock a method that returns void with ArgumentMatcher.any() as parameter
I am trying to mock a method and want to execute the internal logic as is when called.
The method returns void so When I am using when(MockedObject.methodReturingVoid(any())).callRealMethod(); It ...
-7
votes
1
answer
75
views
Need to group by list of list in pojo in java and sort by year and month
We are getting list of AssetValue from database,
After getting the list I need to group by id and sort by year and month.
Based on the grouping I need to print on reports.
Public Class AssestValue{
...
0
votes
1
answer
87
views
Modify JAVA Optional Object and compare with its original data
I'm trying to create an API where I'm updating a set of data into database. While updating, there is data that comes the same as what's already present in the DB. I want to check this and avoid ...
0
votes
0
answers
92
views
Flutter run: JAVA_HOME is set to an invalid directory
i have downloaded jdk8 and the environment variables is set correctly
java -version java version "1.8.0_431" Java(TM) SE Runtime Environment (build 1.8.0_431-b10) Java HotSpot(TM) 64-Bit ...
0
votes
1
answer
111
views
Multiple print statements without null checks using Optional [duplicate]
I am trying to convert the below null check of legacy java 7 code to modern java using Streams and Optional.
if (person != null) {
System.out.println(person.getName());
System.out.println(person....
1
vote
1
answer
223
views
Intellij Idea freezes while build an app on an specific computer
I'm working on several projects with java and Intellij Idea 2024.3.1.1, because of the academic licence. I regularly work on a computer with a 10th generation i3 processor with 18 GB of RAM, and ...
2
votes
1
answer
115
views
Resolving relative URIs in Java 8 while dealing with JDK bug
I'm in the scenario where I am stuck on Java 8. I have a program that creates and resolves URIs using java.net.URI. These are generally always going to be http scheme, but we will potentially get ...
0
votes
0
answers
72
views
SSL handsake issue in TLS1.2 in java 8
I have same java 1.8_171 application with same server type redhat 7 running in 2 servers in one server when it hits the external api it works fine but from another server when hitting the same api it ...
0
votes
2
answers
107
views
Java 8 - javax.sound.sampled.UnsupportedAudioFileException Error on JBoss Server
In an application I developed with Java 8, I am trying to convert a .wav audio file received in Base64 format to PCM_SIGNED format. The code works fine in the local environment, but I get the ...
1
vote
0
answers
163
views
Unable to setup PIRANHA BY UBER to remove stale code in my demo application
I am trying to setup PIRANHA BY UBER on my local for a demo java (Java 8) application. I am not able to perform a remove the stale code by building it.
Demo Application:
@Controller
public class ...
5
votes
1
answer
137
views
Strange Java regex matching behavior regarding negation via ^
In Java 8, the following script prints true
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
String regex = &...
0
votes
1
answer
58
views
How to establish secondary database connection after API call?
How can we establish the secondary database connection after API call.currently database is establishing connection at runtime.
Below are the code samples.
Controller code:
@GetMapping("/...
5
votes
2
answers
135
views
Capture only if string exists, if not ignore
I have a string like this:
blabla and (ee.xybfkr_eer in (:something) or 'Y'=:see)
I would like to capture only the string ee.xybfkr_eer in (:something) in the group.
but sometimes the string is ...
0
votes
1
answer
70
views
Java Instant can't save in mysql column of type timestamp through Spring JPA
I am trying to save java Instant type in a MySQL column of Timestamp type. But I am getting MysqlDataTruncation exception as shown below, even though the column allows Null, when I try to pass Null ...
0
votes
1
answer
47
views
stream multiplication of array with time complexity O(n)
I have an array of elements as below:
int arr[]={1,2,3,4}
now I need the result array as below:
{24,12,8,6}
So basically it will multiply each element expect the ith element.
For index 0: it will ...