I have a for loop and I want to add strings to a string array inside that loop. How can I achieve that? The output should look like this- Answer You can create the result array with a size that matches the registration array length, since you know you want to create one result for each registration entry. You…
How is the best way to extract a section from word document with Apache poi?
I´m using Apache poi (XWPF) with Springboot in java 11. I need to extract the section number 2 (title and content) from a word document with the follow numerated list: word_example I would like to know what is the best way to get only section 2 and its content to create a new word document with only that part…
HiveMQ Java library fails to automatically reconnect to broker
I’m using the HiveMQ library in my Java Spring application to connect to a Mosquitto instance as I find it more user-friendly compared to the Paho client. But something is going wrong with the automatic reconnection. From time to time the connection is lost and the application doesn’t succeed in r…
Inherited objects outputs as null
I have Employee as my main class (used to get the name and call other methods). I created two inheritance class called FullTimeEmployee and PartTimeEmployee. The program is working except the getName() in my subclasses. The name the I input works in the main class but shows up as null in the subclasses. It al…
Direct Buffer Memory error when connecting mqtt
we are running an Apache Beam Apllication on a Flink Cluster. Since a few days the application fails with the following error: The connection is build up with the following method: But it runs on my machine When I start the application from my eclipse project all works fine. So the error only happen in the Fl…
Java Android String Intent displaying null when moving to previous screen
So I have a screen where a user enters their name, on button click they are redirected to a menu where it displays their name. In the menu screen I have a button that takes me to another screen (About Me), on that screen I have a button with an Intent to go back to the Menu Activity. The issue
Server doesn’t forward message to all in the chat
i am trying to create a simple chat app using java sockets, the server is threaded, when a client connects its socket is added to an ArrayList, so that i can send to all in that list. the problem is when 3 clients are connected, the for loop that sends doesn’t work properly, for ex : client 0 sends to
failed to convert java.lang.String to com.fasterxml.jackson.databind.MapperFeature
application.properties how can i resolve this error please help !! Answer You appear to have a typo in the name of the Jackson mapper property: It should be “inclusion”, not “inclusions”:
Why am I getting IOException : “Cannot run program ./shellScript.sh error = 2, No such file or directory in Java?
The following Main.java code simply tries to simulate the following linux command: The program below works only if the executable Main.jar sits within /dir1/dir2, not outside of /dir1/dir2. How do I modify the program below so that Main.jar can sit anywhere on the file system? Answer You should use ProcessBui…
How to cast an object of an ArrayList of objects (of type superclass) to an object of type subclass
If I have a superclass, let’s call it Car, with the constructor parameters String name, String color, double wheelSize, and a subclass of this, let’s call it Truck, with the constructor parameters String name, String color, double wheelSize, and double truckBedArea, and in the subclass (Truck), I …