Browse files

set boot library if run as java or javac command

If sun.java.command or sun.java.launcher are set, then the VM is being
loaded from e.g. libjvm.so, not as a stand-alone executable.  This
commit allows libjvm.dylib to be used with OpenJDK's java command on OS
X.
  • Loading branch information...
1 parent a098926 commit e9a8aa2e65b2b061c08a931d5425514a75e7d86d Joel Dice committed Apr 20, 2013
Showing with 10 additions and 0 deletions.
  1. +2 −0 src/avian/jnienv.h
  2. +8 −0 src/jnienv.cpp
View
2 src/avian/jnienv.h
@@ -14,6 +14,8 @@
#include "avian/machine.h"
#define BOOTSTRAP_PROPERTY "avian.bootstrap"
+#define JAVA_COMMAND_PROPERTY "sun.java.command"
+#define JAVA_LAUNCHER_PROPERTY "sun.java.launcher"
#define CRASHDIR_PROPERTY "avian.crash.dir"
#define EMBED_PREFIX_PROPERTY "avian.embed.prefix"
#define CLASSPATH_PROPERTY "java.class.path"
View
8 src/jnienv.cpp
@@ -3829,6 +3829,14 @@ JNI_CreateJavaVM(Machine** m, Thread** t, void* args)
sizeof(BOOTSTRAP_PROPERTY)) == 0)
{
bootLibraries = p + sizeof(BOOTSTRAP_PROPERTY);
+ } else if (strncmp(p, JAVA_COMMAND_PROPERTY "=",
+ sizeof(JAVA_COMMAND_PROPERTY)) == 0
+ or strncmp(p, JAVA_LAUNCHER_PROPERTY "=",
+ sizeof(JAVA_LAUNCHER_PROPERTY)) == 0)
+ {
+ // this means we're being invoked via the javac or java
+ // command, so the bootstrap library should be e.g. libjvm.so
+ bootLibraries = SO_PREFIX "jvm" SO_SUFFIX;
} else if (strncmp(p, CRASHDIR_PROPERTY "=",
sizeof(CRASHDIR_PROPERTY)) == 0)
{

0 comments on commit e9a8aa2

Please sign in to comment.