Native Tomcat Launchers

Sometimes it is convinient to start Tomcat using a native launcher under Windows & Mac OS X

In my particular use case I was creating native launchers for Apache JSPWiki (see https://jspwiki.apache.org)

Available Options

What options do you have in the open-source world

Mac OS X AppBundler

The following snippet

<target name="woas:mac-app-oracle-jdk" description="creates an Mac OS X application wrapper for Oracle JDK 1.7+">
    <taskdef 
        name="bundleapp" 
        classname="com.oracle.appbundler.AppBundlerTask"
        classpath="${basedir}/src/resources/appbundler/appbundler-1.0.jar" 
    />
    <bundleapp 
        outputdirectory="${jspwiki.woas.assembly.dir}"
        name="woas"
        displayname="Portable JSPWiki"
        identifier="org.apache.jspwiki.jspwiki-portable"
        icon="${basedir}/src/resources/macos/jspwiki.icns"
        shortversion="${jspwiki.woas.version}"
        applicationCategory="public.app-category.developer-tools"
        mainclassname="org.apache.catalina.startup.Bootstrap">
        <classpath file="${basedir}/target/unpack/tomcat/${jspwiki.tomcat.distribution}/bin/bootstrap.jar"/>
        <classpath file="${basedir}/target/unpack/tomcat/${jspwiki.tomcat.distribution}/bin/tomcat-juli.jar"/>
        <option value="-Xmx96m"/>
        <option value="-Duser.dir=$APP_ROOT/.."/>
        <option value="-Dcatalina.home=$APP_ROOT/.."/>
        <option value="-Dcatalina.base=$APP_ROOT/.."/>
        <option value="-Djava.io.tmpdir=$APP_ROOT/../temp"/>
    </bundleapp>
    <chmod file="${jspwiki.woas.assembly.dir}/woas.app/Contents/MacOS/JavaAppLauncher" perm="ugo+x"/>
</target>    

Some notes along the line

Windows Launch4J

<target name="woas:windows-app" description="creates an windows application wrapper">
    <taskdef 
      name="launch4j"
      classname="net.sf.launch4j.ant.Launch4jTask"
      classpath="${basedir}/src/resources/launch4j/launch4j-3.1.0-beta2.jar:${basedir}/src/resources/launch4j/xstream.jar" 
    />
    <launch4j>
      <config 
        headerType="console" 
        outfile="${jspwiki.woas.assembly.dir}/woas.exe" 
        errTitle="WikiOnAStick" 
        chdir="." 
        icon="${basedir}/src/resources/windows/jspwiki.ico"
        jar="${basedir}/src/resources/tomcat/tomcat-launcher-7.0.52.jar"
        >
        <singleInstance mutexName="org.apache.jspwiki.jspwiki-portable" />
        <jre minVersion="1.6.0" />
        <versionInfo
          fileVersion="2.1.10.1"
          txtFileVersion="JSPWiki ${jspwiki.woas.version}"
          fileDescription="WikiOnAStick"
          copyright="Apache Software Licence 2.0"
          productVersion="2.1.10.1"
          txtProductVersion="JSPWiki ${jspwiki.woas.version}"
          productName="WikiOnAStick"
          companyName="Apache Software Foundation"
          internalName="woas"
          originalFilename="woas.exe"
        />        
      </config>  
    </launch4j>
  </target>    

Some notes along the line

TomcatCreateNativeLaunchers (last edited 2014-04-17 00:51:56 by SiegfriedGoeschl)