Newest 'java' Questions - Stack Overflow

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
12 views

How to make the button clickable when using overlay

I want the set Button under the overlay to be able to just click only one button. I try setClickable in the overlay layout. Button can't click if not in overlay layout but I want only press Button if ...
-1
votes
0answers
8 views

How to Access other Activities in Fragments? [on hold]

dosto mene apne ek project(firebase phone auth otp) me bottom navigation baar add kiya he, bottom nav bar me 3 fragments add kiye he HOME ACCOUNT & HELP, me apni Login activity ko HOME fragments ...
0
votes
0answers
7 views

How to get data inside a Throwable Scala object?

How I get information inside a Throwable Scala object? The code is an example about throwable.getMessage. JsResultException(errors:List((,List(JsonValidationError(List('eoh' is undefined on object: {...
0
votes
0answers
9 views

How can I rename a file placed in remote location while it is getting streamed

I want to add some temporary suffix to file while I am streaming the file from remote directory. I am streaming the file from remote directory using spring integration dsl and I want to make sure ...
1
vote
0answers
24 views

finalize() method breaks mid-execution?

Question I have a URLClassLoader anonymous class. In it, I've overridden the finalize() method so that the object will automatically close itself when garbage collected: protected void finalize() ...
0
votes
2answers
13 views

Looping Through Futures - Should you check isDone first?

I have a list of futures. List<Future> futures = new ArrayList<Future>(); futures.add(task1()); futures.add(task2()); Is there a difference between these two approaches of getting the ...
0
votes
0answers
11 views

Refresh/Load only newly changed value in cache

I am using Caffeine cache and in cache there are approx 7-8 Lakh records,while refreshing i don't want to refresh the hole cache because its takes 10-11 min to do. So is there any way to only refresh ...
0
votes
1answer
18 views

I dont know 0xAA55 get in byte array (size 2)

I developing TCP Server Program but I stucked this Server's Protocol the header is fixed by 0xAA55, header size is 2 Byte this is the problem I dont know fill in 0xAA55 to byte array byte[] tmp = new ...
-1
votes
0answers
17 views

Regex to extract VIN number from a text field

I'm setting up a KNIME workflow that strips VIN from a description field. I wanted to use Regex to identify VINs. what would be the best regex format to use? I have tried this so far "[\s,][a-zA-z\d]...
0
votes
0answers
9 views

I used singpost for 4shared api, but got unAuthorized and 401 errors

I am trying to make an Android app that downloads mp3 using 4shared api. I used singpost but it got unAuthorized and 401 error. Also some query url is possible but not api url such as download, ...
-4
votes
0answers
12 views

Can P4RTK use Mobile SDK for development, is there anybody succeeded? [on hold]

We want to use Mobile SDK to develop P4RTK app, but we can't connect RTK module with SDK, is there anybody succeeded?
-2
votes
0answers
13 views

I have a problem in calculator code in operators signs [duplicate]

when I input 2 numbers and operators show invalid operator.. ُenter on else statement directly, it must enter on the operators +,-,*,/,%, I want when I enter + operator it sums two numbers import ...
-1
votes
0answers
17 views

Trying to reference JFrame interface

I have created a JFrame interface and need to reference it for my code. I have researched it online, but nothing that comes up to tell me how to wire the jframe to my class Here is the JFrame code:...
-3
votes
0answers
17 views

Adding variables trough inputs [on hold]

I've been working on some coding for a user sign up, but I'm not so sure how to add new users on my code without replacing the original variable... I don't know if I make myself clear
-4
votes
0answers
30 views

How to decrement a value to 0 then increment it by 1 without it decreasing until it reaches a certain value? [on hold]

I have a variable which equals 10 which I want to reduce by 1 then if the variable reaches 0 I want it to increment by 1, but however when it reaches 0 it adds 1 then it minuses again which I don't ...
-2
votes
1answer
41 views

Compiler error with “private List<String> list = new ArrayList<>();” [on hold]

I wrote some simple Java code to practice Vim: public static void main(String[] args) { private List<Integer> list1 = new ArrayList<>(); } And got a compiler error: error: illegal ...
0
votes
1answer
7 views

How to connect to Mqtt3AsyncClient using HiveMq-mqtt library?

I have been trying to implement mqtt using hivemq in my Android app. Though I have used the same specs and configuration from their docs, I am still unable to establish a successful connection. I was ...
0
votes
1answer
8 views

ScrollView doesn't scroll in a ViewPager

In my app I use a TabLayout under a Toolbar, and a ViewPager filling the rest of the space. I need one of the fragments under the tab to be able to scroll. tried using ScrollView, NestedScrollView and ...
0
votes
1answer
11 views

How can I solve this issue with FirebaseAuth? [duplicate]

i want to register a new user using firebaseAuth but i keep getting error i have debugged using invalidate and restart and rebuilt the project, and even clean project yet it won't run successfully ...
-3
votes
0answers
9 views

How to add hyperlink in Surefire report in test case name? [on hold]

How to add a hyperlink in Surefire report to test case name taken from csv file Test case description #5
0
votes
0answers
7 views

How do I turn the system sound on for an alarm, or turn off the system mute. (Android)

I am building an application that requires an alarm, and if the user has muted their device or set it to DND, I want to know how to override it. I am really struggling with clear details on how the ...
1
vote
0answers
19 views

Right way to combine group of collections

I have done some code to combine in parallel group of collections which contains pairs[String,Integer], Example Thread 1 [Car,1][Bear,1][Car,1] Thread 2 [River,1][Car,1][River,1] Result should be ...
0
votes
0answers
4 views

When I use the firebase-storage url, picasso loads images late. I'm pulling pictures from the database. What do you think is the reason for this?

I want slider in my HomeActivity page. My slider using Timer() code. And i use ViewPager. When I put the image links that are not in the database and the links are not created with firebase-storage, ...
0
votes
2answers
15 views

ReactJS values of Const on div

I'm new on react and have a simple application as this: My purpose for this app it's to consume an Spring Boot REST Service and print the data json on my react app. I achieve this following this ...
0
votes
1answer
13 views

Reference to a specific activity

how can I do reference to an specific activitie? I mean, I need the form in which I can execute only certain code if only this code was called by a specific activity, for example: Activity 1: Intent ...
-4
votes
1answer
26 views

Main type is in there but eclipse says it's not [on hold]

I'm studying for a test and I'm currently trying to figure out this problem: In a java source code file Welcome.java, we have the following `public class TryItOut{ public void main(){ ...
1
vote
0answers
15 views

Heroku “could not find or load main class” error

First off, I'm aware there are dozens of duplicates to this question; I've been reading them for days. None of the solutions have worked so far. :( I've written a webapp that runs fine locally, and ...
1
vote
0answers
25 views

Why I got position at 0? When it should be 1

I learn Java, now I'm at ArrayList, I wrote some methods about banking, when I want to add a new customer at a specific branch, the position always return 0. This is the source code of the methods ...
0
votes
0answers
11 views

Java paints button graphics using position 0,0 of parent

I have created a rounded button in java using my own Border class, and it's actually pretty great, but I have an issue, when it is painted, uses the left-top corner of the parent as reference instead ...
0
votes
2answers
13 views

Java Mockito: How to prepare different answers

int calledCnt = 0; doAnswer(i -> { if (calledCnt == 0) { calledCnt += 1; throw new InternalServerErrorException("test"); } return false; }).when(myClass.someFunction(any(...
1
vote
0answers
13 views

How to print javafx inputs from form in console

I have JavaFX form with couple of text fields(id, name, lastname, age, email) and also I have class users with id, name, lastname, age, email, getters and setters, to string etc. What I want: I want ...
0
votes
0answers
9 views

Is there a way to redirect the user to okta for login without using spring boot?

I have a java application running on wildfly server, that uses ejbs and Servlet HttpSecurity. There is no Spring Boot implemented. I am working on a task where access control of the application must ...
0
votes
1answer
27 views

Java ArrayList syntax error outside of main class

I'm trying to make a simple hangman game. The aspect I need help with is declaring the hangman stage, which is an arraylist. After moving this list outside of my main class, I received several syntax ...
0
votes
1answer
9 views

How to fix “looping and candidate voting” error in Java

I'm making a voting system, and want the voting system to loop until the user enters 0 and the candidate that wins will be outputted two classes package javaexamcode; import java.util.Scanner; ...
0
votes
0answers
11 views

Load file as a resource using relative path in Java

I have a piece of code like this: private static String location = MyClass.class.getResource("/someFolder/someProperties.properties").toString(); which returns me the String "file:/Users/blah.../...
2
votes
1answer
25 views

How to get combined effects of whenComplete and thenCompose?

I am trying to come up with a CompletableFuture with the combined effects of whenComplete and thenCompose, specifically: Returns a CompletionStage instead of just a result, similar to thenCompose. ...
0
votes
1answer
9 views

EventsAdapter() in EventsAdapater cannot be applied

i try to make custom listview, then I get errors, and i don't know why. there was an error at this, R.layout.list_events_item,listEvents and the error message is: EventsFragment.java public class ...
0
votes
1answer
9 views

How to see my scenario names in Test Result in Java

In the Test Result section, the class names appear as classMethod. I use the cucumber test library for tests. In the Test Result section, I want to see the "Scenario:" names that I have specified in ...
0
votes
1answer
13 views

How to increase the expiry time of access token?

I have got access token and it expires within 1 hour but i want it to work more than that so i used setExpiresInSeconds() method to set the time and when i retrieve the value using getExpiresInSeconds(...
2
votes
2answers
35 views

Count how many palindromes in a string

I want to find out all possible palindromes that can be possible using substrings from a given string. Example: input = abbcbbd. Possible palindromes are a,b,b,c,b,b,d,bb,bcb, bbcbb,bb Here is the ...
0
votes
0answers
15 views

Losing HttpServletRequest object while dealing with exception in AOP for @Async method

I followed this and created Executor, Callable and ExecutorConfig exactly as described in the answer. Now I started getting HttpServletRequest object in AOP code but the object doesn't contain ...
0
votes
0answers
3 views

Avoiding port number in Liferay's assets URL

I have Apache in front and then tomcat. Problem is am getting assets url(url of javascript and css files) as https://_xxx.com:3100/ when i check in browser console. I want to avoid the port number, ...
-3
votes
0answers
23 views

Does java handler() really has to be a thin wrapper of facade? [on hold]

I'm learning Java. This is the case really confuses me, class1 { handler() { try { // basically 1 line here sth1Facade.doSth(); } catch (e) { .....
0
votes
1answer
20 views

The type CollectionStore<T> must implement the inherited abstract method Iterable<T>.iterator()

I have problem with Eclipse. i set jdk1.8. i imported BouncyCastle source code to my eclipse and got errors like: The type CollectionStore<T> must implement the inherited abstract method ...
2
votes
1answer
22 views

Structuring List data using Java 8 and normalizing it into a map structure

So, I am still new to Java 8 and still struggling to correlate the streams API with traditional iteration and collections. So I have a List of object "UserData" which has 3 properties, the list is ...
-8
votes
1answer
25 views

java code print numbers from 100 descending followed by asterisks ascending [on hold]

I am new in java programming and I face a challenging question of drawing the following pattern in Java: 100* 90** 80*** 70**** 60***** 50****** 40******* 30******** 20********* 10**********
0
votes
0answers
8 views

Cucumber+TestNG+Cucable plugin: How can I pass the appium driver instance that I create in the @beforemethod instance to the page objects?

Here is what I am trying to build: Cucumber based tests with TestNG Executor TestNG Executor so that I can re-run failed tests Cucable plugin - so that the scenarios are split into individual files ...
0
votes
0answers
21 views

How to implement the following desired Hashmap

I want to create 2 level deep nested hashmap to represent the types of books stored at each library and a method that updates the data structure when needed.The first level keys are distinct library ...
0
votes
0answers
12 views

JavaFX Application KeyListener not working

I am working on a simple calculator with some special functions. You insert numbers using a TextField and if you press a button the text gets parsed to an Integer. I want to add a simple KeyListener ...
5
votes
1answer
47 views

Java - Calculate PI - Single vs Multi-Thread

I have no clue why but my single thread code to calculate PI is much faster than multi. I'm using 500 Million points and for multi-thread 16 cores. With single CPU is fine and multi-thread all 16 ...