1 20 21 package org.jdesktop.jdic.packager.impl; 22 23 26 public class JnlpUtility { 27 36 public static String [] javawsCheckScript() { 37 String [] javawscheckscript = { 38 "#!/bin/sh", 39 "# Check the existence of javaws 1.5 or later under $PATH.", 40 "echo_error()", 41 "{", 42 " echo \"Error: incorrect javaws version.\"", 43 " echo \"Please install javaws 1.5 or later and set it as the helper application for the Mime type\"", 44 " echo \"\\\"application/x-java-jnlp-file\\\" in /etc/mailcap file. Then try the installation again.\"", 45 " exit 3", 46 "}", 47 "", 48 "JNLP_ASSOCIATION=`grep '^[^#]*application/x-java-jnlp-file' /etc/mailcap`", 49 "if [ $? -ne 0 ]", 50 "then", 51 " echo \"ERROR: script line 'type javaws 2>&1' returns non-zero value.\"", 52 "else", 53 " JAVAWS_PATH=`echo $JNLP_ASSOCIATION | awk -F\\; '{print $2}' | awk '{print $1}'`", 54 "fi", 55 "", 56 "PARENT_DIR=`echo ${JAVAWS_PATH} | awk -F\\/ '{for (i=2; i<NF; i++) printf \"/%s\", $i}'`", 57 "if [ -h ${JAVAWS_PATH} ]", 58 "then", 59 " LS_RESULT=`ls -l ${JAVAWS_PATH} 2>&1`", 60 " LINK_TARGET=`echo ${LS_RESULT} | awk '{printf \"%s\", $NF}'`", 61 " LINK_TARGET_BEGIN=`echo ${LINK_TARGET} | awk '{printf \"%s\", $1}'`", 62 " if [ ${LINK_TARGET_BEGIN}/ = \"/\" ]", 63 " then", 64 " PARENT_DIR=`echo ${LINK_TARGET} | awk -F\\/ '{for (i=2; i<NF; i++) printf \"/%s\", $i}'`", 65 " JAVA_PATH=${PARENT_DIR}/java", 66 " else", 67 " JAVA_PARENT_DIR=`echo ${PARENT_DIR}/${LINK_TARGET} | awk -F\\/ '{for (i=2; i<NF; i++) printf \"/%s\", $i}'`", 68 " JAVA_PATH=${JAVA_PARENT_DIR}/java", 69 " fi", 70 "else", 71 " JAVA_PATH=${PARENT_DIR}/java", 72 "fi", 73 "", 74 "if [ -f ${JAVA_PATH} ]", 75 "then", 76 " java_ver=`${JAVA_PATH} -version 2>&1 | awk -F\\\" '{print $2}' `", 77 " minor=`echo $java_ver | awk -F\\. '{print $2}'`", 78 " if [ ${minor} -lt 5 ]", 79 " then", 80 " echo_error", 81 " fi", 82 "else", 83 " echo_error", 84 "fi" 85 }; 86 87 return javawscheckscript; 88 } 89 90 95 public static void checkPlatformCompatibility(String osName) { 96 String sysOSName = System.getProperty("os.name").toLowerCase(); 97 if (!sysOSName.startsWith(osName)) { 98 System.out.println( 99 "Error: " + "This tool doesn't support this platform."); 100 System.exit(0); 101 return; 102 } 103 } 104 } 105 | Popular Tags |