80 }
81
82 /*
83 * Returns true if the given JAR file has the Class-Path attribute in the
84 * main section of the JAR manifest. Throws RuntimeException if the given
85 * path is not a JAR file or some other error occurs.
86 */
87 public static boolean isClassPathAttributePresent(String path) {
88 try {
89 Manifest man = (new JarFile(path)).getManifest();
90 if (man != null) {
91 if (man.getMainAttributes().getValue(Attributes.Name.CLASS_PATH) != null) {
92 return true;
93 }
94 }
95 return false;
96 } catch (IOException ioe) {
97 throw new RuntimeException(ioe.getMessage());
98 }
99 }
100
101 /*
102 * Return the temporary directory that the VM uses for the attach
103 * and perf data files.
104 *
105 * It is important that this directory is well-known and the
106 * same for all VM instances. It cannot be affected by configuration
107 * variables such as java.io.tmpdir.
108 */
109 public static native String getVMTemporaryDirectory();
110 }
|
80 }
81
82 /*
83 * Returns true if the given JAR file has the Class-Path attribute in the
84 * main section of the JAR manifest. Throws RuntimeException if the given
85 * path is not a JAR file or some other error occurs.
86 */
87 public static boolean isClassPathAttributePresent(String path) {
88 try {
89 Manifest man = (new JarFile(path)).getManifest();
90 if (man != null) {
91 if (man.getMainAttributes().getValue(Attributes.Name.CLASS_PATH) != null) {
92 return true;
93 }
94 }
95 return false;
96 } catch (IOException ioe) {
97 throw new RuntimeException(ioe.getMessage());
98 }
99 }
100 }
|