<p>I have an application which <em>really</em> should be installed, but does work fine when deployed using JNLP.</p>

<p>However, it would seem that some Java functions such as <code>Runtime.exec</code> don't work using the default security options.</p>

<p>I would like to therefore <a href="http://www.joelonsoftware.com/items/2008/07/01.html" rel="nofollow noreferrer">disable</a> UI functionality that relies upon such functions.  </p>

<p>So my question is, <strong>how do I detect at runtime whether certain functions are available or not?</strong></p>

<p>The case study, here of course, is <code>Runtime.exec</code>.</p>

[{'answer_id': 33838, 'author': 'Damien B', 'author_id': 3069, 'author_profile': 'https://Stackoverflow.com/users/3069', 'pm_score': 2, 'selected': True, 'text': '<p>You want to ask to the <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/SecurityManager.html" rel="nofollow noreferrer">SecurityManager</a> if you have Exec right with the checkExec method.</p>\n'}, {'answer_id': 33851, 'author': 'Frank Krueger', 'author_id': 338, 'author_profile': 'https://Stackoverflow.com/users/338', 'pm_score': 1, 'selected': False, 'text': '<p>I have also found that adding the following to the JNLP file:</p>\n\n<pre><code>&lt;security&gt;\n    &lt;all-permissions/&gt;\n&lt;/security&gt;\n</code></pre>\n\n<p>And signing the JAR file allows the app to run with all the permissions needed for <code>Runtime.exec</code>.</p>\n'}, {'answer_id': 33868, 'author': 'John Meagher', 'author_id': 3535, 'author_profile': 'https://Stackoverflow.com/users/3535', 'pm_score': 0, 'selected': False, 'text': "<p>For the specific example of Runtime.exec there is a method on the SecurityManager class checkExec(String cmd) that will throw an exception that can be caught to determine if the necessary command can be executed.  For more information see the javadoc for Runtime.exec and SecurityManager.checkExec.</p>\n\n<p>The more general case requires creating a Permission object representing the task being checked and running SecurityManager's checkPermission method.  </p>\n"}]
['https://Stackoverflow.com/questions/33829', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/338/']