title: Using runtime to open file in its native application. (Windows 7)
body: <h1>Background</h1>
  
  <p>I have an old applet that I want to revive. All functionality works in Windows XP. However, in Windows 7 it doesn't work to open a file in its native application (part of code below). Nothing happens, no error or anything similar. I am using <em>Java version 1.5.0 (J2SE 5.0)</em>, thus <em>Desktop.getDesktop();</em> will not work!</p>
  
  <h1>Code</h1>
  
  <pre><code>public void start(String sFileName, String sDir, ctgraphics gGfx) {
      String command = '"' + sDir + sFileName + '"';
      Runtime myRuntime = Runtime.getRuntime();
      try {
          myRuntime.exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + command);
          gGfx.setStatusText("File opened.");
          gGfx.drawStatusBar(1);
      } catch (IOException e) {
  
          System.out.println("Error " + e.getMessage());
      }
  
  }
  </code></pre>
  
  <h1>Question</h1>
  
  <p>Why doesn't the above code work in Windows 7 and what do I need to do instead to be able to open a file in its native application (considering I am using Java v. 1.5) ?</p>
  
  <p>.</p>
  
  <p>Cheers.</p>