Can someone please help me how to launch Google Earth application using Java swing? (I mean on click of the GUI button it should open the Google Earth application)
Asked
Active
Viewed 249 times
0
-
1Duplicated: http://stackoverflow.com/questions/1303333/googleearth-inside-java-swing – Tirma Mar 15 '16 at 11:46
-
@Tirma It is not a valid duplicate please compare the answers. – user3438583 Nov 21 '17 at 06:11
1 Answers
0
You could try this
if (Desktop.isDesktopSupported()) {
try {
File myFile = new File("/path/to/file.exe");
Desktop.getDesktop().open(myFile);
} catch (IOException ex) {
// no application registered for PDFs
}
}
Or by Another Way
try{
if ((new File("c:\\your_file.exe")).exists()) {
Process p = Runtime
.getRuntime()
.exec("rundll32 url.dll,FileProtocolHandler c:\\your_file.exe");
p.waitFor();
} else {
System.out.println("File does not exist");
}
} catch (Exception ex) {
ex.printStackTrace();
}

manikant gautam
- 3,521
- 1
- 17
- 27