10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package apple.launcher; 27 28 import java.io.*; 29 import java.lang.reflect.*; 30 import java.security.PrivilegedAction; 31 import java.text.MessageFormat; 32 import java.util.*; 33 import java.util.jar.*; 34 35 import javax.swing.*; 36 37 class JavaAppLauncher implements Runnable { 38 static { 39 java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("osx")); 40 } 41 42 private static native <T> T nativeConvertAndRelease(final long ptr); 43 private static native void nativeInvokeNonPublic(Class<? extends Method> cls, Method m, String[] args); 44 45 // entry point from native 46 static void launch(final long javaDictionaryPtr, final boolean verbose) { 47 final Map<String, ?> javaDictionary = nativeConvertAndRelease(javaDictionaryPtr); 48 (new JavaAppLauncher(javaDictionary, verbose)).run(); 49 } 50 51 // these are the values for the enumeration JavaFailureMode 52 static final String kJavaFailureMainClassNotSpecified = "MainClassNotSpecified"; 53 static final String kJavaFailureMainClassNotFound = "CannotLoadMainClass"; 54 static final String kJavaFailureMainClassHasNoMain = "NoMainMethod"; 55 static final String kJavaFailureMainClassMainNotStatic = "MainNotStatic"; 56 static final String kJavaFailureMainThrewException = "MainThrewException"; 57 static final String kJavaFailureMainInitializerException = "MainInitializerException"; 58 59 final boolean verbose; // Normally set by environment variable JAVA_LAUNCHER_VERBOSE. 60 final Map<String, ?> javaDictionary; | 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package apple.launcher; 27 28 import java.io.*; 29 import java.lang.reflect.*; 30 import java.text.MessageFormat; 31 import java.util.*; 32 import java.util.jar.*; 33 34 import javax.swing.*; 35 36 class JavaAppLauncher implements Runnable { 37 static { 38 java.security.AccessController.doPrivileged( 39 new java.security.PrivilegedAction<Void>() { 40 public Void run() { 41 System.loadLibrary("osx"); 42 return null; 43 } 44 }); 45 } 46 47 private static native <T> T nativeConvertAndRelease(final long ptr); 48 private static native void nativeInvokeNonPublic(Class<? extends Method> cls, Method m, String[] args); 49 50 // entry point from native 51 static void launch(final long javaDictionaryPtr, final boolean verbose) { 52 final Map<String, ?> javaDictionary = nativeConvertAndRelease(javaDictionaryPtr); 53 (new JavaAppLauncher(javaDictionary, verbose)).run(); 54 } 55 56 // these are the values for the enumeration JavaFailureMode 57 static final String kJavaFailureMainClassNotSpecified = "MainClassNotSpecified"; 58 static final String kJavaFailureMainClassNotFound = "CannotLoadMainClass"; 59 static final String kJavaFailureMainClassHasNoMain = "NoMainMethod"; 60 static final String kJavaFailureMainClassMainNotStatic = "MainNotStatic"; 61 static final String kJavaFailureMainThrewException = "MainThrewException"; 62 static final String kJavaFailureMainInitializerException = "MainInitializerException"; 63 64 final boolean verbose; // Normally set by environment variable JAVA_LAUNCHER_VERBOSE. 65 final Map<String, ?> javaDictionary; |