my project will use webp image format, because I am a novice, so I can not find on the Internet can directly use the java library to convert picture format bit webp, but google provides a conversion tool that can be run under linux, so I intend to use the linux command to operate this tool, the question is, how can I call the linux command in my project? I have found some information on the Internet. A lot of information shows that I want to use the Runtime.getRuntime.exec () instruction, but the most I use this instruction is that there is no error in executing "java-version", and nothing else can be executed. For example, executing the instruction "cd / data/web:" to enter a folder directory fails, and the execution of the "mvn-version" instruction is not successful. In view of this situation, I have the following questions:
- how does java effectively execute linux commands?
- how does java know the folder directory where the program executes the command?
- how do I write code for the cwebp program that I want to execute in the "/ data/web/libwebp-linux/bin/" directory on the linux server?
can anyone tell me how to solve this problem? I really appreciate it.