Category "java"

Is there a java/JS library which can compare two json files and produce comparison result as html?

The idea behind the question is to have some library/tool which can compare two json strings and produce comparison result as html. E.g. the way some online com

Gwt/gson in eclipse, error: "Unable to invoke no-args constructor for class"

I'm playing around with this Google Web toolkit/GSON example that gets data from twitter. Everything is compiling just fine, but when I debug as Web Application

Netbeans doesnt recognize class in the same package

i am creating a little game with libgdx framework and netbeans 8. I have all java classes in a single package that match with the directory structure. The probl

How do I map Spring MVC controller to a uri with and without trailing slash?

I have a Spring Controller with several RequestMappings for different URIs. My servlet is "ui". The servlet's base URI only works with a trailing slash. I would

Netbeans doesnt recognize class in the same package

i am creating a little game with libgdx framework and netbeans 8. I have all java classes in a single package that match with the directory structure. The probl

Spring Security with React.js front end on other port

I'm trying to create a spring security authorization for my university project. Unfortunately, I came across a problem, my frontend is on port 3000 and the back

Bad type on operand stack error when using hibernate

I am getting an error when using the hibernate. This is the stack trace:- java.lang.VerifyError: Bad type on operand stack Exception Details: Location: o

Mockito ClassCastException - A mock cannot be cast

I have a method in the class AppleProcessor which I would like to test: public void process(Fruit fruit) { if(fruit.getType() == Fruit.APPLE) { fru

How do I update an entity using spring-data-jpa?

Well the question pretty much says everything. Using JPARepository how do I update an entity? JPARepository has only a save method, which does not tell me if i

How to have placeholder for variable value in Java Text Block?

How can I put a variable into Java Text Block? Like this: """ { "someKey": "someValue", "date": "${LocalDate.now()}", } """

Cucumber cannot find StepDefinitions while running the code but manually using the option "Find Step" can find step definition

In the project Structure defined like below, src/main/java -- Config (RunCukesTest.java) -- StepDefinitions src/test/resources -- features/login When I run fro

How to use java .class file in Visual Studio Code?

I'm currently studying a Java course, and one of the assignments requires me to use (import) a class inside a .class file. I'm currently using Visual Studio Co

How does a byte[] in java actually store data

If I have the following: byte[] byteArray = new byte[] {87, 79, 87, 46, 46, 46}; I know that the size of each element would be one byte. But what I don't see

An instance of OnFlingListener already set in Recyclerview

I'm using a RecyclerView in my Android app. I've many cardviews in my RecyclerView, such that only 1 cardview is displayed to the user at a time. The user has t

How to use java .class file in Visual Studio Code?

I'm currently studying a Java course, and one of the assignments requires me to use (import) a class inside a .class file. I'm currently using Visual Studio Co

Reversing an array using a stack

I am attempting to reverse an array using a stack. However, I get an error on arr[i] = stack.top();, and the suggestion to resolve it in Eclipse is to change it

telephonyManager.listen not working after targetSdkVersion is set to 31 or android 12

After i upgrade the targetSdkVersion to 31 telephonyManager.listen is not working. Consider following line of code: telephonyManager.listen(phoneStateListener,P

No Dialect mapping for JDBC type: 1111

I'm working on a Spring JPA Application, using MySQL as database. I ensured that all spring-jpa libraries, hibernate and mysql-connector-java is loaded. I'm ru

How do I create a Jersey FormDataContentDisposition object?

I have the following method in a service: public interface MyService { @POST @Path("/upload-file") @Consumes(MediaType.MULTIPART_FORM_DATA)

The specified child already has a parent. You must call removeView() on the child's parent first (Android)

I have to switch between two layouts frequently. The error is happening in the layout posted below. When my layout is called the first time, there doesn't occu