I have a JAR that is available for download from an HTTP URL, say, http://somerepo.example.org/myjar-1.0.jar
.
I need a cURL command that will download it to the current directory; my best attempt thus far is:
curl -i -H "Accept: application/zip" -H "Content-Type: application/zip" -X GET http://somerepo.example.org/myjar-1.0.jar
When I run this my console fills with binary spam and seems to cause my entire terminal to have a melt down.
What is the correct cURL command to GET a JAR from a remote URL?
The syntax for the curl command is as follows: curl [options] [URL...] In its simplest form, when invoked without any option, curl displays the specified resource to the standard output. The command will print the source code of the example.com homepage in your terminal window.
Create a batch file to execute java -jar hellofile. jar from remote cmd. Now run the batch file from your local machine by PSEXEC \othermachine z:\program.exe. You will need administrator privileges on the target machine.
Grab file with curl run: $ curl https://your-domain/file.pdf. Get file using ftp or sftp protocol: $ curl ftp://ftp-your-domain-name/file.tar.gz. You can set the output file name while downloading file with the curl, execute: $ curl -o file. pdf https://your-domain-name/long-file-name.pdf.
You are almost there. By default cURL will output the download to STDOUT. You want to redirect this to a file like so:
curl -H "Accept: application/zip" http://somerepo.example.org/myjar-1.0.jar > myfile.jar
You can also use the -o
option:
curl -H "Accept: application/zip" http://somerepo.example.org/myjar-1.0.jar -o myfile.jar
You should also be able to use wget
wget http://somerepo.example.org/myjar-1.0.jar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With