Questions tagged [java]

Java (not to be confused with JavaScript, JScript or JS) is a general-purpose, platform-independent, statically typed, object-oriented programming language designed to be used in conjunction with the Java Virtual Machine (JVM). "Java platform" is the name for a computing system that has installed tools for developing and running Java programs. Use this tag for questions referring to the Java programming language or Java platform tools.

Filter by
Sorted by
Tagged with
-1
votes
0answers
4 views

#java Recursion ( Simple string question in recursion)

I decided to work on my recursion skills in java and it all went nice, until i first faced a question with strings in recursion. i practice by using Coding Bat, some website provides questions for ...
0
votes
0answers
1 view

How can translate audio of video from one language to another?

I have a client requirement of audio of video translation. i.e. from language to another language translation should happen successfully. I am not sure if any API is available to make this requirement ...
-1
votes
0answers
5 views

How to return the ConstraintViolationException messages in the response body?

I am developing a Spring Boot based REST API. I am validating the input entities using custom ConstraintValidator annotations. My problem is that I cannot return the ConstraintViolationException ...
0
votes
0answers
15 views

How to convert number to money

I dont know how to convert the "wish money" that i type to numbers will turn into a money format, you can see in the code down there, it will ask me my wish money and then i will type a number 100000 ...
0
votes
0answers
3 views

Cash register outputs string of denominations in which to give change. Input is purchase price and cash given

I don't know why when iterating through my linkedhashmap to find the smallest possible combination of denominations to give as change in this piece of code, when iterating through "Five pence", the ...
0
votes
1answer
5 views

Switch Bubble Sort from Increasing to decreasing

