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.

java
Filter by
Sorted by
Tagged with
1 vote
1 answer
10 views

Difference between Mat.n_delete() and Mat.n_release

I am using OpenCV with Java and because OpenCV has no idea about what the Java GC is doing, I have always been told that I need to release my Mat objects using Mat.release() to avoid memory leaks. ...
vatbub's user avatar
  • 2,942
-1 votes
0 answers
13 views

discover missing accoutrement to get a piece of Java 8 code to run the way I want [closed]

I ran across the following example code: private List<String> regexToList(String words, String regex) { List wordList = new ArrayList<>(); Matcher m = Pattern.compile(regex)....
Lucky's user avatar
  • 655
0 votes
0 answers
8 views

How to get incoming call information on Android

I am building mobile application on the Android. I need to get a incoming call information on the Android device. For lower level than api 31, and higher than api 31, How can I do this? Please help me....
Denis Li's user avatar
0 votes
0 answers
11 views

Karate match with condition

I know about conditional assertion and also the discussions around match. My case seems to me to be not as complicated as discussed in the last question. So what I want to achieve is to match things ...
Serob_b's user avatar
  • 997
0 votes
0 answers
5 views

Embedded Hazelcast Kubernetes Auto Discovery not working with Payara Server Full 5.2020.6 on Openshift

I have a multi-instance web application deployed on payara server community edition 5.2020.6 in openshift 4.11. I want to enable payara server embedded hazelcast for session replication. I have ...
Mausam Shrestha's user avatar
-1 votes
0 answers
10 views

Why is Netbeans IDE not able to create an exe file through native packaging?

I have a javafx project and I enabled native packaging in netbeans but when I tap Package as exe it builds and says build successful but I cant find the file where its supposed to be at.Im supposed ...
biggX's user avatar
  • 1
-1 votes
0 answers
7 views

How to deserialize a Thrift object string in Java

I have a string representation of my Thrift object as follows: objStr = "MyObject(id:1, name:abc xyz, flag:true)" I want to convert it back into the thrift object itself. How can I do this? ...
charmander's user avatar
-1 votes
0 answers
6 views

Encountering Error when Running WordCount on Hadoop

After performing all the steps in the tutorial, when I run the command for performing a word count on the file, it shows an error. I have been trying to resolve this issue for the past three days, but ...
Muhammad Noman's user avatar
0 votes
1 answer
19 views

Assigning Hex Values from String to an Integer variable

Context: Java 22 I'm trying to read data from a table that includes both Hex and Dec values in a CSV. These values would look something like this: 0x00000000,0 0x03000000,1 0x05000000,2 What I'm ...
Spenser Spratlin's user avatar
-4 votes
0 answers
12 views

Is there any functionality that allows me to manipulate a pdf or .doc or .txt using the data saved on a mysql database and using SpringBoot? [closed]

i'm starting to work on a new project for my school, i need to make an CRUD application which allows me to send to the user some SCHOOL PROCEDURES. That's why i need that my aplication made on spring ...
Sergio Herrera's user avatar
0 votes
0 answers
13 views

Spring @Async architecture for scheduled, long running api calls

I need to solve the following problem, described exemplary: My Spring application checks every minute if there is a new job. If there is a job, it subtasks should be run in parallel. They are mostly ...
Maltram's user avatar
  • 79
0 votes
0 answers
14 views

How to stop SpringBoot looking into override classes in folder "TEST"

I have these two classes overridden in the folder test and main folder. -main -com.project.class -test -com.project.class I want to make Spring stop looking at the tests folder when I run my ...
Paulo's user avatar
  • 21
0 votes
1 answer
16 views

Can I re-generate the public certificate with different order of attributes in the Subject/Issuer string?

I would like to know if it is possible to generate a new certificate with the same public key (for a private key) and change the order of the attributes in the Issuer / Subject string? It is about an ...
BMNFF's user avatar
  • 1
0 votes
0 answers
3 views

Using Apache Mina sshd to upload files via ScpClient fails with exception in ScpHelper.readAck()

I'm trying Apache Mina for the first time and run into the exact same error. Using the suggested upload method parameters from How to upload/download files using apache SSHD ScpClient, it still throw ...
fsegers's user avatar
-1 votes
1 answer
43 views

Is this bad a bad codeing style in java? [closed]

I recently had an exam at university where i implemented a class like this: public class ClassName { private String variableName; //... public ClassName(String variableName) { this....
baul's user avatar
  • 45
0 votes
0 answers
13 views

JUnit5 listener from other library is not found

I have few different gradle projects(Proj_A, Proj_B, Proj_C etc) which contain only JUnit5 tests. I have another library package FooLibrary, in which I have defined a ResultAnalyzer to do some stuff ...
coldcake71's user avatar
0 votes
0 answers
10 views

I am encountering an error related to static file serving in Quarkus after uploading a new file until I restart Quarkus server

I am using the template provided in Quarkus documentation for the static file serving, and my mp3 save fn. package com.example.songcomponent.song.repository; import io.quarkus.runtime.StartupEvent; ...
Arturs Radionovs's user avatar
1 vote
3 answers
33 views

How to acces the attributes of an Object other in the equals method? [duplicate]

I am trying to overwrite the equals method with this code: public boolean equals(Object other) { if(!(other instanceof Termino)) return false; if(this.hashValue == other.hashValue) ...
Ardust's user avatar
  • 11
0 votes
1 answer
13 views

Hibernate is telling me my entity's id field "doesn't have a default value" even though I have @GeneratedValue and @Id on the field

I saw many answers to this question, none of which illuminated my issue. I've tried several configurations of my setup with little success. Here is my expected result: I can put a new Cart object into ...
plutownium's user avatar
  • 1,598
0 votes
0 answers
7 views

Spring Batch 3 to 5 migration: Job not launching

I am migrating Spring Batch 3 to 5.1.1, and have made the following changes in the Configuration class, after which Jobs are not launching. Spring Batch 3: package com; import com.jobs.PropManager; ...
Kalai Selvan's user avatar
-4 votes
0 answers
23 views

Libraries implementing "good" OOP practices [closed]

What libraries/frameworks do you know (preferably in Java) that implement object-oriented practice particularly well? And i am not necessarily talking about SOLID, but more like strong Encapsulation (...
steffenb's user avatar
-1 votes
1 answer
21 views

Classes broke after I did maven update pom [closed]

My classes were working fine previously and updating maven was not a problem. But now if I do maven update all my classes in different packages in the maven project are not recognising each other. I ...
RoboCoder's user avatar
-1 votes
0 answers
15 views

Fabric 1.18.1 bug

i got into modding and i was making a drugs mod including cannabis, i was making my code and i used the Bow class so you can "pull" at the Cigarette, all worked perfectly fine, but i was ...
Abgenommer's user avatar
-2 votes
0 answers
15 views

How to stack posts on a forum discussion on netbeans using java and mysql [closed]

I have a project on netbeans. I have a JFrame called discussion. On this JFrame, I tried to add an option to add posts that would save the posts there however I don't know how to display the posts ...
Alishbah Naveed's user avatar
2 votes
1 answer
13 views

How to set timeout while using @HttpExchange with RestClient in Spring Boot

I want to set request timeout while making API calls using @PostExchange or @GetExchange with RestClient. Below is the RestClient configuration: @Bean public BonusPayoutRestClient restClient() ...
Thanthu's user avatar
  • 4,748
-1 votes
0 answers
18 views

Question about efficiency of passing arrays vs strings for backtracking in Java [closed]

For today's Leetcode's daily Word Search (its literally like a word search), I implemented backtracking where it would recursively call itself on adjacent indices. I would use a checker for the ...
Mike's user avatar
  • 1
0 votes
0 answers
16 views

Migrating spring batch 5.0 JobRepository with cassandra

I am migrating a spring batch application to 5.0. I am using java 17 The application used JobBuilderFactory, and StepBuilderFacotry which both are removed by spring. I can no longer use ...
KineticUncertainty's user avatar
-1 votes
0 answers
6 views

Is it possible to obtain or identify by a userId all his traces with opentelemetry?

I'm using opentelemetry(I'm a newbie) Elasticsearch kibana and Java. How can I track and identify the users of my application using opentelemetry I can get the traceID and spanID but these change in ...
Wil18's user avatar
  • 1
-3 votes
1 answer
17 views

how to get country and state by phone number in android studio [closed]

I am creating a communication app so how can i get country and state by phone number. I am creating a communication app so how can i get country and state by phone number in android studo . if you are ...
Bittoo Kumar's user avatar
0 votes
1 answer
36 views

LinkedList Java: Iterator is stuck at first node

The program will not iterate through the whole list of towns added. Gets stuck at index 1 of the linked list, which is in ascending order. I have tried to move the cursor of the linked list by calling ...
Felix Mbugua's user avatar
-3 votes
0 answers
36 views

Set the JAVA_HOME environment variable to railway [closed]

I have an application developed with python and django, which uses the tabula-py library and requires jdk to work. On a local machine, the JAVA_HOME environment variable was set to its value "C:\...
Jefferson Cuji's user avatar
-1 votes
0 answers
18 views

How to solve java.io.IOException: Could not rename file X to Y?

I am working with MPLAB X IDE v5.45 and have the following git repository. I am on branch too_SD_files, as can be seen from the above image. If I try to switch to branch master (local) I can easily ...
Guille's user avatar
  • 396
-1 votes
0 answers
8 views

What is the difference between HADOOP_HEAPSIZE and xmx?

For hive metastore I can set HADOOP_HEAPSIZE=512 or HADOOP_CLIENT_OPTS=-Xmx512m. Do these settings equal? What is the difference? Can I set only one?
Cherry's user avatar
  • 32.3k
-1 votes
1 answer
11 views

Spring Boot audio endpoint: releasing JDBC resources much slower on VPS, fast on localhost

I have this code in a @RestController: @GetMapping("get_sound/{name}") @CrossOrigin public ResponseEntity<byte[]> getSound(@PathVariable(name = "name") String ...
parsecer's user avatar
  • 4,976
-4 votes
2 answers
50 views

How do I use a for loop inside a method with an array parameter? [closed]

I want to start and preference that I am still new to this and learning. I'm trying to figure out how to use a for loop for this assignment. Hopefully I can get some help :) This is the code. package ...
Prago's user avatar
  • 27
-5 votes
0 answers
23 views

Is it possible to make a new linked list for each iteration of a for loop? [closed]

This is kind of a follow up question from my previous question which is a twin/pair of list node and linked list. A list node follows a another list node (making a linked list) and a list node has a ...
Blueyu's user avatar
  • 83
-1 votes
0 answers
10 views

why am unable serialize protobuf while publishing kafka

My Kafka configurations are as follows not getting any errors while compiling @Bean public Map<String, Object> consumerConfigs() { Map<String, Object> props = new HashMap<>();...
lada's user avatar
  • 261
0 votes
1 answer
19 views

JAVA JPA Eager load only first element of sub attribute

Context : i have Auhtor Book and Publisher public class Author { @OneToMany List<Book> books; public class Publisher { @OneToMany List<Book> books; } public class Book { ...
Zacharie's user avatar
0 votes
0 answers
11 views

How can i fix the Jython no named module error

Im trying to use java gui in intellij to make a login screen for a instagram scrapper program ran on a python file. However, i need to run the python file from java and so i'm using Jython to try and ...
Daniel garcia's user avatar
-1 votes
0 answers
23 views

Annotation Processor Throws ClassNotFoundException

Hi I'm starting study annotation processing in Java using gradle, follow multi project struct: ROOT | |-sample # contains main classes |-annotation # annotations read by processor |-processor # ...
Jose Luiz Junior's user avatar
-1 votes
0 answers
21 views

IndexOutOfBounds exception thrown when training AirPassengers model in DJL

Hi I am trying to create a Java code using DJL that trains a model to forecast the airpassengers data. I have all the code, seems that should work, but I am getting an ArrayIndexOutOfBounds during the ...
lordofthejars's user avatar
-4 votes
0 answers
20 views

Compare elements within a List in Java [closed]

A list has two data mapped to it. Comparison to be done whether one of the element in the object matches with each other or not. ArrayList detailList = [[a=12, b=1, c=13, d=100],[a=3, b=1, c=34, d=10]]...
priyadharshini Ananthakumar's user avatar
0 votes
1 answer
36 views

Unable to handle .isPresent() while creating Juint test cases

if (clientDetailsRepository.findIDByClientName(clientDetailRequest.getClientName()).isPresent()) { return CommonUtils.getResponseObject(HttpStatus.CONFLICT, req, "...
Amay Chugh's user avatar
0 votes
0 answers
13 views

Setting Random Background Images for Main Activity (Android Studio - Java)

Heyo! So, I've been having issues setting a random background image to my main activity, the general idea is when the app is opening, it will run the random generator, pick a number, and assign an ...
Brendyn Burns's user avatar
-1 votes
0 answers
14 views

How to mix `autoCommit=true` and `autoCommit=true` @Transactional operations in a single Spring Boot application for one DataSource?

I wish Spring @Transactional would add support for autoCommit=true, similar to the readOnly=true option. In my Spring Boot application, I would like to use a mix of: autoCommit=false (default) ...
Justin Cranford's user avatar
1 vote
1 answer
27 views

Change Charsequence array to String array or List<String> in Java

It should be simple but I couldn't find the easy one line answer. How can I change CharSequence[] to String[]. My goal is to change CharSequnce[]={"a","b","c"} to List<...
arman javadi's user avatar
2 votes
3 answers
61 views

Force Mockito to return null instead of emtpy list

I have a simple test with mocked Properties class: @RunWith(MockitoJUnitRunner.class) public class MockitoReturnListTest { @Mock Properties myProperties; @Test public void ...
fascynacja's user avatar
  • 2,246
1 vote
1 answer
43 views

NullPointerException when trying to deserialize special object graph with Java 9 or later

I'm workig (as a part of a team) on an Enterprise Java application that has been in active development for 15+ years now. We are looking to build a REST API that would call some of the EJBs of the '...
Gozke's user avatar
  • 11
-2 votes
1 answer
33 views

are string methods applicable on character array in java? [closed]

i want to know whether string methods work in the same for char[] array also. recently in my code I have use string methods on char[] array the system doesn't give any error but it doesn't yield the ...
fact 99's user avatar
  • 15
0 votes
0 answers
26 views

spring jpa get after saveAndFlush()

I have one javaBean like: class testBean{ @Id @UuidGenerator @GeneratedValue private UUID id1; //key, generated by database private String id2; //not key, generated by database ...
monica's user avatar
  • 1

1
2 3 4 5
38343