Questions tagged [java]

Java (not to be confused with JavaScript or JScript or JS) is a general-purpose, 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.

0
votes
0answers
5 views

serialize java objet to json string which has Map object, key is string and value is abstract class

i'm trying to serialize java object which has Map, using objectmapper. Below is the code which i'm trying.. public abstract class DataTypeModel { DataType type; String description; ...
0
votes
0answers
5 views

How can I execute a tark at regular intervals, but in a way so an step can't start until the last one has finished

I have an agent-based model that I need to update every t milliseconds. In each update step, all the agent objects need to be notified and execute some code. I want every step to last t or until the ...
1
vote
1answer
10 views

What is the best way to encrypt a seed?

I've been struggling with a simple problem for hours now. I am working on a desktop application (a wallet) which needs a seed phrase to operate. Naturally, the seed needs to be encrypted with a ...
0
votes
0answers
6 views

javax.net.ssl.SSLException: SSL peer shut down incorrectly

Since a few days we have been experiencing this error in our application, we already use TSLv1.2 protocol to communicate. This error is random it doesn't fail all the times it fails sometimes. We use ...
0
votes
3answers
21 views

not sure why i am getting an error for my instance

i created two classes one called PassCar and the other called Motor i'm trying to create an instance for Motor in PassCar but it is not working. for my project i have to create a Motor instance for ...
0
votes
0answers
5 views

How to use Java RMI with Dynamic Class Loading through HTTP Server?

i'm trying to implement a basic distributed application using the Java RMI framework. Implementing it locally, I can do it, but when I want to manage dynamic class loading remotely, by loading the ...
0
votes
1answer
17 views

How to loop string in decrement order?

Write a program that takes a string input from the user and then outputs the first character, then the first two, then the first three, etc until it prints the entire word. After going down to one ...
0
votes
0answers
7 views

Params for login not posting via REST using Volley

I'm trying to get my Demo Login Android Application to login via REST on my server with a login.php app which queries the local MySQL Database on the server. When I run the REST Query from Insomnia, ...
0
votes
0answers
10 views

Java - Getting ArrayIndexOutOfBoundsException from using Stream on a File Path [duplicate]

Am trying to parse the /etc/group file on a macOS Mojave 10.14.3 operating system using Java 1.8's stream feature. The first five lines inside my /etc/group file are as follows: nobody:*:-2: nogroup:...
0
votes
1answer
6 views

How to make the probability of a element being selected twice lower?

This code selects a random number from 1-27 and assigns that number to a index. Random A = new Random(); int picture = A.nextInt(27); driver.findElement(By.xpath("//android.widget.RelativeLayout[@...
0
votes
0answers
7 views

Why upgrade to connector/j 8?

The oracle documentation pushes hard for platforms to upgrade to version 8 of connector/j. However, I have been unable to find any documentation with a compelling reason (eg performance over 5.1, ...
0
votes
0answers
13 views

What was the purpose of the Java Virtual Machine to run java on architectures when porting the JVM was necessary anyway?

I'm trying to analyze the nature of porting and virtual machines, with the intent of minimalizing the amount of porting. Looking back into the history of things, one thing stands out in my mind, ...
0
votes
0answers
12 views

How can I properly and permanently hide the status and navigation bars on Android?

I'm building an app for Android (6.0, but I can change it if necessary), and having trouble getting the status and navigation bars to hide properly. I've followed every online suggestion I can find, ...
0
votes
1answer
19 views

How to fix 'java.sql.SQLSyntaxErrorException' error when I insert data in MySQL? [duplicate]

Im using preparedStatement, and i have java.sql.SQLSyntaxErrorException error query ="INSERT INTO instdb (" + "id," + "name," + "username," + "descr," + "tel," + "vk," +...
0
votes
0answers
12 views

How to auto scroll a ScrollPane so that a node will be aligned at the top of the pane

In my program, I have a ScrollPane which its content is a VBox with a lot of child nodes. Some of the nodes are links which you can click and it should jump to the link's destination (imagine clicking ...
0
votes
0answers
8 views

Is there any way to update android app using phpmyadmin server?

Is it possible for an android application to check and update itself from phpmyadmin server?
0
votes
1answer
16 views

How to make a thread that is getting a simultaneous requests by other threads and it needs to flush them out one by one

So, I am using a midi controller to move the mouse for controlling a program purposes. My problem right now is that I hit the mouse with multiple instances of robot class (maybe a very bad idea) for ...
2
votes
2answers
22 views

how a variable declaration works inside a case in switch statement [duplicate]

I'm having trouble understanding how the switch statement works. The following code works even the value of a is 4. I understand that each case inside a switch statement is not a block with its own ...
0
votes
0answers
13 views

LayoutParams overwrite themselves

I'm developing a little game and I need to give different ImageViews different LayoutParams. Therefore I created an array ConstraintLayoutParams. After changing the properties of the layoutparams ...
0
votes
0answers
14 views

Why is my onActivityResult() always returning false?

Im trying to set up google sign in for my app but it keeps failing, i click on a button, get a popup, select account and a Toast pops up telling me that sign in failed. Any ways i can fix this? The ...
0
votes
0answers
8 views

Spring long-polling with DeferredResult thread safety, concurrency

I am trying to implement this long-polling app before getting into web sockets. I am using Cache and DeferredResult for the requests.I am creating one cache with the user id key and the defferedResult ...
0
votes
1answer
32 views

Java 8 Completable Future - parallel execution

I'm testing how CompletableFuture works. I am interested in how to execute tasks in parallel: try { CompletableFuture one = CompletableFuture.runAsync(() -> { throw new ...
0
votes
0answers
11 views

How to get FileManager class and MenuRandomize class to output full description

I'm creating a FileManager class that is creating arraylists in order to hold inputed information from text files using @@ between the data and to output the full line of data in the text. My problem ...
0
votes
0answers
14 views

Searching a maptree of arrayLists

I have a treemap of arrayLists. I need to check each list for matching elements. My code works, except it's only checking the arrays against ones <= itself. The other arrays track fine. I'd ...
0
votes
0answers
8 views

Modifying SOAP request content type in Java

Is there a way to modify the content type of an incoming SOAP request ? I am trying to change my content type from text/xml to application/soap+xml. My Filter Class public class SOAPFilter ...
0
votes
2answers
29 views

Reversing a linked list using recursive method

I am having trouble resolving this code problem. I need to reverse a linked list using recursive method in Java. I can't seem to figure it out and I have tried to the extent of my knowlege. I would ...
0
votes
3answers
26 views

Print grid of chess board in java?

I'm trying to print a chess board grid but it's only printing the A file, then just prints out 7 more blank lines. Here's my code: public class Board { public static void main(String[] args) ...
0
votes
0answers
8 views

Is there a way to checkout git repository, to certain folder with maven?

I am attempting to automatize download of repository containing only protocol-buffers (with structure), to "resource" folder for later processing. I need this kind of functionality, to keep my *....
0
votes
0answers
14 views

How to fix the Exception org.postgresql.util.PSQLException: ResultSet not positioned properly, perhaps you need to call next

I am creating a program that creates and stores users into a database I have not tried really anything because I do not really know how to fix this problem String input = ""; System.out.print("...
0
votes
0answers
9 views

How to create a touch event in a fragment for add/delete nodes(with grathstream)?

I'm creating an application that creates graphs (nodes and edges), I wanted to implement a touch method to create the node, but I'm having difficulty, because when I touch the canvas to add the node ...
0
votes
1answer
14 views

What is a listener and how implement it on a JavaFX TextField?

I was browsing here on StackOverflow a solution to a problem: essentially I want the TextField to limit user input to just numeric values/ integers. I have found an answer that mentions a listener: ...
0
votes
0answers
6 views

How to handle BigQuery insert errors in dataflow pipelines using Java?

I'm parsing a XML and write to Bigquery using dataflow pipeline. How can the errors be handled if the insert fails in BigQuery? I want to write a custom code to write the failed xml to error bucket.
-1
votes
1answer
19 views

How to replace expression by String in JavaParser AST

Suppose I have expression "(a == b || a == c) && (d == e)". How can I replace subexpression by custom String e.g. how can I replace a == b by a.equals(b)?
-1
votes
0answers
9 views

In a multimodule spring boot maven project, How to refer properties defined in application.properties, in a submodule or jar?

I have a Spring boot project with three modules, web,service and common. Dependency is like Web <- Service <- Common. Now i wan to refer my application.properties from Web into Service and ...
0
votes
0answers
13 views

Unable to post nested json data in spring boot with rest api with @RestResource

I get 400 code when i test api call, i added @RestResource and still have the same issue: JSON parse error: Cannot construct instance of com.....UserEntry (although at least one Creator exists): ...
-3
votes
1answer
19 views

Trying to Parse /etc/passwd Using Java 8 with Streams

Am trying to parse the /etc/passwd file on a macOS Mojave 10.14.3 operating system using Java 1.8's stream feature. The first five lines inside my /etc/passwd file are as follows: nobody:*:-2:-2:...
-4
votes
0answers
23 views

Java: Setters and Getters not replacing variable values of other objects [on hold]

Problem package studentclient; public class StudentClient { public static void main(String[] args) { Student s1 = new Student("John","111-22-3333",3.5); Student s2 = new ...
0
votes
1answer
13 views

Programmatically draw vector drawable / SVG on to screen

I'm trying to programmatically draw an SVG on to the screen. The code below is what I've tried, when I run the program nothing shows up. public MainView(Context context) { hexagon = ...
0
votes
0answers
11 views

Not all bytes were read from the S3ObjectInputStream, aborting HTTP connection WARNING

I am trying to read a very big file (almost 1 GB) from S3. However the getobject fails to read the file with the error WARNING: Not all bytes were read from the S3ObjectInputStream, aborting HTTP ...
0
votes
0answers
9 views

Is it possible to use the JSONObject put method and keep capitalized parameter name?

I am using the JSONObject 'put' method to add an entry to the JSON body of an HTTP request. The value that I am passing to the 'put' method contains of other objects and some of those objects have ...
0
votes
1answer
24 views

How to delete and add an element from an array based of the user input in JAVA?

String[] courseNames=new String[numbOfCourses]; Double[] courseCredits=new Double[numbOfCourses]; String[] gradeLetters= new String[numbOfCourses]; I asked the user to enter some course names,...
0
votes
0answers
13 views

AutocompleteSupportFragment.setPlaceFields crushes App on start

First,i'd like to say that i'm new in this "Programming world", but I've been struggling with autocompleteFragment by google Places, i'm trying to implement autocompleteFragment in my app, but after ...
0
votes
1answer
13 views

Android Studio is not recognizing Keystore alias while generating signed apk

I am getting this error everytime I tried to generate my signed apk through Android Studio: No key with alias 'Operator_keystore' found in keystore PATH/OrderOperator_keystore Previously I ...
-1
votes
0answers
23 views

How can methods alter object array?

I am very new to java, and OOP in general. I have created a class Card which stores a integer value and a string. Then, in another class called Deck, I want to create an array of type Card. I have ...
0
votes
0answers
15 views

How can I generate both Android and pure Java libraries from a single code base?

I am working with a codebase that is Java bindings for a native library. From this single codebase I would like to generate: jars for several Android ABIs jars for x86 on Windows, Mac and a Linux ...
1
vote
2answers
29 views

How to find a path from one vertex to another in a tree using breadth first search?

I am trying to implement a BFS that returns a path from a to b in form of a list of vertices. I am implementing this BFS on a tree so I know it will be the shortest path if I can find one. However, so ...
0
votes
0answers
12 views

Can an ApplicationEventPublisherAware bean be registered programmatically?

I'm trying to register an ApplicationEventPublisherAware bean programmatically. I've found plenty of references to do this with xml, @Autowire, and @Configuration, but I'm looking for something a ...
0
votes
1answer
24 views

I'm trying to use a variable when setting image resource in android studio

public void showRideInfo(int id){ String ride ="ride" + id; image.setImageResource(R.drawable.ride); } I am trying to set an image to the result of what is passed into the method. So the ...
0
votes
3answers
32 views

How to print keys with duplicate values in a hashmap?

I have a hashmap with some keys pointing to same values. I want to find all the values that are equal and print the corresponding keys. This is the current code that I have: Map<String, ...
0
votes
0answers
17 views

PreUpdate called but child collection entity not stored

I have a Spring project that uses lombok and a JPA annotated class defined this way: @EqualsAndHashCode @AllArgsConstructor @NoArgsConstructor @Data @Entity(name ="workflow_step") @Inheritance(...

http://mssss.yulina-kosm.ru