|
33 | 33 | import java.io.IOException;
|
34 | 34 | import java.io.InputStream;
|
35 | 35 | import java.math.BigInteger;
|
| 36 | +import java.net.URL; |
36 | 37 | import java.security.DigestInputStream;
|
37 | 38 | import java.security.MessageDigest;
|
38 | 39 | import java.security.NoSuchAlgorithmException;
|
|
41 | 42 | import java.util.concurrent.Executors;
|
42 | 43 | import java.util.concurrent.ThreadFactory;
|
43 | 44 | import java.util.jar.Attributes;
|
| 45 | +import java.util.jar.JarInputStream; |
44 | 46 | import java.util.jar.Manifest;
|
45 | 47 | import java.util.logging.Logger;
|
46 | 48 |
|
@@ -521,12 +523,12 @@ private static void loadNativeLibrary() {
|
521 | 523 | if (libInputStream != null) {
|
522 | 524 | try {
|
523 | 525 | // Try and load the Jar manifest as a resource stream.
|
524 |
| - InputStream manInputStream = GlobalScreen.class.getResourceAsStream("/META-INF/MANIFEST.MF"); |
525 |
| - if (manInputStream != null) { |
526 |
| - // Try and extract a version string from the Manifest. |
527 |
| - Manifest manifest = new Manifest(manInputStream); |
| 526 | + URL jarFile = GlobalScreen.class.getProtectionDomain().getCodeSource().getLocation(); |
| 527 | + JarInputStream jarInputStream = new JarInputStream(jarFile.openStream()); |
528 | 528 |
|
529 |
| - // FIXME More OS X JRE Bugs! This returns NULL but only for Apple! |
| 529 | + // Try and extract a version string from the Manifest. |
| 530 | + Manifest manifest = jarInputStream.getManifest(); |
| 531 | + if (manifest != null) { |
530 | 532 | Attributes attributes = manifest.getAttributes(basePackage);
|
531 | 533 |
|
532 | 534 | if (attributes != null) {
|
|
0 commit comments