summaryrefslogtreecommitdiff
path: root/examples/java/ZeroTierHelloWorld/src/MyClass.java
blob: d71377d833e5b6a20adabdc78424e259d2027734 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Hello World example for the ZeroTierSDK

import zerotier.*;

public class MyClass {
	
    public native int loadsymbols();
    public native void startOneService();
    
	static {
        System.loadLibrary("zt");
    }

	public static void main(String[] args) {
		
        System.out.println("Welcome to the Machine");
       
        final ZeroTier z = new ZeroTier();
        
        new Thread(new Runnable() {
            public void run() {
                // Calls to JNI code
                z.start("/Users/Joseph/op/code/zerotier/ZeroTierSDK/zt1");
            }
        }).start();
                
        //while(!z.running()) { }

        while(true)
        {
        	try {
        		System.out.println("Welcome to the Machine");
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
}