Category "java"

How can I make stream with fixed arguments along with varargs? [duplicate]

Let's say we have the following method. void some(int id, int... otherIds) { } How can I create a single IntStream with those two arguments?

S3 programmatic access via Java

I'd need to create out of my Java program a private S3 bucket and an IAM user that is allowed to access that bucket only. So I'd have some admin account creden

Cannot deserialize value of type `java.lang.String` from Array value from mockmvc

public class ModelDTO implements Serializable { private Long id; private String datasetName; @JsonRawValue private String json; } Post API i

Alternative to loading class dynamically in Java

I have the following method: private static Class<?> classForName(final String classNameToIgnore) { try { return TypeAnyHelper.class.getClassL

Java : Are sub threads lock the main thread?

I am new to Java, I have want to starts 02 thread to increase an attribute of an object and I want to print out the value of this attribute until it reach a cer

Match multiline text using regular expression

I am trying to match a multi line text using java. When I use the Pattern class with the Pattern.MULTILINE modifier, I am able to match, but I am not able to do

Running test with testcontainers as part of a Dockerfile

My dockerfile looks something like this: FROM maven:3-jdk-11-slim COPY pom.xml . COPY src src RUN mvn clean install That means that part of the build is the

IntelliJ IDEA breakpoints do not hit in dynamically loaded anonymous inner class

This is not your usual "my breakpoints don't work" question. Consider the following code: Runnable runnable = new Runnable() { @Override public void run()

binary.startprofile is not working. startprofile is not present in selenium-jar file.I even tried old versions still not working

I am writing code in java with selenium- In my code binary.startprofile is not working. it is saying startprofile is not present in selenium-jar file. I even tr

Add User provided Environment variables on cloud foundry for VCAP_SERVICE

I need to change the ecs-bucket in VCAP_SERIVCE environment variable with new bucket name and secrete key. However, when I add VCAP_SERVICE variable, cloud foun

How to execute class method in a Java program? [closed]

In this code, we have to add a method set() which will take two parameters, an int index, and an Integer value, which will set the array eleme

could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet with oauth

I am doing a rest service with java spring boot. The tables are created correctly in the database and locally test everything works correctly, but when I mount

java.lang.module.ResolutionException: Modules persistence.api and java.persistence export package javax.persistence.spi to module sqlite.dialect

I'm trying to build my first jpa hibernate projekt, but unfortunally i come across this error here: Error occurred during initialization of boot layer java.lang

Connect to Wildfly Elytron's Credential Store with Masked Password

I have a credential store that I created with Elytron's tool giving a clear text password: "mypassword". In my Java program I can connect to the store with the

Airplane seating program (2 dimensional array)

I have an airplane seating program but I don't know how to get it to print the number of seats still available and how to get it to quit when I enter q. Any he

Add custom labels to default spring boot actuator metrics

I'm currently working on a Spring boot (webflux) project where we have exposed metrics of our application on /actuator/prometheus endpoint using spring boot act

Java/Kotlin Interoperability Limitations

I recently faced a problem regarding interoperability between Java/Kotlin for suspend functions. See my question: How to Override a suspend function in java cla

java.security.AccessControlException: Access denied ("java.net.URLPermission" "https://example.com" "*:*")

I'm trying to use Java to talk to the ibm connections API through urlConnection with the following code String url = "https://example.com"; URL myUrl = new URL

Why Premature EOF Error has occur, while reading CSV file using SpringBoot Scheduled Task

Below shows the relevant code segments. Is it related to connection close or Buffer memory.? (The file, which contains 50MB+ AND 65000+ Text Lines) @Scheduled(c

Apache poi excel writer works in ide but not in fat jar? java.io.IOException: Your InputStream was neither an OLE2 stream, nor an OOXML str

The code works perfectly fine in IDE but not in normal .jar or in fat .jar? The program works perfectly fine otherwise. Also non-fat .jar doesn't work either. T