Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification.
The "TomcatCreateNativeLaunchers" page has been changed by SiegfriedGoeschl: https://wiki.apache.org/tomcat/TomcatCreateNativeLaunchers Comment: Initial draft New page: == Native Tomcat Launchers == Sometimes it is convinient to start Tomcat using a native launcher under Windows & Mac OS X * Clear distinction between other running Tomcat instances * Integration with desktop application launchers * Shipping an Tomcat-based product 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 * for Mac OS and Oracle JDK you can use AppBundler (see http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html) * for Windows you can use Launch4J (see http://launch4j.sourceforge.net) The goal is to habe === Mac OS X AppBundler === The following snippet * defines an a Ant task definition "bundleappp" * invokes the "bundleapp" tasks to create a native Mac OS X launcher * sets the executable flag of the underyling native launcher (just to make 100% sure the file is exetuable) {{{ <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 * "APP_ROOT" is the directory of the Mac OS X launcher and will be expanded accordingly during run-time * The current working directory is undefined therefore all "important" properties must be provided * The two referenced JARs are effectively copied into the native launcher * No JRE is packaged since it assumed that the JRE is available on the target box === Windows Launch4J === * Defines an a Ant task definition "launch4j" * Invokes the "launch4j" tasks to create a native Mac OS X launcher {{{ <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 * Launch4J allows to set the current working directory of the Tomcat instance therefore all Tomcat properties are bootstrapped for the current working directory * I cheated here by providing a manually packaged "tomcat-launcher-7.0.52.jar" which contains "bootstrap.jar" and "tomcat-juli.jar" - I think there is a way to avoid this but I have to test it on an Windows box --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org