Adapt Mac OS X JVM startup now we have switched to JDK 8 92/16892/1
Vincent COUVERT [Fri, 24 Jul 2015 14:40:47 +0000 (16:40 +0200)]
Change-Id: I288c806118340ad65886d18acbcb5abced84d4fe

scilab/bin/scilab
scilab/modules/console/src/c/others/initMacOSXEnv.c

index 5fb786d..f9aa284 100755 (executable)
@@ -298,6 +298,8 @@ set_macosx_java_vm () {
     if test -z "$JAVA_HOME"; then
       JAVA_HOME=$(/usr/libexec/java_home --arch x86_64 --failfast --version 1.8+)
     fi
+    JAVA_JVM_VERSION=$JAVA_HOME
+    export JAVA_JVM_VERSION
     DYLD_LIBRARY_PATH="$JAVA_HOME/../Libraries${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
 
 }
index 1844d54..b2d4d40 100644 (file)
@@ -86,6 +86,9 @@ static void setAppName(const char * name)
  */
 static int launchMacOSXEnv(ScilabEngineInfo* _pSEI)
 {
+
+#undef JVM_DETECTION
+#ifdef JVM_DETECTION
     int ret = -1;
     {
         CFStringRef targetJVM = CFSTR("1.5");
@@ -179,6 +182,20 @@ static int launchMacOSXEnv(ScilabEngineInfo* _pSEI)
             fprintf(stderr, "Error: cant find bundle: com.apple.JavaVM.\n");
         }
     }
+#else
+    int ret = 0;
+    /*
+     * This piece of code is mandatory because Mac OS X implementation of Java has a bug here.
+     * Cocoa does not know how to handle the new window created this way.
+     * See: http://lists.apple.com/archives/Java-dev/2009/Jan/msg00062.html
+     * Or Mac Os X bug #6484319
+     * Thanks to Mike Swingler
+     */
+    ProcessSerialNumber psn;
+    GetCurrentProcess(&psn);
+    TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+    /* End of the workaround */
+#endif
 
     if (ret == 0)
     {