{"id":4732,"date":"2014-03-30T15:00:57","date_gmt":"2014-03-30T15:00:57","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-choose-a-program-to-run-collection-of-common-programming-errors\/"},"modified":"2014-03-30T15:00:57","modified_gmt":"2014-03-30T15:00:57","slug":"how-to-choose-a-program-to-run-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-to-choose-a-program-to-run-collection-of-common-programming-errors\/","title":{"rendered":"How to choose a program to run?-Collection of common programming errors"},"content":{"rendered":"<p>I have this code:<\/p>\n<pre><code>import javax.swing.JOptionPane;\n\nclass OpenProgram {\n\n    public static void main(String[] args) throws Exception {\n\n        \/\/ opens the JOptionPane\n        String path = JOptionPane\n                .showInputDialog(\"Type the path to a program or other file(forward slashes)\");\n\n        \/\/runs the program\n        Process run = Runtime.getRuntime().exec(\"\\\"\" + path);\n        System.out.println(\"Program Opened!\");\n        run.waitFor();\n    }\n}\n<\/code><\/pre>\n<p>It is supposed to bring up a JOptionPane and have the user type in the path to a program, then run the specified program, but when I test it and press OK on the JOptionPane, it says it couldn&#8217;t run it. Any help?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have this code: import javax.swing.JOptionPane; class OpenProgram { public static void main(String[] args) throws Exception { \/\/ opens the JOptionPane String path = JOptionPane .showInputDialog(&#8220;Type the path to a program or other file(forward slashes)&#8221;); \/\/runs the program Process run = Runtime.getRuntime().exec(&#8220;\\&#8221;&#8221; + path); System.out.println(&#8220;Program Opened!&#8221;); run.waitFor(); } } It is supposed to bring up [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4732","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4732","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4732"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4732\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}