summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.jni/init.java
blob: 3303d319e746fbb214e2bc85838717ad032a6df9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Regression test for JNI and static initializers.

public class init
{
  public static class NativeClass
  {
    static
    {
      System.out.println("static initializer 2");
      System.loadLibrary("init"); // if it's here, this app doesn't work
    }

    public static native void printHello();
  }

  static
  {
    System.out.println("static initializer 1");
  }

  public static void main(String[] args)
  {
    //System.loadLibrary("test"); // if it's here, this app works
    NativeClass.printHello();
  }
}