Code Monkey home page Code Monkey logo

gradle-launch4j's Introduction

Notice

Maintenance of the gradle-launch4j plugin has been take over by Sebastian Bögl. The new github repo is:

TheBoegl/gradle-launch4j.

All changes will take place there.

Introduction

The gradle-launch4j plugin uses http://launch4j.sourceforge.net/ to create windows .exe files for java applications. Launch4j must be installed as well to use this plugin.

Tasks

There are 4 tasks:

  • generateXmlConfig - Creates XML configuration file used by launch4j.
  • copyL4jLib - Copies the project dependency jars in the lib directory.
  • createExe - Runs launch4j to generate an .exe file.
  • launch4j - Placeholder task that depends on the above.

Launch4j must be installed separately as it includes native code.

Configuration

The configuration follows the structure of the launch4j xml file. See the launch4j documentation for the meanings. The gradle-launch4j plugin tries to pick sensible defaults based on the project. The only required value is the mainClassName.

An example configuration within your build.gradle might look like:

apply plugin: 'launch4j'

launch4j {
    mainClassName = "com.example.myapp.Start"
    icon = 'icons/myApp.ico'
}


buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'edu.sc.seis.gradle:launch4j:1.0.6'
    }
}

See the [http://gradle.org/docs/current/userguide/custom_plugins.html#customPluginStandalone](Gradle User guide) for more information on how to use a custom plugin.

The values configurable within the launch4j extension along with their defaults are:

  • String launch4jCmd = "launch4j"
  • String outputDir = "launch4j"
  • String xmlFileName = "launch4j.xml"
  • String mainClassName
  • boolean dontWrapJar = false
  • String headerType = "gui"
  • String jar = "lib/"+project.tasks[JavaPlugin.JAR_TASK_NAME].outputs.files.getSingleFile().name
  • String outfile = project.name+'.exe'
  • String errTitle = ""
  • boolean cmdLine = false
  • String chdir = '.'
  • String priority = 'normal'
  • String downloadUrl = ""
  • String supportUrl = ""
  • boolean customProcName = false
  • boolean stayAlive = false
  • String manifest = ""
  • String icon = ""
  • String version = project.version
  • String copyright = "unknown"
  • String opt = ""
  • String bundledJrePath
  • String jreMinVersion = project.targetCompatibility
  • String jreMaxVersion
  • String mutexName
  • String windowTitle
  • String messagesStartupError
  • String messagesBundledJreError
  • String messagesJreVersionError
  • String messagesLauncherError
  • Integer initialHeapSize
  • Integer initialHeapPercent
  • Integer maxHeapSize
  • Integer maxHeapPercent

Mac OSX Lion and Later

The two native executables distributed with launch4j (ld and windres) are PPC and with Lion, Apple has remove the ability to emulate the PPC on an Intel processor. So, Launch4J will not run out of the box on Lion.

However, it is easy to recompile ld and windres and replace them in the Launch4J distribution.

Details

Download the latest binutils (2.22 as of 7 Feb 2012) from [http://www.gnu.org/software/binutils/].

tar zxf binutils-2.22.tar.gz
cd binutils-2.22
./configure --target=i686-pc-mingw32
make
cp binutils/windres /whereever_you_installed/launch4j/bin/.
cp binutils/ld/ld-new /whereever_you_installed/launch4j/bin/ld

The new ld and windres should now work with Launch4J on Lion. Note that ld seems to be compiled to ld-new by default in binutils, so you need to make sure you rename as well as copying to the correct location.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.