I need to switch from increasing to decreasing. Here is what I have:` public static void bubbleSort(double[] array) { boolean swapping = true; for (int i = 1; i < array.length ...
0
votes
0answers
6 views

Track Row for the Prepared Statement Sqlite Android

I have created a Prepared statement to get the row where my track_id is present. Since I am a beginner I am having problem understanding how can I get values from the whole row one by one my code is: ...
0
votes
0answers
18 views

My method to check if word is in a string of letters never returns true

I'm trying to make a word wheel solver, and it's working properly in python, but I cannot port it over to Java / Android. It returns nothing, that's to say, the end set of valid words is always empty. ...
0
votes
0answers
6 views

My quarkus runner jar always starts in blocking mode

Whenever I build and run an uberjar created using Quarkus plugins, I get a runner jar which starts off as a server, while my app isn't a server, it's a CLI app. java -jar ./target/MLPMnist-1.0.0-...
0
votes
1answer
20 views

The static variables cant be seen

I have different files for different panels in my code, and i want to add a file for the action listener. i have declared my variables as static so the action listener can see them but it doesnt see ...
0
votes
0answers
8 views

Cannot start process in android 10 api 29

When I target android 10 sdk 29, I cannot use process builder to start a program. I read this is a new restriction in android 10 but wondered if there is any way around this? other than targeting ...
0
votes
0answers
9 views

JSON query doesn't show items even if there is no errors when compiling

I'm at very start of learning android, so now I have an aim to create an app using Youtube API with several functionalities, but one functionality like searching videos and list them on my screen - is ...
0
votes
0answers
6 views

Android Studio: ListView OnClick animation doesn't work if you set background color of items

In my project I've setted the background color of my items (composed of several elements inserted in a ConstraintLayout) inside a ListView but the default animation of click and long click disappears ...
-4
votes
1answer
15 views

By taking a random number (5,20) (inclusive) and print all integers from 0 to n separated by a space by using Loop in java

****strong textGenerate a random integer n between 5 and 20 (inclusive). Use for loop to print all integers from 0 to n separated by a space. To generate a random integer between min and max range: ...
0
votes
1answer
14 views

How to extend a class in Spring Boot without changing the MySQL schema?

For example, I have the User class, with looks like the next: @Entity @Table(name = "users") public class User{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) ...
0
votes
0answers
14 views

JDBC connection NullPointerException

Hi I seem to have a problem finding what is the issue here whenever I try to log in to my app I get the Null Pointer Exception and I have no idea what is causing this Here is my DB Connecction: ...
0
votes
1answer
14 views

Extracting the value in the text file, and convert it to string

So i need to read a text file and convert it to String in order for me to start using shift chipper to chipper my msg. all i found of how to read text file involves a loop, and it in itself only show ...
0
votes
0answers
11 views

JSF selectOneMenu is not being populated

I'm trying to display a new dialog box with a card payment form. It will be displayed (rendered = true) after click on a button. The issue is that the selectOneMenu is not being populated. If I close ...
1
vote
1answer
25 views

RecyclerView Not Showing Items on Second Click

I have a RecyclerView that I am using to display a list that I obtain from making a request to remote api. The list is shown on the first time that the activity appears but when I go back and come ...
0
votes
0answers
37 views

Java replaceAll(“\\s+”, “”) Not replacing spaces

Hopeing someone might know whats going on here. A little background I am doing some simple cleaning of scraped text from a website. Part of it entails removing all the spaces from the text. The ...
0
votes
0answers
9 views

Tomcat 8 application issues

I'm puzzled and need clever suggestions. I have this Java 8 web application developed with Spring Boot which runs on an Apache Tomcat server, have a Postgresql database, and make use of a RabbitMq to ...
0
votes
0answers
24 views

How to stop the early initialization of log4j2?

I am working on a spring-boot (2.1.9.RELEASE) application with JAVA-11 and using the log4j2, version is 2.12.1. I am using custom log4j2 appenders which actually save the logs in DB. Generally, the ...
0
votes
0answers
7 views

Spring Boot 2 Deployed in wildfly 11 getting error as WFLYSRV0003: Could not index class module-info.class

Can anyone help please if faced similar below issue. Scenario: When deploying Spring Boot 2 (Java 8) application as war in Wildlfy 11 getting below WARN error. Though application works fine, still ...
0
votes
0answers
7 views

Vert.x - GraphQL Subscriptions with DataInputStreams

I have (what seems to me) to be an odd scenario that I need help sorting out. I have 3rd party code that I connect to via DataInputStream. The 3rd party code spits out information as it generates it....
0
votes
2answers
19 views

What are the default rules used by checkstyle?

If I don't define a checkstyle config then a couple of checkstyle rules are executed by default, is there a list of default rules used by checkstyle? This is how my maven config looks like: ...
-7
votes
0answers
29 views

Can anyone solve this Search Engine Query problem? Any approach or algorithm would be appreciated [on hold]

You are given a list of search engine queries. The queries are in the form of strings and do not contain any whitespace. When you encounter the string "top "", then output the top n search terms ...
0
votes
0answers
12 views

How to Map a Java Entity to Multiple MongoDB Collections in Spring Boot and use Different Indexing for both Collections?

Say I have a pojo class: public class event { String eventId; String date; String state; } And I want to save my event class in 2 separate collections in MongoDB. I can use mongoTemplate for ...
1
vote
2answers
27 views

Running Java programs in gem5(or any language which is not C)

This may be a silly question, but i'm learning about gem5 recently and i'm being able to simulate my C programs using this software, in syscall emulation and in full system simulation. However, ...
0
votes
0answers
19 views

Java ArrayIndexOutOfBoundsException thrown when writing to an array within bounds [duplicate]

I'm experiencing an index out of bounds error while reading/writing to an array. My code is designed to fetch the source code for quizlet sets and extract terms and definitions. It's not finished, ...
0
votes
0answers
10 views

H2 Client couldn't connect to the server

I am trying to connect to H2 Server started on the same machine using java. I started the H2 server in mixed mode. While connecting to the server I am getting Error. The code to start the server is: ...
0
votes
2answers
36 views

The method “nextLine()” is undefined for the type String

I'm making a program with multiple different methods, one of them being: private static void IsWordPattern(String input) { String pattern = ""; System.out.println("Enter a pattern of letters:...
0
votes
1answer
16 views

What is the best time to set resolution-based lengths?

This question will use Processing 3+ code syntax. Say I have a class Bullet that spawns at a Player's x position at a set height. class Bullet { int x; int y = player.y; int w = SIZE_X / ...
-2
votes
0answers
19 views

MainActivity is overriding or using a deprecated API

when i try to compile my application folder it gives me this error. Mainactivity is using or overriding a deprecated api. i don't know where am i using a deprecated code, i didn't have this problem ...
0
votes
0answers
17 views

Get() method returns the right value the first time while the second time returns null

I am using a hash-map to store key value pairs. When I use the get method to retrieve an Identifier object key called "Ape", it correctly returns the Set object value "1,2,3,4" yet when I try to ...
0
votes
0answers
6 views

Apache CXF STSClient Token Request sending blank SOAPBody

I have this method that should get me back a token, using Apache CXF: private static STSClient getSTSClientToken() throws Exception { Bus bus = BusFactory.newInstance().createBus(); ...
1
vote
1answer
20 views

I need to output data from activity to a fragment

When the application starts, null is displayed I think that I am not correctly assigning a value to the TextView p.s. Sorry for my English class MyFragment : Fragment() { private lateinit var ...
0
votes
0answers
9 views

JavaFX 3D Constant width 3D Line

I'm currently creating a 3D solar system model and need to create trails behind the orbits of the bodies. I have been using Cylinders to create a 3D line, however I would like to produce a line that ...
0
votes
2answers
28 views

What is meaning of class obj =obj1;

I have a class like public class fun{ abc(){//.some code.//} } and in some main method there is code like fun obj = new fun(); fun obj1 = obj; Please help me explain object in main how the ...
0
votes
1answer
23 views

How to pass an array to a type parameter bounded by the Comparable interface

I have an interface: public interface Comparable<T> { public int compareTo(T o); } that bounds a type parameter in the method public static <T extends Comparable<T>> int ...
0
votes
0answers
8 views

Tomcat 9 + SQLExpress does not respect maxActive in context.xml

I created an environment on AWS with 2 Linux / Ubuntu T2 Small servers, one for database and one for Tomcat. I deployed an application that already worked normally in other environments. However in ...
0
votes
0answers
8 views

Lambda was not able to unzip the file

The file worked up until recently when updating a lambda however it started showing the following error: Calling the invoke API action failed with this message: Lambda was not able to unzip the file ...
0
votes
1answer
23 views

object is not an instance of declaring class in JUnit

I want to create JUnit class for this code: @Component public class ReportingProcessor { @EventListener private void collectEnvironmentData() { } } I tried this implement this Junit ...
1
vote
0answers
7 views

How to improve digit recognition of a model trained on MNIST?

I am working on handprinted multi-digit recognition with Java, using OpenCV library for preprocessing and segmentation, and a Keras model trained on MNIST (with an accuracy of 0.98) for recognition. ...
0
votes
0answers
12 views

Custom Annotation injecting property

I have a custom annotation LogExecution, that i want to pass field values from a property file or java constants file (preferable) but for some reason this is not working, any help is appreciated. @...
1
vote
1answer
26 views

How to use concurrentHashMap in executorCompletionService?

I search the database many times,even I have cache some result, it still cost took a long time. List<Map<Long, Node>> aNodeMapList = new ArrayList<>(); Map<String, List<Map&...
-1
votes
0answers
19 views

How to send photos,videos and other files via web sockets (Socket.IO) in Android?

I have tried converting media into 'base64' string then tried to send it. But I think for more long string there will be problem to send that string via web sockets. Kindly share better idea for that.
1
vote
1answer
9 views

Set a variable value within a jar using a gradle task

I have a client and server architecture. The client is a runnable .jar file built using the following Gradle task: jar { archiveName = "app.jar" from sourceSets.main.output.classesDir ...
1
vote
1answer
18 views

Liquibase cannot find changelog file

I have following error with our spring boot 2 application: Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: class path resource [src/main/resources/changelogs/...
-2
votes
1answer
26 views

JAVA How do I write code for a 2D array storing four integers in a 2x2 matrix?

Array Problem 3: 2D array -Ask the user for 4 integers -Store them as a 2x2 matrix -Find the determinant Matrix: input1 input2 input3 input4
3
votes
0answers
20 views

How can i create user with custom attributes

I can create user: User user = new User(); user.accountEnabled = true; user.displayName = "some name"; user.mailNickname = "some-nick"; user.userPrincipalName = "[email protected]"; PasswordProfile ...