Category "java"

Get multiple times current time on single Button

I have a button showing text START when I click on it I shows me current time in textview.(I consider this time as start time). Than convert the text on Button

Finding Error in android studio java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT

I am new to Android studio. I am trying to connect to brother label printer QL-820NMB with the new Android APK (SDK 31) with android version 12 and the device

Increasing array size

I just started learning java and I'm having a problem in increasing an array's size with a new length provided by the user. If the user's input is greater than

JWT - Find private key by using the KID in key-store in Java

Good day. Is there a call in a Java that can use a KID from a JWT header that will find the correct private key in the key-store? I know how to do it, using the

What is causing connection reset in my tcp server?

This error can happen at anytime but the error message is not showing where it happens during runtime, Error message TCPServerhandler with the closing part TCPS

Java | Attempting to delete files on a Windows machine results in "phantom files"

I'm trying to delete some files on a windows machine using apache commons-io's FileUtils.deleteDirectory method (The version of the commons library is 2.4). Sai

How to detect the exception instance type in jsp

How to get confirm the exceptions types in jsp. I have printed Exception using ex.printStackTrace(response.getWriter()) method, but it is not professional way t

Why am I getting whitespaces in StringBuilder in Java?

I wrote a method that returns a rotated StringBuilder with a given key. However, although it is working fine, it's adding white spaces within the StringBuilder.

Tomcat 10 on Mac not Recognizing servlet-api.jar when compiling servlet

I'm working on creating a Servlet for a tomcat webpage and the Servlet will not compile. I'm using the servlet-api.jar & mysql-connector.8.0.28.jar for the

Undefined Step definitions in Cucumber Java

I added the login steps in Login class. But when I run the scenario from the Login.feature file I still get undefined steps error. Login class package stepDefin

How do I position Eclipse type hierarchy while editing

Eclipse for Windows 64-bit machine - Version: 2022-03 (4.23.0). I am used to having the Type Hierarchy (?) in a tab on the right side of my screen. It was like

How to all elements based on property that dont exist on another list

I have two SETs fooSet and barSet of different objects foo and bar with properties: Class Foo { String name, Integer age } Class Bar { String name } I want t

Validating interim calls formed in Mono

I have a class that returns a Mono type collection, something like this and I want to add a test that verifies the interim calls that mono goes through in chain

How to tag a lambda in build.gradle file AWS Java sdk

I have a lambda function that is written in nodejs (using AWS nodejs SDK) and we are using gradle (build.gradle) to package and deploy that to AWS. Deployment i

Swing can't be found

I have this version of Java installed on a Linux Mint 20.3 Una : java 17.0.1 2021-10-19 LTS Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39) Java HotSp

Why println is being executed in this recursive piece of code?

In this code arrLength starts with four and then keeps being decremented until it reaches zero. At the moment it reaches zero it should not execute what is insi

Iterate and modify a JSONObject

I have a json blob as below: { "name": "ABC", "type": "School", "state": { "events" : [ { "event": "Session

Java REST api PATCH request

I have to modify java based old project(servlet , Gradle project) which was not integrated with any of Java framework. For a recent project integration requirem

Detect a key press in console

I want to execute a certain function when a user presses a key. This will be run in the console, and the code is in Java. How do I do this? I have almost zero k

Checking for Whether Both Expression Strings Contain the Variable

I had made a fully functioning method that would grab a variable string like x or var for the equation as so: // Equation Variable Getter public String getV