Help needed with downloader in java
I am working on a downloader in java.
I want it to download a file, and execute it.
This is my code, but I cant get it to work. It does download and save the file, but it doesnt execute it. Can somebody help me?
This is my code:
I would also like to choose the path of where to save the downloaded file.
public class SampleFile
public static void main(String args) throws IOException
java.io.BufferedInputStream in = new java.io.BufferedInputStream(new
java.net.URL("link to file").openStream());
java.io.FileOutputStream fos = new java.io.FileOutputStream("filename");
java.io.BufferedOutputStream bout = new BufferedOutputStream(fos,1024);
byte data = new byte;
File f = new File("filename");
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
Is this possible?
Thanks in advance!