I noticed this issue when attempting to load the MANIFEST.MF from the .jar file of my application via class.getResource("/META-INF/MANIFEST.MF")
.
Instead of getting my own manifest, a manifest is seemingly loaded from /usr/share/java/java-atk-wrapper.jar
.
However, this jar is not specified as part of my application's classpath - I tried disabling the java accessibility assistive technologies (here), but this had no effect.
Interestingly, this behavior is specific to OpenJDK-11.0.4. The issue does not occur when using 11.0.3. Can anyone shed some light on what might be happening here? Was there some kind of change to how java-internal jars/classes are loaded/accessed? Or could this simply be a bug introduced in 11.0.4?
Minimal working example:
import java.net.URL;
public class Main {
public static void main(String[] args) {
final URL resource = Main.class.getResource("/META-INF/MANIFEST.MF");
System.out.println(resource.getPath());
}
}
Then run:
$ java --version
openjdk 11.0.4 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-116.04.1)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-116.04.1, mixed mode, sharing)
$ javac Main.java
$ java Main
file:/usr/share/java/java-atk-wrapper.jar!/META-INF/MANIFEST.MF
$ echo $CLASSPATH
$
The expexted behavior of this code snippet would be to throw a NPE, because there is no manifest resource. Instead, the manifest is loaded from the atk-wrapper.
Environment details:
Ubuntu 16.04.5 LTS
OpenJDK was freshly installed via apt
add-apt-repository ppa:openjdk-r/ppa
apt install openjdk-11-jdk
The apk-wrapper was not installed explicitly. I wasn't aware of its existence until this issue occurred on one of our machines - at which point I was able to reproduce it on my local machine as well.