import java.io.*;
import java.util.*;

import java.io.*;
import java.util.*;
public class CheckJVM {

   public static void main(String[] args) {
	int jvm = new Integer(System.getProperty("sun.arch.data.model")).intValue();
	System.err.println("JVM\t ==>\t "+jvm);
	String cdfBase = System.getenv("CDF_BASE");
	String cmd = new String(cdfBase+"\\bin\\unixfile.exe -m "+cdfBase+
			        "\\bin\\magic.mgc "+cdfBase+"\\bin\\cdfdump.exe");
	System.err.println("run\t ==>\t "+cmd);
	try {
	  Runtime runtime = Runtime.getRuntime();
	  Process process = runtime.exec(cmd);
          BufferedReader inStream = null;
          String line = null;
          InputStreamReader inReader2 = new InputStreamReader(process.getInputStream(), "UTF-8");
          inStream = new BufferedReader(inReader2, 8192);

          line = inStream.readLine();
          process.waitFor();
	  System.err.println("output\t ==>\t "+line);
	  int ix=line.indexOf("x86-64");
	  if (jvm == 64 && ix > -1) System.err.println(""+jvm+"-bit Java matches to the JNI");
	  else System.err.println(""+jvm+"-bit Java does not match to the JNI");
	} catch (Exception ex) {
	  System.err.println("ERROR...."+ex);
	}

   }

}

