Skip to content

Instantly share code, notes, and snippets.

@mhuckaby
Created October 18, 2013 20:35
Show Gist options
  • Save mhuckaby/7047871 to your computer and use it in GitHub Desktop.
Save mhuckaby/7047871 to your computer and use it in GitHub Desktop.
temp file and default browser java code
public class Gist {
public static void main(String[] args) throws Exception {
final String tmpPath = System.getProperty("java.io.tmpdir");
System.out.println(tmpPath);
final java.io.File dir = new java.io.File(tmpPath);
java.io.File.createTempFile("pre", "suf", dir);
final java.net.URI uri = new java.net.URI("http://www.google.com");
java.awt.Desktop.getDesktop().browse(uri);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment