Skip to content

Tag: java

Need to run .jar from console for it to work

I have a java application. I’m using eclipse to write, compile and create a runnable .jar. The program is used to discover OCF devices. It uses UDP and multicast. Multicast code The code works when I start it from eclipse. It also works when I run the .jar from console on Linux. But when I start it with…

Linux time conversion fail

My program will take the current system time in HH:MM:SS and convert it into seconds. The reason i convert it into second is because i want to find out the time that was 90 seconds ago. For example :Current time : 12:30:30Time 90 sec ago : 12:29:00 But i can’t make it to the correct timestamp. Here are …

`spring.config.location` is ignored

Fairly straight forward. I have a configuration file: I run my application as a follows: And logging indicates the setting is visible to the application: 04:28:16.919 [main] WARNING CONFIG- [–spring.config.location=file:///etc/my-application] But my settings are ignored: The following yields the same ou…

Linux top output unrealistic?

I’m having a weird issue with a java process which is consuming a lot of resources on a linux VM. The output of top for the process is the below : So this shows that the process is actually consuming 21G of physical memory ? When checking the process in more detail I can see it was started with -Xmx4G

java.lang.NullPointerException and return code

I’m running some java binary from bash like: run_me.sh but inside application I get java.lang.NullPointerException, howewer return code is 0, but I need some non zero exit code to understand from bash that application failed. What is the proper way to handle such cases? Update: Here is an exxample of &#…