Consulter un pdf java

ilhem.s Messages postés 29 Date d'inscription   Statut Membre Dernière intervention   -  
 Utilisateur anonyme -
Bonjour,

Mon problème c'est que je n'arrive pas a ouvrir un fichier pdf

voici le code:
String commande ="C:\\Programmes\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe";
Runtime runtime = Runtime.getRuntime();
Process lAdobeProcess = null;
try{
lAdobeProcess = runtime.exec(commande);
} catch(Exception e){System.out.println(e);}

L'exception c'est:

java.io.IOException: Cannot run program "C:\Programmes\Adobe\Reader": CreateProcess error=2, Le fichier spécifié est introuvable
A voir également:

1 réponse

Utilisateur anonyme
 
Salut,

Exemple:

String nomExec = "C:\\Program Files\\Adobe\\Reader 10.0\\Reader\\AcroRd32.exe"; 
 String nomType = "C:\\Chemin\\Le.pdf"; 
       
 Runtime runtime = Runtime.getRuntime(); 
         try 
         { 
            runtime.exec(new String[] { nomExec, nomType}); 
         }  
            catch(Exception err) 
            { 
               System.out.println("err = " + err); 
            } 


Cordialement,

Dan
0