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
0
votes
0answers
5 views

how to use location Manager correctly in android studio API level 28

hey so I'm trying to make an app that will show you how fast you are going but there is something that is preventing me from making it work correctly public class MainActivity extends ...
-1
votes
0answers
8 views

Can't retrieve id of last branch in firebase

I am trying to retrieve the id from the last branch of the table order in my firebase. Ass you can see in my screenshot, the results of my logd for orderId is key=(something) and the value is null. I ...
0
votes
0answers
7 views

session not working in webView in android

I'm new to android developing. I just create an android app for my website using android webview. when i open my website from mobile browser first time it ask login details and once i logged in and ...
0
votes
0answers
19 views

How do I create a unbalanced binary search tree

import java.util.ArrayList; public class UnbalancedTree { public TreeNode ArrayToBST(int[] C) { if(C.length==0) return null; else return ArrayToBST(C, 0, C.length-1); ...
0
votes
0answers
10 views

Introduction to Object-Oriented Programming 5th edition Chapter 13 Level 1 Exercise 4 [duplicate]

Write a program that creates an ArrayList of pets. An item in the list is either a Dog or a Cat. For each pet, enter its name and type (‘c’ for cat and ‘d’ for dog). Stop the input when the string ...
0
votes
2answers
21 views

Why the non-final instance variable of the outer class can be accessed and updated in the anonymous inner class?

In all the articles, it is said that java is copy-by-value and the inner class cannot access and modify the instance variables of the outer class. But it can be done now, why? My jdk is 1.8. public ...
0
votes
1answer
14 views

What is the best way to validate a List of JsonNodes (based on some criteria) against a Map of values?

I have a Map that holds a name and an ID for an object. From my service, I am getting a List where each JsonNode contains a name, and should contain an id. I want to use the Map (which is ...
0
votes
0answers
6 views

In Hadoop, what happens if the mapper or reducer cleanup method fails

Referring to this method: https://hadoop.apache.org/docs/r2.8.5/api/org/apache/hadoop/mapreduce/Mapper.html#cleanup(org.apache.hadoop.mapreduce.Mapper.Context) If the mapper/reducer cleanup method ...
-4
votes
0answers
35 views

HW 10, Arrays, Java [closed]

This a homework problem and I could get answers from the lab but Im trying gain a concise understanding of how arrays actually work and Im hoping i can get that here. My professor has given me ...
0
votes
0answers
11 views

Jenkins unable to find input files

I am running my cucumber project on Jenkins. My project reads file from the project directory. Locally my code is able to read the file, but when I am executing my project on Jenkins, then I am ...
0
votes
0answers
9 views

Getting cryptic “org.apache.openjpa.persistence.PersistenceException: null” exception when using entity manager with OpenJPA in embedded TomEE 8.0

I was trying to write tests for a Java Enterprise web application developed using the Apache TomEE Maven plugin. The application works just fine and everything seems to be functioning correctly. I ...
-3
votes
0answers
16 views

how can I add and read multiple objects to an Arraylist [closed]

I create the arraylist in the superclass , then I have a test class in wich I create instances and call a function to add the instances created and show them in order.When I print the arraylist , it ...
-1
votes
1answer
25 views

How does List.add(index,element) work internally in Java?

As mentioned in Java API Doc and this post, the list.add(index,element) results in the given element being added at the given index. In the process, the subsequent list items are shifted by one ...
0
votes
0answers
10 views

3 Coloring a given graph to a boolean expression in a Mini-Sat format

I'm working on a project where I have to read a file representing a graph. I made the input file looks like this: b c a c d a b b So each line signifies a node. For eg, the first line is ...
0
votes
0answers
10 views

Can I avoid retrolambdas capturing the reference to the enclosing class?

I implemented history by letting my forms to implement reconstructor, which is a lambda-returning method. It can be as simple as @Override protected Supplier<MpxForm> reconstructor() { ...
-3
votes
0answers
11 views

How to get data from recyclerview?

I have recyclerView for notes. Notes have Title and Subtitle. How can i read data from each item? I need to get the value from each element from recyclerView and stuff them into variables / List ...
0
votes
0answers
14 views

Why are the entries showing up as one in ListView?

I am working on a personal lending inventory and for my ListView it keeps showing up as one entry. It is reading from a file. It seems not to be reading it as multiple lines. Here is the relevant code:...
0
votes
1answer
13 views

“No Suitable Driver” error for basic java derby DB read

I am getting the following error from a basic java derby DB program using netbeans. I have tried downloading many types of driver containing jar files and then changing the "Class.forName(_______);" ...
0
votes
1answer
14 views

MVVM architecture in android Using Volley

I'm studying the MVVM to see if it can help me for my upcoming projects. What I understand so far, is that I need to use a ViewModel for holding my UI datas. I also need to use a Repository class to ...
0
votes
0answers
10 views

problem searching sqlite db android, cursor returns , runs two times but no result in table layout

I am trying to do an app in android studio. The user can give his first and last name, age. Id is autoincerement. The data that the user is submitting are being inserted in the databse ! When the user ...
-2
votes
0answers
19 views

How to make circles in circle with java? [closed]

I want to make a circle with java this is the image what i want to do. The variable n is the number of vertix. This have n=4 vertix: And if i want to put n=5, that is would be:
0
votes
0answers
9 views

akka eventbus - message guarantees - publish to bus guarantee

I have looked everywhere, cant really get an information that I can base a concrete opinion on this. Akka eventbus is only a "local facility"(to the jvm/node within cluster), and from what I have ...
0
votes
1answer
16 views

How to direct another page in JSP?

<jsp:setProperty name="firstBean" property="sifre" /><br/> <c:choose> <c:when test="${firstBean.sifreKntrl()}"> Hosgeldin! </c:when> <c:...
2
votes
0answers
41 views

How to weight other factors when using Dijkstra

I'm solving this problem where we have a graph, and are trying to get from node 1 to node N. The edge weights are the "cost" and each edge also has a "flow" value. For any path from node 1 to node N, ...
0
votes
0answers
9 views

How can I fix the error on this file appconfig-data.xml?

Referenced file contains errors (project-aware://registration-login-spring-xml-maven-jsp-mssql/org/springframework/beans/factory/xml/ spring-tool-4.2.xsd). For more information, right click on the ...
0
votes
1answer
16 views

Is there an alternative to setting the 'derby.system.home' system property?

So I'm using derby for a patient management learning project. I'm using the following code to set the system property for derby's database write location.. Path path = Paths.get(System.getProperty("...
-1
votes
0answers
10 views

Duplicate Issue After Updating to AndroidX

Added firebase to app, and upgraded to AndroidX, and once i did that this appeared: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:...
0
votes
0answers
24 views

Java - Scanner class “NoSuchElementException” problem [duplicate]

I am currently in the process of writing a program and I keep encountering this error regarding the "Scanner" class. I've been trying to fix this problem but I don't know how to. Its something to do ...
-1
votes
0answers
13 views

why doesn't my banner appear in ConstrainLayout?

i am learning android screen design.I had a similar problem before.I was using LinearLayout.now i'm using ConstrainLayout.I actually have two problems.first, my banner does not appear.I couldn't find ...
0
votes
0answers
23 views

Text File not being sorted in Java

So I'm trying to create a leaderboard, where you enter a name into a TextField and it adds it to the list. I can successfully display the list onto the TextArea, but it wont sort it? It sorts it when ...
-1
votes
0answers
11 views

issue when building android P from source (hidden API exec) [closed]

Well, I am reporting here since the official google groups page is inactive, I get this error message every time when building (below). (Before i was getting other errors but they were solved ...
-3
votes
0answers
15 views

NullPointerException in try-with-resources statement - Java [duplicate]

I used LWJGL to make a 3D game, but this line thrown a NullPointerException: try (BufferedReader reader = new BufferedReader(new InputStreamReader(Class.class.getResourceAsStream(path)))) { Here is ...
0
votes
1answer
18 views

I am working on making a magic 8 ball in JGrasp using java for my class. how do I get my code to run? I do not know what my error is or how to fix it?

this is my code import java.util.*; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.scene.layout.StackPane; import javafx.stage.Stage; ...
-1
votes
0answers
18 views

JAVA Append data in JSON File [duplicate]

I would like to add a new element in a Json file like : [ {"id":1,"name":"Josh","score":["100","150","50"]}, {"id":2,"name":"Sarah","score":["150","200","200"]}, {"id":3,"name":"Thomas","...
0
votes
1answer
25 views

Spark adding extra space when record contain a “comma”

My input is a "|" (pipe) separator file. I can't change the input file. The format is HEADER_A|HEADER_B|HEADER_C A|B|C A D|B| => records without comma generates output like "A D|B|" A,D|B| =>...
-1
votes
0answers
12 views

Questions with syntax in queries? JDBC [duplicate]

I am writing a program in java that will use a mySQL database to support it. When I run it I get a syntax error near the '?' char and i don't know why. Here is my code: String sql = "SELECT ...
2
votes
1answer
21 views

Group items in a List and sum all other fields Android, Show the result in recyclerview

I have a Firebase database which has this structure { "foo" : { "data" : { "2019-12-01" : [ { "item1" : 8, "item2" : 16, "name" : "user1" }, { "item1"...
0
votes
0answers
8 views

How to resume download file using PRDownloader in android?

i have a recycler view and i want to control of downloading using buttons in my card view. i use PRDownloader library but i have issue i can't resume download after finish the app and open it again it ...
-1
votes
1answer
39 views

How to regroup a list of HashMap using Stream [duplicate]

I have a list of HashMap like this List<Map<String,Integer>> and i want to regroup it by the key of HashMap to something like this Map<String, List<Integer>> using Stream ...
0
votes
0answers
15 views

How to get libraries for OrdImage

I am trying to upload multimedia files into my Oracle DB. But I am unable to import oracle.ord.im libraries to get OrdImage class. I found out that oracle.ord.im is included in ordim.jar, but I am ...
-1
votes
1answer
21 views

Servlet Exception - servlet.init() (UnsupportedClassVersion) [duplicate]

I've been having this problem for days now. I deploy my server using tomcat7, try to acess it and it gives me a Status 500 - Internal Server Error. https://justpaste.it/3xw20 It has nothing to do ...
-1
votes
0answers
16 views

Call again after KEYCODE_BACK, onActivityResult no called again

I have read a lot,But nothing worked at recyclerView adapter,I want to startActivity ,and i want onActivityResult at new Activity When I first started , my new Activity can called onActivityResult, ...
0
votes
1answer
20 views

Query params for Java API call using HTTPURLConnection

I am trying to set up a query params for an API call. I need to call an API and get results for a specific time. I was able to get it done in python where I use a dictionary to specify key value pair ...
0
votes
0answers
14 views

Connect To Docker Compose MongoDb Via Spring boot application

Hi I'm New To Docker and Docker-Compose My web app cant connect to the MongoDB container Here are my application properties spring.data.mongodb.uri=mongodb://mongo:27017 spring.data.mongodb.host=...
0
votes
0answers
7 views

Trying to merge pdfs using iText7 merger, but when I open final merged pdf it says failed to load pdf document

I'm creating two ByteArrayOutputStream using itext7 PdfWriter, and then merging them in one pdf using merger but when I try to open final merged pdf it says failed to load. @GetMapping(value = "/...
0
votes
0answers
13 views

SNS message attribute not being parsed correctly

I send an SNS message from AWS console with the following message attributes: Type: String Name: is_data Value: false The SNS is received by an SQS and it gets parsed in a Lambda function. The SQS ...
0
votes
0answers
8 views

How to pass OAuth Client Credentials to a WebClient dynamically with Spring Security 5?

I'm developing a generic web client wrapper which should send requests to a OAuth2 protected resource. My idea was to implement a ClientWrapper which holds a WebClient. The ClientWrapper offers ...
-1
votes
0answers
8 views

Drawables in an external server

The problem that I'm facing is that my project contains a lot of drawables that take a lot of place, so I would like to know how to stock them else where, how to call them in the XML file and how to ...
0
votes
0answers
24 views

What is the difference between UniRest and Spring RestTemplate giving an http 400 Bad Request?

What is the difference with UniRest and Spring RestTemplate which is giving back a 400 Bad Request with apparently the same header and body sent ? I try to reach the HubSpot API to create a Blog post,...
-1
votes
0answers
37 views

When I put this sentence in java, from mysql, the “cn” part is underlined in red, why? PreparedStatement pps = cn.prepareStatement [closed]

Look everywhere and I find no answer, I leave my code. private void jbActualizarActionPerformed(java.awt.event.ActionEvent evt) { PreparedStatement ...