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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
8 views

How to map a nested value to a property using @JsonAlias annotation?

I need to get the Country Name from the nested object by @JsonAlias annotation on Java, Spring Boot project. @JsonAlias is working properly for name field. But, not work on nested or child objects ...
Badrul's user avatar
  • 931
0 votes
1 answer
21 views

Why there is NO WAR file under my Java Project upon Export?

I am trying to build my project using the WAR in Java but it is not visible upon exporting, I can't find the same problem as mine. Does anyone encountered this issue and how did you resolved? Thank ...
Euphoria's user avatar
0 votes
0 answers
10 views

Java: How to Crop an Image Outside It's Original Boundaries

I have an image of a face that's a narrow rectangle and I want to crop a square image centered on the face so that the bounds of the cropped image extend beyond the boundaries of the original image. ...
SGT Grumpy Pants's user avatar
-1 votes
0 answers
19 views

In the Java language of Android Studio, would it be possible to create an app that always overlays the cell phone screen as a filter?

I'm trying but I haven't found anything that meets what I need. Which is an app created in Android Studio, using the Java language, where it will have a screen to activate the filter with a button, ...
Reinaldo's user avatar
-2 votes
0 answers
34 views

java - read csv file as a stream of lines - handle each line before reading the whole file

I read a file like this: try (Stream<String> lines = java.nio.file.Files.lines(Path.of(filePath), StandardCharsets.UTF_8)) { lines.skip(1).forEach(line -> { ...
Rony Tesler's user avatar
  • 1,242
0 votes
0 answers
9 views

Java program throws "Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument", but in VSCode it works

I'm working in the final project for my degree but I have some problems and I don't find any answer. I have my code in VSCode, and it works fine. I build the project this way: enter image description ...
Angel Rodriguez's user avatar
0 votes
2 answers
34 views

Sorting alphanumeric characters which has large numbers (over a million) with commas. but the java is sorting based on the first number, fails assert

I am reading the values from UI values sorting ascending and descending and validating using sort function but the sorting is failing as you can see the values are sorting based on the initial digit ...
Girish's user avatar
  • 1
-1 votes
1 answer
19 views

How can I get the "version code" of my application from Google Play?

I have created an Android application(Java). I want to get the "version code" of my Application from Google Play (or other Stores). so that whenever I release a new version of the ...
Ali Ghayed's user avatar
0 votes
0 answers
5 views

How to create a proper tick method in a lib gdx game

I just started with lib gdx and essentially gave up on using lwgjl for making a game as it is ridicoulosy overcomplicated. The problem is that lib gdx has a built in create() method run once at ...
JewishBanana's user avatar
1 vote
1 answer
32 views

In Java, how do I copy part of the application package structure to a directory on the file system?

My java app, packaged as a jar file - app.jar - has the following package structure: com company pkg1 pkg2 help dir1 file1 ... dir2 ...
wolfman's user avatar
  • 133
0 votes
0 answers
11 views

Use of VpnService is not a permitted use case i face this issue

I face this issue "Use of VpnService is not a permitted use case We are unable to confirm your app's declared use of VpnService as a permitted use case." i update my app but still same ...
Sufi Ammar Sahb's user avatar
0 votes
0 answers
5 views

Toxiproxy in Spring Boot test

I am trying to experiment Toxiproxy in a SpringBoot test (for a poc) to inject a latency and have this simple test class but the latency toxic I'm setting does not seem to have any effect at all and I'...
ham_ben's user avatar
0 votes
0 answers
10 views

Sphincs+ in Bouncy Castle

I was trying to understand how to use Sphincs+. package cdss; import java.io.IOException; import java.security.SecureRandom; import org.bouncycastle.pqc.crypto.sphincsplus....
Alex's user avatar
  • 1
0 votes
0 answers
15 views

Why is the FXML event I'm using in my controller null? [duplicate]

`@FXML private static TextField ResponseField; This is the function the "ResponseField" element is calling public void GoToResultScreen() throws Exception { if (Character.toUpperCase(...
FL_Programmer's user avatar
0 votes
0 answers
14 views

Null condition in Jpa @Query

I have a query in JPA, but all parameters should be optional. I tried many different ways, but none were successful because they threw some error. If for example the given list of job Types is empty ...
Apatus's user avatar
  • 143
-2 votes
0 answers
15 views

Java - Error: LinkageError occurred while loading main class application [duplicate]

Class Program: package application; import java.util.Locale; import java.util.Scanner; import entities.Triangle; public class Program { public static void main(String[] args) { Scanner ...
Rodrigo Santos's user avatar
0 votes
0 answers
28 views

jdbcTemplate BatchUpdate sending row by row instead of bigger batch

Spring JdbcTemplate is sending small batch sizes of 1-3. I would like batch sizes of 10,000. The code im using to call the batchUpdate is below, and the logs im seeing on the postgres db from AWS. I ...
robber's user avatar
  • 55
0 votes
0 answers
11 views

Java - Use custom lexer with jparsec

I am currently writing a parser for a language that has very complex lexer rules. For example, the lexer decision depends on the column at which a token appears. I wanted to use jparsec, but I can't ...
niosega's user avatar
0 votes
0 answers
31 views

Final value in Java getting reinitialized? [duplicate]

I have a variable newcat finally declared, however it appears to be changing its value from null to its default assignment, how is this possible? public static class Davido { private ...
linker's user avatar
  • 823
0 votes
0 answers
12 views

Http client isn't catching the exception and converting to response

I am attempting to post to a server, which calls the below client. However, the response throws an exception with the client not property capturing the error codes (400/500): Caused by: com.sample....
lil chogomo's user avatar
0 votes
2 answers
36 views

Fun with Generics; Type-Safe HashMap<Class<?>, CachedObject<?>> [duplicate]

PrinterService has a generic getAttribute function that uses a Class argument to determine the type of attribute returned. Due to a memory leak in java (JDK-7001133) we are caching these values. Most ...
Kyle Berezin's user avatar
0 votes
0 answers
5 views

Integration between Keycloak and Google Cloud Logging

Context Hi everyone, Actually I'm trying to set logs from Keycloak server to Google Cloud Logging. I've already read the follow documentation: https://cloud.google.com/java/docs/reference/google-...
MrP4sten's user avatar
-2 votes
1 answer
28 views

JOptionPane input with parse double is adding an extra 0 to my input [closed]

im just parsing a String to a double using Double.parseDouble with JOptionPane, asking for user input. When the input is 2, for example, it just returns 20. Heres my code: import java.util.ArrayList; ...
Fire Frekox's user avatar
-1 votes
1 answer
73 views

Is there a way to make a sqrt function without using Math.sqrt ()and without loops?

I'm trying to make program that uses recursive for a college homework but teacher does not want me to use loops for the problems but this is a jGRASP java program. And this is the homework:homework ...
RWorker's user avatar
  • 11
0 votes
0 answers
16 views

Receiving NONE_PROVIDED in username parameter in the loadUserByUsername() function in Spring Boot 3.1.2

I am making an authentication feature for my Spring Boot API using Spring Security and OAuth2ResourceServerConfigurer. I am storing the user details in a MySQL database. For an authentication request, ...
Ayush Kumar's user avatar
0 votes
0 answers
5 views

Integrating Spring with AWS Binder (Kinesis)

I'm trying to implement an integration solution with Kinesis (AWS), using "Stream Binder Kinesis". I need to send a json(String) to a queue (producer). I'm based on the example https://www....
Anderson's user avatar
0 votes
0 answers
12 views

Understanding socket timeout when using okhttp-sse

I'm using okhttp-sse to consume server side events in Java. OkHttpClient httpClient = new OkHttpClient(); String sseUrl = getSseUrl(); Request request = new Request.Builder() .url(sseUrl) ....
leros's user avatar
  • 495
0 votes
0 answers
8 views

Handling EntityManager in a multitenant application

I have a ejb + REST application using jakarta ee 10, deployed in a Wildfly 29 server; the application uses multitenancy. When a user logs in, i have to check which database the user is going to use to ...
jmiguel77's user avatar
  • 824
0 votes
0 answers
6 views

How to retrieve certificates from the Local Computer\Personal\Certificates path in Groovy Jmeter

I'm trying to retrieve certificates stored in the "Local Computer\Personal\Certificates" path on my Windows machine using Groovy in JSR223 Sampler in Jmeter. I'm testing my code with the ...
Ki To Kiroto's user avatar
0 votes
0 answers
10 views

TestNG Reporter log messages that show when you click on a test method in the HTML report

When I use Reporter.log() the messages are displayed in the Reporter output section of the HTML report. I would like to be able to show these messages under each test that I click in the Results ...
CuriousGuy's user avatar
  • 1,545
0 votes
0 answers
3 views

Flink Error: Accessing a field by position is not supported in name-based field mod

I have a Row that I am trying to use in Flink like so: Row row = Row.withNames(); jsonNode.fieldNames() .forEachRemaining(fieldName -> { row.setField(fieldName, jsonNode.get(fieldName));...
ritratt's user avatar
  • 1,723
-3 votes
0 answers
23 views

JDBC java.sql.Connection.isReadOnly doesn't return correct result [closed]

I'm facing an issue where RDS failover results in "java.sql.SQLException: The MySQL server is running with the --read-only option so it cannot execute this statement" (mentioned a lot of ...
Wojtek's user avatar
  • 1,839
-2 votes
0 answers
39 views

Cannot resolve symbol 'listView' [duplicate]

There is only one ListView in the XML page and its id is listView. In the following line listView has a red underline. binding.listView.setAdapter(arrayAdapter); ^^^^^^^^ ^ Cannot ...
hatice genç's user avatar
-1 votes
0 answers
23 views

How to test setter for object created method inside?

An object response is created in the service method. Then a string is setted for response. So the test throws a NullPointerException, because the response object is null. I have create mock of ...
Semion3017's user avatar
0 votes
2 answers
48 views

Create a filter for URL that follows a specific format

I have a URL of this form: http://aa-bb.cc-dd-ee.w.x.y.z:8080/funservice/graphql I only want to filter in the requests where w.x.y.z is strictly: fun.foo.bar.net I am trying to do with this but I am ...
90abyss's user avatar
  • 7,089
0 votes
0 answers
8 views

Error raised in Spring Kafka app with Kafka template: javax.management.InstanceAlreadyExistsException: kafka.producer:type=app-info,id=ex_SERVICE

I'm able to send messages to my Kafka cluster however after sometime I'm getting errors like: The web application [ROOT] appears to have started a thread named [kafka-producer-network-thread | ...
SocketM's user avatar
  • 564
-2 votes
0 answers
40 views

Checking collision with snake itself

My problem is that my game is over (gameOver = true) when my snake tries to eat food because void grow() { if (snakeHeadX == foodX && snakeHeadY == foodY) { segments.add(new Segment(...
noel's user avatar
  • 1
0 votes
1 answer
24 views

Java Hibernate database doesn't automatically insert timestamp in MySQL database

So this is my current Java Hibernate code, this table is part of a database that is supposed to store temperature values import jakarta.persistence.*; import lombok.Data; import lombok....
Marcus Peterson 's user avatar
-1 votes
0 answers
11 views

Caused by: java.lang.NullPointerException: Cannot invoke "org.hibernate.type.descriptor.sql.DdlType.getTypeName(org.hibernate.engine.jdbc.Size)"

I'm Migrating from Java-11 to Java-17 and Spring Boot-3. Using Postgres as a database. Using Hibernate 6+. Updated annotation accordingly to Hibernate 6 like jakarta.persistence.* Getting error while ...
Angad Bansode's user avatar
0 votes
1 answer
20 views

SpringSecurity AuthorizationFilter returning 403-Access Denied with user logged in

I am using JWT for keeping the user authenticated between requests. The thing is that, after registering and logging successfully, building the token used for the rest of the requests, when I try to ...
Wolf Ganger's user avatar
0 votes
0 answers
15 views

Byte Buddy Advice Custom Object

I'm trying to use byte buddy and I appreciate your help for the below: Given that I have the following class public class MyAdvice { private String param1; private Object param2; public ...
chelayel's user avatar
0 votes
0 answers
27 views

Same function different runtime?! Why is the time measured not the same when adding code elsewhere? Java, Sorting algorithm time measurement, nanotime [duplicate]

Function1 num1 = new Function1(); //Function2 num2 = new Function2(); ArrayList<Integer> nonSortedList = new ArrayList<>(); for (int i=1; i<10000000; i++) nonSortedList.add(i); ...
HelpAnElf's user avatar
0 votes
0 answers
10 views

GDevelop preview wont load, possible error

I am currently experiencing problems with GDevelop as the debugger wont tell me whats wrong since there arent any but the preview doesnt seem to be working after multiple saves, feedback is supposed ...
Hymandois's user avatar
1 vote
0 answers
36 views

spring boot can't find my repository after adding a new repository

GameRepository.java: @Repository public interface GameRepository extends MongoRepository<Game, String> { } GameRepositoryReactive.java: @Repository public interface GameRepositoryReactive ...
Rony Tesler's user avatar
  • 1,242
0 votes
0 answers
8 views

ContainerRequest Response abortWith aborting and not providing response

I have implemented Container Request and created filter method and i am trying to abort in case of authorization failure. I see that the application stops as expected but it is not returning any ...
Satish's user avatar
  • 1
1 vote
0 answers
27 views

Weird issue, my app's service minimize other apps when it's enabled?

If the user enables an option in my app called Quick Launch whenever they plug the charger into their device, my app will automatically open. The issue is that when this Quick Launch option is enabled,...
Mouaad Abdelghafour AITALI's user avatar
0 votes
1 answer
15 views

HtmlUnit: Handling Hidden Google reCAPTCHA Token in Login Automation

I'm using HtmlUnit to automate the login process on a website. The website employs a Google reCAPTCHA to protect its login form, and the reCAPTCHA token is hidden in the HTML. I need to obtain and use ...
Abraham Arnold's user avatar
0 votes
0 answers
26 views

How to use custom font with PDFBox

I am using PDFBox to fill a pdf which contains text form. At one form I have to use a custom font. I used below code to load a custom font. Even though path is correct It it is failing with the error ...
Vishal Kumar's user avatar
0 votes
1 answer
32 views

Unable to set up a simple Redis + Spring project: "Java 8 date/time type `java.time.Instant` not supported by default"

and many thanks for your help in advance! I am trying to set up a simple Spring + Redis project, using IntelliJ, and sadly it just doesn't work. I have checked countless forum posts here, but sadly to ...
overwriter's user avatar
0 votes
0 answers
16 views

Problem with Wildfly and Eclipse and library?

I am creating a web app for a course, I have inserted the data from Eclipse into MySQL, but when I try to insert them via URL through a servlet, it returns error 404. I'm using Eclipse. I might have ...
Christian's user avatar

1
2 3 4 5
38148