Questions tagged [java]
Java is a high-level programming language. Use this tag when you're having problems using or understanding the language itself. This tag is rarely used alone and is most often used in conjunction with [spring], [spring-boot], [jakarta-ee], [android], [javafx], [hadoop], [gradle] and [maven].
1,770,007
questions
-1
votes
0answers
13 views
Assistance on the arrays
When I was given this question, my mind went blank and I have no idea how to program this question. Any help would be appreciated.
Consider a program which can evaluate strings of DNA code. DNA code ...
-1
votes
0answers
7 views
Is there builtin support for command pattern in spring or do you have to define everything manually?
I directly recall doing something like this before but cannot find any references to it because I forget what it's called. I believe it's similar to command pattern, in that methods become objects ...
1
vote
1answer
5 views
'Many To One' attribute type should not be a container
I have this class:
import org.springframework.security.core.userdetails.UserDetails;
@Entity
@Table(name="t_user")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(...
0
votes
1answer
8 views
Can I use Java code inside the @Calculation annotation in OpenXava?
Does the @Calculation annotation support Java code? For example, does the next code work?
LocalDate startDate;
@Calculation("startDate.plusDays(400)")
LocalDate endDate;
Otherwise, how can ...
0
votes
0answers
5 views
What is the best way to await functions in UI testing in Android Studio without Thread.Sleep()?
I'm using Espresso to write some automated tests for an Android app that I've developed. All the tests are automated and are passing/failing according to what happens with the UI. I've ran the code ...
0
votes
0answers
11 views
Error: “Key is not present in table” when inserting new data @manyToMany
i'm new to this so i hope i can explain this correct. I have a project with a usser registration/login and user roles. Now I want to make a ToDo function where users can make there own tasks. I want ...
0
votes
0answers
10 views
how can i display popup message through java and html? i want to display popup message in html page but my backend code is on java file
html file
<form action="./register" method="post" class="contactform">
<div class="aa-...
1
vote
1answer
28 views
How can I have 9 objects modify the same value of another class?
So i have 9 objects and they all create a different object each that contains the value I want to modify, but I want all of them to modify the same value so like if object one adds the variable is now ...
0
votes
0answers
8 views
Could not find method jcenter() for arguments [] on object of type org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository
I am trying to learn android development, but I can't setup my Android Studio, because there is always this error:
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$...
0
votes
1answer
15 views
How to find the index of an item in an array, which is currently being iterated through
The Problem
So, I am creating an iteration of an object for every element in two different arrays, but one of the parameters of the object is the index of one of the arrays.
I have the first array, ...
0
votes
0answers
9 views
Converting C# RSA encryption code to Scala
Trying to convert this working C# code to working Scala code.
At first, I couldn't pass the public key correctly to the Scala code because there isn't an equivalent function for rsa.FromXmlString(...
0
votes
0answers
9 views
When running simple RESTful web service in Java using Jersey 3.0.1, HTTP Status 404 error is displayed
I am trying to work with jersey and was trying to build a simple jersey API on Spring Tools Suite(Java jdk11) on server Apache Tomcat v9. It is a maven project and the jersey API version is 3.0.1. I ...
0
votes
0answers
2 views
no such method org.jboss.logging.Logger.debugf SpringJPA
So I have no idea whenever this started as my project seemed to work perfectly last week and this week throws this error
java.lang.NoSuchMethodError: org.jboss.logging.Logger.debugf(Ljava/lang/String;...
0
votes
0answers
15 views
How to get a column value from an insert statement back into Java using JDBC
I am wondering how I could process an INSERT statement on an Oracle Database and get the generated column name back into my Java code. I esentially need to register an out parameter, but using a ...
-1
votes
0answers
11 views
Passing ArrayList from jsp to servlet
I have a session variable, an ArrayList in a JSP and I wants to retrieve it from my servlet, when it's a string or an int it's pretty easy, I put the variable in the url and I retrieve the variable ...
0
votes
0answers
3 views
Java net HttpClient: React to timeout in async call
My goal is to react to the timeout in an asyncronius call of the HttpClient. I find many information on how to set the different timeouts but I do not find any information on how to react to the ...
1
vote
0answers
16 views
Deleting a node from a Binary Search Tree using only a node's key
I'm adding some functions/working with a pre-written program (a customer account database), which uses a Binary Search Tree, and I'm trying figure out how and why this remove method works:
public ...
0
votes
0answers
11 views
i keep getting volley network error after clicking the signup button
I am getting a volley Network Error and I have been trying to work on this issue for a week now. please help me check my code if there is an issue with it. I am using namecheap shared hosting and ...
-1
votes
0answers
9 views
Injecting code into a method that is overridden (Java)
I have this:
public class Superclass {
public int getMaxLevel() {
return 1;
}
}
public class Subclass extends Superclass {
public int getMaxLevel() {
return 4;
}
}
and I need it to ...
0
votes
0answers
4 views
Oauth2 springboot after successful validation credentials flow
I am building login application using OAuth2 and spring boot microservice. The challenge I facing is implementing two factor authentiation. Once the user enters credentials when gets successful then ...
0
votes
0answers
7 views
How to generate .wasm file or .wast file from java source code?
How I can generate .wasm file or .wast file for the following code:
import java.util.ArrayList;
public class NewClass2
{
public static void main(String[] args)
{
ArrayList<String>...
0
votes
0answers
15 views
What causes replacement (�)(<?>) and random characters in Android Studio's logcat during Gradle build and runtime?
I'm developing an app on Android Studio.
During Gradle build and during the runtime, even before the main activity is launched and especially during the execution of a timer Service some random ...
0
votes
0answers
10 views
LocalDateTime field: MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
I have a main class:
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
public class ContentModel implements Serializable {
@JsonProperty("serviceData")
private ServiceData ...
0
votes
0answers
6 views
Spring authentication with Oracle JDBC10
I'm following a Spring Course that the teacher makes an example of Spring Security (loging page with spring mvc) ... he's using mysql and i'm trying to do it but with Oracle Database 19c, width ...
0
votes
0answers
4 views
XSD to Java objects using the XJC (JAXB) results in [ERROR] Property “Value” is already defined. Use <jaxb:property> to resolve this conflict
There are a lot of answers related to this but for some reason, I am still confused and unable to get the Java objects for my XSD.
I am trying to create the Java objects from XSD using the XJC JAXB ...
0
votes
1answer
17 views
How to prepend/add a “03” infront of hexString of a byte array in java?
Suppose I have a byte array
byte [] initial = ......;
And it's corresponding hex string is 0xfr123444 ,i.e;
System.out.println(Numeric.toHexString(initial)); //--> 0xfr123444
How to add "03&...
-1
votes
0answers
7 views
Implement Gossip protocol with Java and Spring boot
I am trying to implement a gossip-based communication protocol for a SpringBoot application. The protocol is expected to replicate some custom state which would be shared by clients with a service ...
0
votes
0answers
6 views
How to run a gatling test from a java code and pass the url of test in parameters of simulation?
I want to be able to pass parameters to a Gatling Simulation from a java code and specially the url of test. I use Gatling with maven method. Someone help me please.
-1
votes
2answers
45 views
What to do if 2 classes have the same package statement
I'm running into a problem where 2 classes from 2 different packages (owned by the same group) have the same name and package statement
Package 1
package com.placeholder.constants.Constants
public ...
0
votes
1answer
26 views
How to click on a button using Selenium
I have the below code in src/components/Introduction.jsx file which I have not created and want to work further on it.
import RaisedButton from 'material-ui/RaisedButton';
import Paper from 'material-...
0
votes
0answers
4 views
How to access current headers of SOAP request with Spring WS without using the underlying transport classes
Suppose I have this kind of an interceptor:
public class MyClientInterceptor extends ClientInterceptorAdapter implements ClientInterceptor {
@Override
public boolean handleRequest(...
0
votes
0answers
9 views
Java Bean - extract corresponding data from DB
I want to view all of the data stored about a user in my db using my bean value="#{userBean.name}.
What type of query would work best?
0
votes
2answers
14 views
Applandeo Material-Calendar-View, how can I change the language of displayed months?
I'm using this material calendar view library: https://github.com/Applandeo/Material-Calendar-View
And I can't find how to change the language of the calendar, changing language/location of my ...
1
vote
0answers
25 views
Tic-Tac-Toe board output
I was doing a tictactoe game assignment but my board did not turn out as I want it to. I am attaching a picture of how I want my board to like along with the part of the code I need help with. thank ...
0
votes
0answers
11 views
How to access java object methods returned value in thymeleaf template
Tried to get the returned value of the method in thymeleaf template but faced an issue. following is the environment
Controller class :
@Component
@Controller
public class HighController {
...
0
votes
0answers
4 views
How to set the Bluetooth profile to HFP when connecting to a device in android?
I have created an app that when run on two devices will connect to each other via socket and transfers commands as strings much like a chat application, I want to transfer the audio input and output ...
0
votes
0answers
10 views
Android Studio - Layout Elements differ in size on the physical device, compared to the preview and emulator
I'm relativly new to android. While designing my layout I stumbled over an problem I can't solve and which doesn't seem to be answered anywhere. Or maybe I don't really know what I have to search for. ...
0
votes
1answer
33 views
Alternative for Java String array for performance
I am using a few 4 dimensional and 3 dimensional Java String arrays. The reason for using a String array is I have a mixture of data types. Although approximately 85% of the array is NULL, 10% is ...
-1
votes
0answers
11 views
Why after an exception, do I have to do a Ctrl-C in the terminal to unlock the spring boot application, to continu to process the other requests
i have a Spring boot application running with java -jar myapps.jar
when an exception occured, the application doesn't process any other request (rest calls),
the process is bloqued, and i have to do a ...
0
votes
0answers
9 views
ParserException in Manchester Syntax
I try to use ManchesterOWLSyntaxParser from OWL-API. I need to convert String in Manchester syntax to OWL Axiom, which I can add to existing ontology. The problem is, that I always get Parser ...
0
votes
0answers
15 views
API for Golf Course Information [closed]
Does anyone know of any free API's for golf course Information. Looking specifically for Scorecard Info. Doesn't need to be specific to any country, just a decent amount of courses with scorecard info ...
0
votes
0answers
2 views
Configuring Tomcat and Maven on Visual Studio Code
Hello I'm trying to configure Tomcat and Mavern on VSCode but am having a lot of trouble.
Whenever I generate a Mavern project warfiles are never created so I am not able to deploy anything on to the ...
0
votes
1answer
41 views
index 0 out of bounds
I have just started Java.I have some C++ experience.I want to implement a stack class.Here is my class:
public class stack {
private static int MAX;
stack(int a)
{
MAX = a;//input max ...
0
votes
1answer
15 views
Exception in @Transactional method abort execution of whole thread?
I am wondering how @Transactional works in Spring Boot application
There is a method that publish system event via ApplicationEventPublisher, and there are two listeners listening to this system event:...
1
vote
2answers
19 views
JPA - check if the user exists in the database by name?
i'm triying user this code
public interface UserRepository extends CrudRepository<Usuario, Long>{
@Query("select p from User p where name = ?1")
public boolean findExistByname(String ...
0
votes
0answers
13 views
Return delayed value from void method
I used the old AdMob code, and because I had multiple places in code from which I called ads, I created a separate method with AdMob code. Now Google is changing things again and I'm implementing new ...
0
votes
0answers
14 views
java.lang.OutOfMemoryError: unable to create new native thread with Netty Client
We are running into below error after 933 threads.
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread....
0
votes
1answer
12 views
I need javac 1.6.0_20 in Ubuntu 20, how can I install that
the apt repository doesn't that this version, how to accomplish this? I have tried
sudo apt-get install openjdk-7-jdk
But this version seems not there
0
votes
0answers
10 views
Why am I Getting Data provider mismatch error in selenium?
*SOURCE CODE-
package tests;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;
import org.testng.annotations....
0
votes
1answer
50 views
I am unsure why my output is always returning false
I am trying to do a Distributive Law in my code but somehow, the output always returns false.
here is my distributiveExample method:
private static void distributiveExample() {
Set setA = ...