stavo provando ad usare l'exec della classe Runtime.
Ecco ciò che ho fatto:
quando il file ha un nome composto da più parole (per esempio: "Questo è il mio file.pdf" [da notarsi gli spazi nel nome del file]) mi esce una dialog indicandomi che non trova il file.codice:import java.io.*; /** * @author Naruto 92 */ public class RuntimeExec { public static void main(String argv[]) throws IOException { File f=new File(path + nome file); Process p=Runtime.getRuntime().exec("cmd /c start " + f.getAbsolutePath()); } }
Invece se il nome del file è composto da una sola parola va tutto bene (per esempio: "Ciao.pdf").
Da cosa potrebbe essere causato questo problema?

Rispondi quotando
