Search code examples
javagwtmavengxt

GWT's class similar to AWT Desktop?


Here is a little snippet of what I need to do:

if (Desktop.isDesktopSupported())
{
    final Desktop desktop = Desktop.getDesktop();
    try{
    desktop.open(new File(path));
    }
    catch (final IOException e)
    {
     MessageBox.alert("Log View", "Error finding file", null);
    }
}

I need to open a file in the logged in users default desktop application for that file type. Maven is giving me issues on build saying it can't find java.io.File and java.awt.Desktop.

Kind of a 2 part question, first, does GWT have some sort of similar functionality to java.awt.Desktop and how do I fix the project so maven finds the io and awt files?


Solution

  • To get the same effect as a JButton calling Desktop in HTML, you would provide an HTML button that links to a download of the file and ensure it has the correct content-type provided by the server.