Comment retrouver le chemin d'un application installé sous windows
Hello,
Mon problème: j'aimerais ouvrir un fichier pdf avec acrobat reader sous windows.
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
Runtime r = Runtime.getRuntime() ;
try
{
r.exec("C:\\Program Files\\Adobe\\Acrobat 7.0\\Reader\\AcroRd32.exe " + filePath;
}
catch (IOException ex)
{
ex.printStackTrace() ;
}
} |
avec ce code ça fonctionne très bien.
Le problème: si l'application acrobat reader est installer sur un autre emplacement ce code retourne une erreur.
Ma question: comment (d'abord) retrouver le chemin d'installation d'acrobat reader sous windows?
ou
Comment retrouver le chemin d'une application associée avec un extension?
Exemple: pdf -> C:\\Program Files\\Adobe\\Acrobat 7.0\\Reader\\AcroRd32.exe
Merci pour votre aide:
MRP
Comment retrouver le chemin d'un application installé sous windows
Bonjour à vous tous,
Pour l'instant j'ai trouvé une solution comme suit:
Code:
1 2 3 4 5 6 7 8 9 10
|
try
{
runtime.exec(new String[] { "cmd.exe", "/C", "filepath" });
}
catch (IOException ex)
{
ex.printStackTrace() ;
} |
et ça fonction très bien :yaisse2:
sauf que si j'execute le même code sur Linux :evilred: