Possible duplicate:
How to run a standard (native) application for a given file with Java?
I have a Java application that opens a file. This works fine on windows, but not on Mac.
The problem is that I am using the window configuration to open it. The code:
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file);
Now my question is, what is the code to open it on a Mac? Or is there another way to open a PDF file that works on multiple platforms?
EDIT:
I created the file as follows:
File folder = new File("./files");
File[] listOfFiles = folder.listFiles();
in a loop, I add them to the array:
fileArray.add(listOfFiles[i]);
If I try to open a file from this array using Desktop.getDesktop (). open (file), it says that it cannot find this file (the path is corrupted because I used "./files" as a folder)