title: java.awt.HeadlessException on a Java WebService
body: <p>I try to to open a Browser with a URL if a WebServer is called. The WebServer works fine on a Tomcat7 and I created it with Eclipse. I tested this Code on the Eclipse Server and every thing is ok and a new Browser with the URL is open. </p>
  
  <pre><code>public java.lang.String register(java.lang.String username, java.lang.String password) throws java.rmi.RemoteException {
      try{
          Desktop.getDesktop().browse(new URI("http://google.de"));
      }catch(Exception e){ 
             StringWriter sw = new StringWriter();
             e.printStackTrace(new PrintWriter(sw));
             String exceptionAsString = sw.toString();
             username = exceptionAsString;
      }  
      return "NEW TOKEN:"+password + username;
  }
  </code></pre>
  
  <p>But if I deploy the code as a war-file to the "real" TomcatServer I get this error: (the webservice is ok and i become the return value, but the new Browser is not open)
  The Error is thrown, because the desktop is not supported <code>Desktop.isDesktopSupported() == false</code> on the "real" Server </p>
  
  <pre><code>java.awt.HeadlessException at java.awt.Desktop.getDesktop(Desktop.java:124)
  ....
  </code></pre>
  
  <p>My question is now, why I get this error when everything works fine on the test system and how could I resolve this problem ?</p>