voila je m´explique, je tente de lancer un fichier .doc avec word, malheureusement word n´a pas l´air de trouver le fichier:
Code :
- public class FileLauncher {
- static public void launch(File f) {
- String path=f.getAbsolutePath();
- String tmp="";
- System.out.println(path);
- StringTokenizer st=new StringTokenizer(path," " );
- tmp=st.nextToken();
- while(st.hasMoreTokens())
- tmp=tmp+"%20"+st.nextToken();
- path=tmp;
- System.out.println(path);
- if (f.getName().endsWith(".html" ) || f.getName().endsWith(".HTML" ))
- try {
- Process proc = Runtime.getRuntime().exec(
- "C:\\Programme\\Internet Explorer\\iexplore.exe " + f.getAbsolutePath());
- } catch (IOException e) {
- e.printStackTrace();
- }
- if (f.getName().endsWith(".doc" ) || f.getName().endsWith(".DOC" ))
- try {
- Process proc = Runtime.getRuntime().exec(
- "C:\\Programme\\Microsoft Office\\Office10\\WINWORD.EXE " + path);
- } catch (IOException e) {
- e.printStackTrace();
- }
- if (f.getName().endsWith(".xls" ) || f.getName().endsWith(".XLS" ))
- try {
- Process proc = Runtime.getRuntime().exec(
- "C:\\Programme\\Microsoft Office\\Office10\\EXCEL.EXE " + path);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
|
avec internet explorer ca passe, mais ni word ni exel
(g tenter a peu pres tout a passer en argument a word(f.getAbsolutePath(),f.getCanonicalPath(),f.getPath()....)