Category "java"

CodingBat - Java - Warmup-2 - "stringYak" algorithm

I'm presently trying to understand a particular algorithm at the CodingBat platform. Here's the problem presented by CodingBat: *Suppose the string "yak" is unl

DataInputStream stuck when initialized

I have been trying to send a byte[] array across my client / server application using Sockets, DataInputStream and DataOutputStream, but on the server side, the

Get Elements of a webpage in a webview

I'm trying to get the Elements of a webpage in a webview. These are actually values of an odometer. I'm using sketchware. I've tried getting the class values wi

Is using @Nonnull (javax) on entities with Hibernate a bad idea?

We are using Hibernate in our Spring Boot application. Whenever we can, we use @javax.annotation.Nonnull and @javax.annotation.Nullable annotations to help us a

Avoid using deprecated API for UtteranceProgressListener

I am using android.speech.tts.TextToSpeech and would like to have an UtteranceProgressListener that does not override the deprecated onError but rather uses the

OpenAPI throws Could not resolve reference: Could not resolve pointer: for @ExampleObject files

I am developing a Quarkus service-based application for which I am adding open API based annotations such as @ExampleObject. For this, I would like to add the r

Four values to be non zero and non negative

Suppose I have four variables x, y, z, w. I want to print: "hello all non zero values" only if all x, y, z, w are non-negative and non-zero values. If all the

Java JDK 18 in IntelliJ prints question mark "?" when I tried to print unicode like "\u1699"

tldr: I downgraded to JDK 17 (17.0.2) and now it works... I was watching a beginners Java tutorial by Kody Simpson on YT (youtube.com/watch?v=t9LP9Nt9Nco), and

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