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

Converting Shell Script to Dockerfile

I have Java app and want to generate docker image, I have shell script like this: And I try to convert it into Dockerfile like this It can be generated, but there’s an error when I try to run it like this: I’ve also changed this script RUN for rJarFile in `ls ${APPLICATION_DIR}/lib/*.jar`; do export into this RUN for rJarFile

Sha256 checksum difference between Java vs Linux

Am writing a application which calculate the checksum of file before sending it to downstream. At downstream application, linux shell script are used to process the files. It is noticed that checksum calculated from Java application doesn’t matches that calculated using Linux command ‘sha256sum’. Below is code snippet in JAVA: Using java api i get checksum value as : but

Command is Not Interpreting in Java [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question I have this block; And when I execute it, nothing happens. It sometimes

How to execute shell command using SFTP channel in JSch?

I am trying to list all *.xml files in the directory. I do a cd first and then was trying to execute: But not sure how exactly to do it. There were some example around the Exec channel but is there a way to do the find with SFTP itself? Answer Your requirements are conflicting. You cannot execute shell commands

Advertisement