Is it possible to determine if the current Java SE or Dalvik virtual machine is?

I want to implement something similar to this:

if(isJavaVirtualMachine()){
    System.out.println("You are running on a JVM");
}else if(isDalvikVirtualMachine()){
    Log.i("env","You are running on an android.");
}

Is it possible? If this is not possible using Java itself, can I do it using JNI?

+5
source share
2 answers

Use System.getProperty. Property names for Dalvik are documented here.

+10
source

, Java Android. , Android, " Java", ! , ( , ).

+2

All Articles