Great practical explanation ,reduced my time and difficulty in understanding
@hilowgroup49963 жыл бұрын
Thanks Ravi. We are glad we could help :)
@JitendraKumar-zs1xq2 жыл бұрын
java.io.IOException: Cannot run program "ls": CreateProcess error=2, The system cannot find the file specified how to solve this
@ankitagupta62322 жыл бұрын
Hi I have a doubt I'm trying to run rsync command with runtime in java. In my A.class file ``` @autowired B bclass; Public void testFileMove() { String srcPath="src/main/resources/tmp/" String destPath="src/main/resources/destTemp" ReflectionUtils.setField(bclass, "tempSrc", srcPath) ; ReflectionUtils.setField(bclass, "tempDest", destPath) ; bclass.execute(); } ``` In my B.class ``` String tempSrc; String tempDest; Public void execute() { String runtimeCmd= "rsync -avR --remove-source-files "+tempSrc+"/ "+tempDest Process process =Runtime.getRunyime.exec(runtimeCmd) ; Int exitCode=process.waitFor() ; Logger.Info(" Exit code is :"+exitCode) ; } ``` I always get **error code as 23** for above code. When i give source and destination path as full path it works well. Eg:tempSrc=/home/usr/desktop/temp tempSrc=/home/usr/desktop/destTemp I need the path to be in resources folder of project so that its not specific to system path. With resources folder it become generic to project resource folder and this helps my build in bamboo as well. I can't find the answer for it
@jospehfotso46264 жыл бұрын
Great content!!! keep up the good job
@hilowgroup49963 жыл бұрын
Thank you
@maheshd35064 жыл бұрын
Where your mentioned linux server details,how it's connecting
@hilowgroup49963 жыл бұрын
Hi Mahesh, This tutorial was done on my local so no need to connect to an external server. But you could use ssh to connect to a linux server and run the same commands via the java code. Hope that helps!
@manojprasad91104 жыл бұрын
Hi Can you please help me to understand why nohup java -jar mainclass is not executing using Javaruntime method ?
@hilowgroup49963 жыл бұрын
Hi Manoj, Sorry, i dont understand the question. can you be more explicit? is this related to the content in the video?
@mukundam94284 жыл бұрын
hi can i store output in a string to split the data based on delimiter
@hilowgroup49963 жыл бұрын
Yes, in line 23, instead of printing it, you can put output in a string and perform any operation (including splitting) allow on Strings on it
@sparrowsamuel84593 жыл бұрын
Good! but how do we do if the script is an interactive script?
@hilowgroup49963 жыл бұрын
Great Question. we will prepare a video tutorial for that as the process is somehow different. Please subscribe so that you will get notify when we post it :)
@geekproductions30093 жыл бұрын
How to run .sh file
@hilowgroup49963 жыл бұрын
check this piece out ProcessBuilder pb = new ProcessBuilder("src/lexparser.sh", "myArg1", "myArg2"); Process p = pb.start(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = null; while ((line = reader.readLine()) != null) { System.out.println(line); } we will do a more explanatory video on it :) Please subscribe to be notify when we post it
@prasannapacifist4 жыл бұрын
Mass
@hilowgroup49963 жыл бұрын
Thank you Prasanna
@cyclingracing13 жыл бұрын
Cool, thanks, how can I execute a jar file with arguments from another directory?