New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalAccessError when mocking ProcessBuilder with Java 9 #428

assylias opened this Issue Jul 11, 2017 · 0 comments


2 participants

assylias commented Jul 11, 2017

jmockit 1.33
TestNG 6.9.10
Java 9 (build 177)

This test throws an IllegalAccessError at runtime:

public class MainTest {
  @Test public void test(@Mocked ProcessBuilder pb) throws IOException {
    new Expectations() {{ pb.start(); result = null; }};

  public static Process m() throws IOException {
    return new ProcessBuilder("").start();


java.lang.IllegalAccessError: class java.lang.ProcessBuilder (in module java.base) cannot access class javax.print.PrintException (in module java.desktop) because module java.base does not read module java.desktop

    at java.base/java.lang.ProcessBuilder.start(
    at MainTest$1.<init>(
    at MainTest.test(

Related stackoverflow question:

@rliesenfeld rliesenfeld self-assigned this Jul 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment