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

Why there is only one thread can actually started in @PostConstruct method?

@Component class Type { @PostConstruct private void postConstructor() { Runnable threadAlpha = () -> { while (true) { workWithSomething(); ...
0
votes
1answer
9 views

How to reduce stock in android studio with Firebase

I'm making a sales application. I want to make a function if the product is sold then the product stock will decrease according to the quantity of products sold, by the way when the button is pressed ...
1
vote
0answers
6 views

Manage CompletionStage inside of Netty handler

How do I best handle exceptions when calling a service that returns a CompletionStage from inside a Netty handler. The way I see it there are two types of exceptions that need to be handled: ...
0
votes
0answers
7 views

Android App Doesn’t Connect To Internet on Android 4.4

I am trying to make my app compatible with lower versions of android specifically android 4.4 . The app works fine on android version 5 and above but on android 4.4 it seems to not get any data from ...
0
votes
0answers
9 views

How to fit button squared border to image rounded border

Hi I've tried to make rounded button with round photo inside but border is still a square which made button clickable outside of a image There is my css code #button{ -fx-background-color: ...
0
votes
0answers
6 views

Url Problem while Developing on Localhost and deploy on Remote Virtual Server

I have developed an WebApplication which runs on a Tomcat on my Notebook on Localhost. Now i have the task to deploy the Application to a remote Virtual Server. I coded all the redirects via JSF and a ...
0
votes
1answer
17 views

How to identify the missing type id in jackson error

I am using jackson to write json to a text file, the json represents 2 class inherited from an abstract class but the error also occurs irrespective of wheter both or either/or classes are used. The ...
1
vote
0answers
23 views

android data binding error: cannot find symbol

I am trying to use Recycler and swipeRefreshLayout in my Main Activity but it just cannot find RecyclerView. This is my activity_main.xml <?xml version="1.0" encoding="utf-8"?> <layout ...
-1
votes
1answer
15 views

Errors In image uploading Code at Android platform

I have develop code on android to upload the image, but facing some errors in code. I search out solutions on internet but could not successful to fix the problems? The following code I have used: ...
-3
votes
2answers
27 views

I have a main method, however I'm getting a Static Error: This class does not have a static void main method accepting String[] [on hold]

This is my code. It compiles but will not run and this pops up: "Static Error: This class does not have a static void main method accepting String[]".What is the issue and how can I fix it? Thanks ...
0
votes
0answers
20 views

Spring Boot application with a jar dependency does not run after maven build

I am writing a spring boot application and it needs to fetch records from a ibm notes database. For that I have to use a jar library which is not available as a maven dependency. So I placed the jar ...
0
votes
2answers
30 views

FindViewByID not working in fragment even after getting the view by inflater

I want to get the reference to the textview and change its text when the fragment is created I have tried to get view by inflater in onCreateView method. but I guess it is returning null. ...
0
votes
1answer
10 views

JavaFX displaying scalable vector graphics?

I want to include sth like a logo or a header/banner into my window. I possibly want to avoid using png/jpg Images, because this could look weird when my application runs on high res displays. So i ...
0
votes
1answer
21 views

Spring Data JPA query , filter ? search engine ? JPQL?

I have problem with writing query in JPA repository because i have method who is searching for fathers basing on his name , surname etc. @Query("select * from father where # ???") List<Father> ...
-5
votes
0answers
18 views

Acoustic Echo Cancellation functions [on hold]

My problem is I can not understand the input of process function in this file. https://github.com/russellb/androvoip/blob/master/src/com/mexuar/corraleta/audio/javasound/AEC.java. I wish you will ...
0
votes
0answers
8 views

Xamarin.Android Binding an AAR generated from Go - how to handle tuple returns?

I try to create a Xamarin.Android-Bindings Project for the following AAR: https://jcenter.bintray.com/io/storj/libuplink-android/0.6/ It basically works. But the problem is that the included Java ...
0
votes
2answers
43 views

Why LiveData returns null in ViewModel?

My LiveData<> return null when i try to get value from it? MainActivity ** Here is my error: //Attempt to invoke virtual method 'java.util.List com.xllnc.mvvmexample.entity.ApiResponse....
0
votes
0answers
7 views

How to deploy Spring Cloud Gateway application to local VM on windows?

I am writing multiple microservices and now I am setting up api-gateway using spring cloud gateway framework and netflix eureka discovery client. Since I am using spring boot gateway project I am able ...
0
votes
0answers
9 views

selenium xpath query to find element

trying to send keys like - public static WebElement LogIn(WebDriver driver) { //driver.findElement(By.cssSelector("body")).click(); WebElement element_enter = driver....
-5
votes
1answer
34 views

what this line of code mean…new URLClassLoader(new URL[0],getClass().getClassLoader());

Does above code checks to see if we ( seem to ) have enough permissions to run this code. // quick check to see if we (seem to) have enough permissions to run. try { JVM jvm = ...
0
votes
0answers
23 views

How to set Marks in a method?

So this is my first day trying to learn how to do a bit of coding. My overall program is to be able to get user data which contains their results for 2 subjects with 3 assignments in each. Below is ...
0
votes
1answer
15 views

Plugin [id: 'org.springframework.boot', version: '2.1.7.RELEASE'] was not found in any of the following sources

I have recently started with gradle and trying to run a spring boot application with gradle in my mac machine. When I am trying to do local build, I am getting below error: My build.gradle is the ...
0
votes
0answers
11 views

How to send values (copies,colorType,PageSize) for printout of the page, to a connected bluetooth printer?

I am choosing an image from the gallery and I've used two algorithms to connect to a printer, android developers algorithm and a long algorithm that i found by searching on google and solutions to ...
0
votes
1answer
26 views

How can I modify request in spring mvc filter or interceptor

There exists two common parameters data1 and data2 in my request, and I need decrypt them to 10 parameters, and use them in my controllers. I tried replace the HttpServletRequest param to My Custom ...
0
votes
1answer
42 views

Why do need to use new Random() instead of just Random Randomnum? [duplicate]

I'm currently doing the mooc java course and I'm not able to understand why exactly we need to include new Random() part after declaring a new new variable randomVar with the class type Random? ...
0
votes
0answers
13 views

I want to access zk components from the java file

What is a good way to access zul component in java file? Suppose our zul file contains:- <zk> <window> <div> <label id="lblName"> </label> </div> <...
0
votes
1answer
20 views

How do I cast FieldValue.serverTimestamp() to Kotlin/Java Date Class

I want to save the date that a post was created in Firestore but I do not want to use the System time. Rather I want to use the server timestamp for accuracy sake. So I am using FieldValue....
0
votes
0answers
14 views

OffsetDateTime problem in postgresql and spring boot

i want to save date & time & time zone of user when he signup. i have a 'signup_date' column in account table that its type in java is 'OffsetDateTime' and in liquibase is 'Datetime' and in ...
-1
votes
1answer
30 views

How to fix “BufferedReader cannot be resolved to a type” error in java? [on hold]

I am getting these 2 errors. How can I fix them? "BufferedReader cannot be resolved to a type" "FieldNotFoundException cannot be resolved to a type" Here is my code. import java.io.*; public ...
0
votes
2answers
25 views

Creating 2 dimesional array with user input and find sum of specific columns

Please assist with my code. There must be 3 rows and 4 columns in the array. The user must be able to enter doubles for the first 2 columns. Then I should be able to calculate the sum of each column ...
0
votes
0answers
12 views

No Advertising ID Provider available in androidX

i want to get Advertising ID for my app, which i have no success. import androidx.ads.identifier.AdvertisingIdClient; import androidx.ads.identifier.AdvertisingIdInfo; public class addUtilsJava ...
0
votes
0answers
27 views

Java Matcher.group(int) shows previous match values

I wish to match complex numbers entered by a user in any of the following forms: 2+3i 2.2+3.4i 2 3i The above input contains four complex numbers separated by spaces. When the user inputs the ...
1
vote
2answers
38 views

Convert list of Objects to map of properties

I have a Section class with some attributes as below class Section{ private String name; private String code; // respective getters and setters. } Now I have a list of Section Objects and I want to ...
0
votes
0answers
9 views

measure requests per second with micrometer, spring boot and prometheus

I'm updating a microservice to spring boot 2 and migrating metrics from dropwizard to micrometer. We are using prometheus to store metrics and grafana to display them. I want to measure requests per ...
1
vote
1answer
18 views

How to run a Java application using swing-library in a linux shell without a desktop environment?

Currently, I have a example Java application for testing. It uses the java swing library. I try running it with the xserver in a linux shell, so I'm not using a desktop environment. Usually, you can ...
0
votes
1answer
14 views

How to save digital signature into db using php file in Android Studio

I have created app that need user to sign in form. In code below,the sign was only save into gallery.My problem is I do not know how to save into db mysql.I do not know how to call the signature in ...
-1
votes
1answer
40 views

Why this method affecting the the array? [on hold]

On executing 'show' method after using the 'change' method the values of array 'i' also change, why it is happening? public class test_public_array { int i[] = new int[5]; void change() { ...
0
votes
1answer
11 views

How to set the tablayout icon size for tablets

How to set the tab icon size for tablets I did a lot of research, tried a lot of methods, but couldn't adapt it to my layout. The phone screens are normal but the "7" "10" icon sizes on the tablet ...
0
votes
0answers
16 views

How to find DATEDIFF HQL?

I need to select from H2 DB employees, able to get salary (employee able to if after prev salary date passed 30 days. I tried to use HQL NamedQuery like this (but HQL don't have DATEDIFF function.): ...
0
votes
1answer
19 views

How to represent an undirected weighted graph in java

I'm doing some study about graphs, as it's not exactly my field of study, I'm really struggling to represent an undirected weighted graph, but I think I'm following the wrong idea, follow some code: ...
0
votes
0answers
15 views

String resource is not formatted as expected for the dialog message

Error: String resource is not formatted as expected for the dialog message Hello, I used the following formatted string resource, but unfortunately can't get the text and the variables formatted in ...
0
votes
3answers
26 views

how to remove the slashes from json key while converting object into string

I'm trying to convert JSON object into string by doing the below JSONObject object = new JSONObject(); object.put("video", data); array1.add( object.toString().replace("\\\\","...
0
votes
1answer
17 views

Return values as array from collection

We have a collection of scrips : { "_id" : ObjectId("xxxxxxx"), "scrip" : "3647" } { "_id" : ObjectId("yyyyyy"), "scrip" : "5647" } ... We are simply attempting to return the scrip ...
0
votes
0answers
15 views

Will netty automatically flush writed data?

Recently I was writing a http server and I transplanted some netty components to my project. When I read the source code of netty's ChannelHandlerContext, I found that actually it doesn't flush into ...
0
votes
1answer
33 views

Shorter encoding than Base64

I have this String that is encoded into Base64 String: { "appId": "70cce8adb93c4c968a7b1483f2edf5c1", "apiKey": "a65d8f147fa741b0a6d7fc43e18363c9", "entityType": "Todo", "entityId": "2-0", "...
1
vote
1answer
41 views

ImageView hides the round corners of the parent

I have a CardView as parent and inside the CardView I have a ConstraintLayout and defined a border for the ConstraintLayout. But the problem is that the border disappears when it reaches the ...
0
votes
1answer
25 views

Is there a way to find setter method by its getter method or vice versa in a class?

Sometimes related getter and setter methods are not near or under each other in massive classes and finding a setter using its corresponding getter method isn't handy. I know I can select the rest of ...
0
votes
0answers
25 views

Remove parent node if it has single leaf node

Remove parent node if it has single leaf node public List<Node> removeParent(List<Node>); class Node { boolean isLeaf; String data; List <Node> childrens; } Please ...
0
votes
1answer
13 views

How to set Chrome Options when using WebDriverManager?

I'm using Web driver manager to setup chrome driver. When setting up the driver I want to add some chrome options? How can I do it when using web driver manager? I checked the WebDriverManager API ...
1
vote
3answers
38 views

Get aggregated list of properties from list of Objects(Java 8)

I have a class Division which is having a list of Section as property as below class Division { private List<Section> sections; // respective getters and setters } Let's say I have a ...