1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| package pack2;
import java.io.File;
import java.io.FileInputStream;
import java.net.URL;
import java.net.URLConnection;
import java.net.*;
import java.io.*;
public class lirefichier {
public static void main(String[] args) {
try{
String urlname ="partage//Binder1.pdf";
URL monurl = new URL("http://GL-0C154B12F829/" + urlname);
URLConnection connection = monurl.openConnection();
connection.connect();
System.out.println("ok");
File f = new File ( urlname);
int taille = (int)f.length();
FileInputStream f_in = new FileInputStream(f);
byte [] bloc = new byte[taille];
f_in.read(bloc);
Runtime r = Runtime.getRuntime();
Process p = r.exec("C:\\Program Files\\Adobe\\Acrobat 7.0\\Reader\\AcroRd32.exe " + f );
}catch(Exception e){
e.printStackTrace();
}
}
} |