Skip to content
Advertisement

Tag: shell

Decrease the number of calls

I have arraylist of filenames (java) and I want to delete these files using rm but it is time consuming can I do batching using xargs or something else which can help to delete files faster. Answer Don’t use rm. Use Java. As others have pointed out, spawning a process is much slower than doing it in your program. Also,

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 ProcessBuilder to launch or one of the overloads of exec. You

Unable to load config data to springboot application from mounted volume in kubernetes

I have springboot application and I am trying to load additional configuration from a volume mounted location /tmp/secret-config.yaml and getting below error: java.lang.IllegalStateException: Unable to load config data from ‘/tmp/secret-config.yaml’ I do not want to use configmap or secrets for this. It’s a simple json file which I am trying to load. I am trying to pass it like this

Return Java system exit value to bash script

I am trying to get the return value from a java program ( System.exit(1);) into a shell script, but it seems like its returning the jvm exit code, which is always 0, if it doesnt crash. For testing purposes, this is the very first line in my main(). Anyone know how to do this? My bash code: Thanks Answer If

Advertisement