Category "java"

Evaluate command line argument as boolean expression

I'm trying to take a string, passed as an argument, and evaluate it as a boolean expression in an if conditional statement. For example, the user invokes MyPro

LdapInvalidDnException: unexpected token:

I am getting the below exception while doing a ldap search and wondering if it is a problem with api or something I need to fix ? 16:41:19,290 ERROR [com.sync

Maven toolchain not getting triggered in build

I'm using the latest maven 3.3.9 which enforces java 8, and trying to compile a project in java 7 using a java 7 maven toolchain. As per: The maven guide I'

import sun.misc.BASE64Encoder results in error compiled in Eclipse

For this two imports; import sun.misc.BASE64Encoder; import sun.misc.BASE64Decoder; I got this error: Access restriction: The type BASE64Decoder is not acce

java.io.IOException: mark/reset not supported

try { //String location = dir1.getCanonicalPath()+"\\app_yamb_test1\\mySound.au"; //displayMessage(location); AudioInputStream audio2 = AudioSystem.

JVM Stack Variables

I understand JVM creates a Stack for each thread and that Stack contains calls to other methods as thread invokes them. I don't understand when it says Stack wi

What is the best way to avoid NoSuchElementException in Selenium?

I have written few test cases in Selenium WebDriver using Java and execute them on grid (hub and multiple nodes). I have noticed that a few test cases fail due

exception sending context initialized event to listener instance of class

I have this class: public class DatabaseHelper { @Autowired static UtilService utilService; public static void fillEmptyTables(){ if(!isSk

Android: how to hide ActionBar on certain activities

I've developed a simple demo application with a splash screen a map and some regular screens. I have an action bar at the top that contains a logo. It all look

exception sending context initialized event to listener instance of class

I have this class: public class DatabaseHelper { @Autowired static UtilService utilService; public static void fillEmptyTables(){ if(!isSk

QR Code in Base64 encoding for KSA E-Invoicing In Java [closed]

How to Create HEXA and BASE 64 QR code for E-Invoicing Saudia Arabia. There is problem converting hexa to base64 but that is not readable in E

ByteArrayOutputStream.toString() generating extra characters

I have the following code: ByteArrayOutputStream baos = new ByteArrayOutputStream(); int size = 4096; byte[] bytes = new byte[size]; while (is.read(bytes, 0,

why I see this when compiling my project in bootstrap? "Found 0 JPA repository interfaces."

I have created a Bootstrap project in which I have 3 repositories. When I compile the project I do not receive any errors but unfortunately I can not see my con

Flyway Found more than one migration with version

I've two sql files , one for oracle and one for mySql database. Path is as follows db/migration/mysql/V1_1_migration.sql db/migration/oracle/V1_1_migration

How to quickly detect and remove log4j classes from our code base and the base image? "mvn dependency:tree" does not check base image

We are building an app based on Red Hat JBoss AMQ 6. We wrap some Java code around the base image to provide extra functionalities which are lacking in AMQ 6. N

How can I add only the new items of the JSON API without duplicating the existed items?

I want to make an auto refreshing system for my android application. I use a JSON API in order to get the posts. Here is what I did: handler.postDelayed( runnab

How to convert from Json to Protobuf?

I'm new to using protobuf, and was wondering if there is a simple way to convert a json stream/string to a protobuf stream/string in Java? For example, protoS

Why does List.of() in Java not return a typed immutable list?

The list returned by the method List.of(E... elements) in java does return an immutable list, but this is not visible at all by looking at the created list. The

Split string into array of character strings

I need to split a String into an array of single character Strings. Eg, splitting "cat" would give the array "c", "a", "t"

Spring JUnit: How to Mock autowired component in autowired component

I've got a Spring component I'd like to test and this component has an autowired attribute which I need to change for the purpose of unit testing. The problem i