Questions tagged [java]
Java is a high-level object-oriented programming language. Use this tag when you're having problems using or understanding the language itself. This tag is frequently used alongside other tags for libraries and/or frameworks used by Java developers.
1,919,227
questions
-1
votes
0
answers
7
views
Building a user moderated REST API
Does anybody have any experience with building a custom RESTful API? More specially one that is user moderated?
I am trying to build a calorie tracker app to track meals from dining halls at my ...
-1
votes
0
answers
11
views
Text editor that hides text vertically [closed]
I need text editor that hides vertically every line in the text . I will give you an example on the picture below. I would like paste any amount of text that I want (a lot) to that editor and edited ...
-1
votes
0
answers
13
views
Intellij bug, intellij não aponta erros em tempo de desenvolvimento [closed]
Meu intellij nao me aponta os erros em tempo de desenvolvimento nem incrementa as chamadas de métodos.
A versão é: Intellij IDEA Comnunity 2024 1.4
JAVA 17
ja verifiquei as configurações inspections, ...
-1
votes
0
answers
10
views
Retrieve a specific value from JSON array using jackson [duplicate]
I'm trying to retrieve an specific attribute from a JSON that I got from an API response directly into a java object using jackson, but when I print it returns null.
The attribute in question is "...
0
votes
0
answers
13
views
Finding specific value in a list in java using a scanning loop: returns numberformat exception
I am trying to find a specific string in a txt file.
here is what i have using java lists:
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
...
0
votes
0
answers
10
views
how can i display a fragment on a floating window using a button that is on another fragment
i try to go from one fragment to another within the floating window using buttons. I manage the fragments using a activity that contains them but when using the button on the first fragment (...
1
vote
0
answers
14
views
Java annotation processor does not get executed during compilation
I am currently trying to implement a small fun library, that auto-generates fixture classes on compile time by using anootation processing: https://github.com/floydkretschmar/fixturize/tree/main/...
0
votes
0
answers
12
views
Cant figure out how to get ADC working for vertex AI when using android studio to click and send an image to vertex ai through my phone [duplicate]
The error I'm facing is :
I have a fairly basic application built in java using android studio ( keep in mind i'm using the 'empty views activity' template on android studio) The app has to do 3 ...
0
votes
0
answers
12
views
Spring Boot STOMP Client: Mock Object Verification Fails
I am developing an API for a real-time multiplayer game and aim to create integration tests for my STOMP API. While using mocks in integration tests is unconventional, I want to verify that the ...
0
votes
0
answers
19
views
Cyclicbarrier implementation in Java, can it be used as a latch too
Here is my implementation of CyclicBarrier
public class CyclicBarrier {
int numParties, arrived;
Semaphore mutex;
Semaphore barrier1, barrier2;
public CyclicBarrier(int parties) {
...
-1
votes
0
answers
9
views
Issue with JfFileChooser on Windows [closed]
When I try to open Windows Desktop on JFileChooser with Windows L&F, it crash throwing a permission exception or something like that.
I tried to set the start directory for JFileChooser to the ...
0
votes
0
answers
10
views
Java Dynamic Resource Discovery
The following code creates a list of classes and interfaces in the specified package
public static List<Class> getClasses(ClassLoader loader, String pack) throws IOException, ...
0
votes
0
answers
18
views
Alternative for RMI in Android application
I've seen a few posts about this issue, but most of them are old and differ a bit from my question.
I chose to implement an Android application with RMI for a project that I work on. I created the ...
-6
votes
0
answers
41
views
java21 Implicit super constructor Enum(String, int) is undefined [closed]
The error "Implicit super constructor Enum(String, int) is undefined" emerged in java21. It refers to an enum definition with a constructor when JRE System Library [java21] is the default. I ...
0
votes
0
answers
23
views
Minecraft Mod deployment exception
I am trying to create a Minecraft mod for the Minecraft Version 1.20.1 using Forge 47.2.8 but since i added my 2nd block, Minecraft suddenly startet crashing upon startup.
--Block Register Code--
...
-1
votes
0
answers
16
views
which library to parse epub for an android app? [closed]
I'm in the process of building an ebook reader app and need an EPUB parser library to handle EPUB files. I'm a beginner in this area, so I'm looking for a library that is not only reliable but also ...
-1
votes
0
answers
10
views
How to pass multiple images as @RequestPart in Spring feign client?
I am trying to pass multiple files (images) using feign client. However, when I am using @RequestPart annotation for list or array of MultipartFile, I am getting an error. For a single MultipartFile ...
-1
votes
0
answers
15
views
Debugging issues from weather and news project
I am finishing a project in creating an application to display both news and weather using java in android studio. I finished entering all the code for the program but when I am debugging the program. ...
-2
votes
0
answers
13
views
How to maintain versioning/ updates in redis cache? [closed]
How to maintain versioning in redis cache ?
eg. at some point we saved an object in db and correspondingly in Redis.
And in next update or deployment for production there is some change in entity let’...
-2
votes
2
answers
50
views
Clarity on Java Lambda Syntax [duplicate]
From my understanding, this is a single statement in Java:
while((x % p == 0l) && (x > p)) x /= p;
If that is the case, why is this a syntax error:
final AtomicLong subtotal = new ...
0
votes
1
answer
15
views
I can't auto login user after registration in spring boot
when i registrate user my project throws stackOverFlowError, but user is saved to database.I also have registration form. Here is my registration controller:
@PostMapping("/register-user")
...
-3
votes
1
answer
31
views
Incorrect Package [closed]
This is the error image
I am facing this error where even though i am adding correct package it gives error when i run the java file (it works proper in debugger)
I tried Changing in Setting.json , ...
0
votes
2
answers
41
views
null keyword on class declaration
Out of curiosity, I was looking through the files of a simple Android application developed for controlling a machine (I didn't develop it, which isn't relevant to the question, I suppose). I'm trying ...
0
votes
1
answer
15
views
Firestore API states index does not exist when it does
I'm using the Java Firestore library to access my Firestore database. I am making this Query:
Query chatQuery = firestore.collection("chats")
.whereEqualTo("userId", userId)
....
0
votes
1
answer
23
views
How to acces a Swing UI component without its variable name?
I wanted to create Buttons by clicking on a Button with following code:
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {...
-1
votes
1
answer
22
views
Selenium org.openqa.selenium.InvalidCookieDomainException: invalid cookie domain
import java.util.Date;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public static void main(String[] args) {
...
0
votes
0
answers
28
views
OkHttpClient no class defined when initlialized [duplicate]
So this is the error I've been getting: java.lang.NoClassDefFoundError: okhttp3/OkHttpClient. I don't really see the issue so I hope to find some helpful advice here.
I tried making a simple http ...
0
votes
1
answer
19
views
Unable to open browser in non-incognito in Playwright
I tried this but it's not opening a browser.
Path userDataDir = Path.of("myPath");
BrowserContext BrowserContext = playwright.chromium().launchPersistentContext(userDataDir);
page = ...
0
votes
0
answers
33
views
PostgreSQL database not connecting to spring-boot application
I am currently setting up postgreSQL db for my spring-boot project. However, when I try to launch the tomcat server I get exception saying that the repository beans could not be created due to this:
...
-2
votes
0
answers
13
views
Deploy ADF EAR to glassfish
I am currently working on an ADF project using JDeveloper 12.2.1.4. Here’s my setup:
GlassFish: 4.1
ADF Essentials: 12.2.1.4
JDK: 1.8.0_211
oracle DB
It has been quite a challenge converting from ...
0
votes
0
answers
10
views
Sliding menu in libgdx java android
I am trying to create a side sliding menu similar to Android's NavigationView in libgdx the problem when I try to close by sliding to the left the menu closes quickly and I want it to close gradually ...
-1
votes
0
answers
30
views
Postgres losing data on docker compose stop/start
I've been trying to setup a simple docker-compose with Postgres database and Java backend application. Everything works as expected besides Postres is always loosing data whenever I restart the ...
0
votes
0
answers
17
views
How to read Objects in a PDF file with Apache PdfBox in Java?
I'm developing a pdf reader/editor program in Java using Swing for UI with Apache PdfBox. I want to get the objects and their states in each of the pdf pages. I mean the text, images, shapes as ...
0
votes
0
answers
12
views
Connecting Jconsole to java app on GCP via SSL
I'm trying to make a connection to my java app, using Jconsole. I want to secure that by SSL. At the end I want to move this app to GKE and make the same connection.
What I have:
Simple springboot app,...
0
votes
0
answers
10
views
How to Customize XML Namespace Prefixes in JAXB, Keeping Only Specific Prefixes?
I'm generating XML using JAXB and need specific namespace prefixes for my XML elements. Here's an example of the XML structure I am currently generating, where each namespace has a unique prefix:
<...
-1
votes
0
answers
27
views
Converting VTEX_C Files to PNG in Java, Output PNG File Not Correctly converted
I have a program in Java, that first reads a vtex_c ( The .vtex_c file is a texture format used by Valve's Source 2 engine. ) file and then writes a png file.
It seems to compile the file without ...
-1
votes
2
answers
45
views
How to assign a value obtained by Stream to String variable in Java? [duplicate]
This is related to automation testing using Selenium and Java.
I am getting all elements of a column in a List<WebElement>.
After this, I want to get the first element of the above list using ...
0
votes
1
answer
30
views
Mockito: mockStatic.when().thenThrow() behavior
I'm writing a test for a method that throws various exception. This test case is to throw SQLException and I noticed these behavior.
@Test
public void testGetPreparedStatement_throwsSQLException() ...
0
votes
0
answers
23
views
Problem using Spring AOP with Java FX Controller
I have integrated Java FX with Spring boot using "javafx-weaver-spring-boot-starter" of "net.rgielen". I want to execute some code before the call of a method of the controller, ...
0
votes
0
answers
28
views
What happens when I have 2 static variables with the same name? [duplicate]
I am a Java beginner and am having trouble understanding the output of the System.out.println(((A)b).s) in the code.
My understanding is that static variables can be changed anywhere in the class and ...
-1
votes
0
answers
29
views
What Linux OS will permit Netbeans to Update a currently non-functional Java App?
From Nov. 2016 - 2022 I used a very functional GPL3 Java app from github (AutoPrimer3). In 2022 I successfully recompiled it using Netbeans in order to change one hardwired parameter. Now, the app ...
0
votes
0
answers
35
views
I need help making sure my code is thread safe
So I am trying to use SwingWorkers in my application (written in Java) where I collect some data from an API and display it in the app's GUI. Please keep in mind that I am very unsure when it comes to ...
-4
votes
0
answers
25
views
How get id xml files if i have String name? (Java) [closed]
I have a code in which I access an XML file and take the data there. I need to make sure that he finds it for me by the name of the document and I can contact him. On Java.
I have data in the game ...
-1
votes
0
answers
16
views
React overlays on google map
I have this google map with overlays. The positions for overlays are provided by a firebase realtime database. The database works but when it updates new overlays are created instead of moving old ...
-3
votes
1
answer
27
views
Merge multiple PDF files using Java and Mulesoft [closed]
The Challenge: Merging PDFs
As integration Medium, our tasks often involve consolidating information scattered across multiple documents. Merging PDF files is a common requirement that can be ...
-2
votes
0
answers
36
views
Spring Security Warning: How to Fix AuthenticationProvider vs. UserDetailsService Configuration?
I’m encountering a warning when starting my Spring Boot application with Spring Security configuration. The warning message is:
WARN [ restartedMain] r$InitializeUserDetailsManagerConfigurer : Global ...
0
votes
0
answers
20
views
How to write verify for static methods that have been called [in Mockito Core] [duplicate]
Without using PowerMockito and using Mockito-Core (version of mockito doesnt support with powermockito and i cannot change mockito version), How can i verify that a call to a static method have been ...
-1
votes
4
answers
75
views
How can I convert to string? [closed]
I am trying to convert the "Black" to string but I am not getting it
colorList.add(new ColorView("Black", "#000000"));
0
votes
1
answer
13
views
"java.lang.IllegalStateException: org.springframework.cloud.config.client.ConfigServerInstanceProvider$Function has not been registered"
Getting the exception:
java.lang.IllegalStateException: org.springframework.cloud.config.client.ConfigServerInstanceProvider$Function has not been registered
In Spring Cloud Config Server.
Configured ...
0
votes
1
answer
61
views
How to extract only visible text from pdf page?
I am trying to extract the text from pdf, but the problem it is also reading the hidden text as well.
How I could solve this?
I tried below code
public static void iTextExample() {
String ...