How to run linux command by java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to run linux command by java

Hello everyone, I want to make an app that can extract the linux command that need to be executed from the html to java. I am a newbie just getting started, I donโ€™t know anything about java, I want to ask a lot, if I write as I am now Whether the program can be successfully executed, and if it is successfully executed, can the Linux command be successfully issued in the Android phone? I want to make an html page linked to java and made linux command to installing youtube-dl , at the begin I want to read the whole project on github but it's too much information for me เฒฅโ€ฟเฒฅ https://www.sololearn.com/post/259229/?ref=app https://www.sololearn.com/post/259230/?ref=app https://www.sololearn.com/post/259228/?ref=app

5th Mar 2020, 9:23 PM
้ซ˜ไบŽ้ˆž
้ซ˜ไบŽ้ˆž - avatar
5 Answers
+ 3
้ซ˜ไบŽ้ˆž Is there a reason you need the Java app to call a linux command? Based on what you are describing, you should be able to do what you need in Java directly. Here is a link with code that might help you see how to approach this. https://stackoverflow.com/questions/4032766/how-to-download-videos-from-youtube-on-java
6th Mar 2020, 5:52 AM
David Carroll
David Carroll - avatar
+ 2
Bartas Dausynas Yes, of course, I want to make a Youtube downloader without making it๐Ÿ˜‚ Is it possible๐Ÿ˜‚
5th Mar 2020, 10:10 PM
้ซ˜ไบŽ้ˆž
้ซ˜ไบŽ้ˆž - avatar
+ 2
Bartas Dausynas Not fishy things, just download youtube videos
5th Mar 2020, 10:13 PM
้ซ˜ไบŽ้ˆž
้ซ˜ไบŽ้ˆž - avatar
+ 2
Bartas Dausynas So if it's a server side program it can access terminal? Actually if I could I'd like to access youtube servers to download videos๐Ÿ˜‚๐Ÿ˜‚
5th Mar 2020, 10:26 PM
้ซ˜ไบŽ้ˆž
้ซ˜ไบŽ้ˆž - avatar
0
I've had use cases for this at work, except I'm using C# with .NET Core. Not sure if this applies to Java as well, but try searching "execute scp command with Java". Here's my use case: Admin using a very restrictive desktop app with ssh connection to server needs to run a serverside script. For your use case however, it sounds like you only need to run a small script on the command line, or build out a small app in Java to do what you need. I dont think you need both.
12th Mar 2020, 10:56 AM
Mike
Mike - avatar