Category "java"

Tomcat does not start. Where was I wrong?

I did everything according to the instructions, installed all environment variables, but it still does not start. This is what is output in cmd when I try to st

Set PlaceHolder on JPasswordField

I am developing a system with Java (using NetBeans) and, to make it more "professional", I've added some cool functions, such as Placeholders (Yes, I know, it's

Writing A Recursive Function That Counts Zeros

It is possible to count the number of zeros in an integer through a recursive method that takes a single int parameter and returns the number of zeros the param

X-Ray and async multithreading: segment cannot be found

I need to run multiple async methods from the main thread, which should be able to finish even after the main thread has returned a response. I've added a metho

Checking and deleting attributes in SVG using Batik in Java

The question basically says it all. How can I check if SVG has a viewBox attribute? I am using Batik lib. I need this because I need to (at least) notify the us

NoClassDefFoundError when using KyroNet

When I try to use kyronet (for networking), I get this error. It seems like nothing is wrong in the code, and I exported it right. Here is the log: [TextRPG] S

Not able to set custom color in XSSFCell Apache POI

I am trying to set some custom(from hexcode or rgb value) color to a xssfcell.But the color of the cell is becoming black even though I am giving some other col

NoClassDefFoundError when using KyroNet

When I try to use kyronet (for networking), I get this error. It seems like nothing is wrong in the code, and I exported it right. Here is the log: [TextRPG] S

(Solved)Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException javax.swing.ImageIcon.<init> Resource file does exists

According to this video https://www.youtube.com/watch?v=n_Y7r-7GxDo I need to place the icons in the main package. Even after this, I get the same error packa

How to dynamically add items to a JList?

I'm having trouble adding items to a JList called lstContacts whenever a button is pressed. When I press my new contact button, a line should be added to lstCo

(Solved)Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException javax.swing.ImageIcon.<init> Resource file does exists

According to this video https://www.youtube.com/watch?v=n_Y7r-7GxDo I need to place the icons in the main package. Even after this, I get the same error packa

RAII design pattern in Java

Coming from a C++ background, I am a huge fan of the RAII pattern. I have used it extensively to handle memory management and lock management along with other u

React Native Error: 'Permission Denial: starting Intent"

I managed to add facebook login and google login to my application but I think I might have done something wrong. Before I started adding the logins I previousl

Get Human readable time from nanoseconds

I am trying to implement an ETA feature Using System.nanoTime() startTime = System.nanoTime() Long elapsedTime = System.nanoTime() - startTime; Long allTimeFor

Error: 'else' without 'if'

Getting an else without if statement: import java.util.Scanner; public class LazyDaysCamp { public static void main (String[] args) { int temp

Automation Test executed by Runner works fine, but when execute this by command mvn, it gets error in test that already works fine

I am a QA and created a framework(JAVA) to execute my tests. Everything is going fine running the tests by Runners. All those tests works fine and got the PASSE

JPA Multiple Embedded fields with prefix?

With JPA annoations, I want to reuse same embedded object like this : @Entity public class User { @Embedded public Address homeAddress; @Embedded

Interview: Find the whole cubes between range of two Integers

I just gave a coding interview on codility I was asked the to implement the following, but i was not able to finish it in 20 minutes, now I am here to get idea

Is there any difference, if I init AES cipher, with and without IvParameterSpec

I was wondering, is there any difference, if I init AES cipher, with and without IvParameterSpec? With IvParameterSpec SecretKeySpec skeySpec = new SecretKeyS

Type Mismatch cannot convert from type Optional<User> to User

I am trying to create a website that allows the user to update, edit, delete, etc., and I have got to the part of Updating or Editing user’s information.