Closed javydreamercsw closed 8 years ago
@javydreamercsw You seem to be barking up the wrong tree. Change your configuration as follows: build.gradle:
launch4j {
mainClassName = 'pcgen.system.Main'
icon = "${projectDir}/installers/win-installer/Local/pcgen.ico"
outfile = "${projectDir}/code/pcgen.exe"
jreMaxVersion = '1.8.9'
jdkPreference = 'preferJre'
initialHeapSize = 128
maxHeapSize = 512
stayAlive = false
bundledJre64Bit = true
jar = "${projectDir}/pcgen.jar"
dontWrapJar = true
bundledJrePath = 'jre'
}
Then just call the launch4j task createExe
.
Still don't understand what's the difference between yours and mine. Have no clue what you mean by:
Then just call the launch4j task createExe.
Made some progress, now I'm getting this error:
FAILURE: Build failed with an exception.
pcgen.exe not created: launch4j: Specify runtime path of the jar relative to the executable.
Was unable to find anything in the documentation.
This error is due to the following line jar = "${projectDir}/pcgen.jar"
. Usually when you distribute your application, you like to place the jar relative to the executable. Hence, Launch4j enforces this, because your "${projectDir}"
folder may no even exist on a 'target pc' for your application. Try removing the jar
definition - the line above - and check if that works. This plugin then uses the jar created by the jar task.
Now I got this error:
FAILURE: Build failed with an exception.
pcgen.exe not created: launch4j: Original filename exceeds the maximum length of 50 characters.
This is the path in this variable created by the tool:
I'll move my project out of my external drive, but I shouldn't need to...
It did work in creating the exe, but I need it tu use the specified JRE.
With the launch4j app I can use a property like this:
But with the plugin it gives me error:
pcgen.exe not created: launch4j: Compiling resources launch4j: Linking launch4j: Successfully created /home/javier/Desktop/pcgen/code/pcgen.exe
Even using the generated configuration file works under launch4j app but fails on the script.
Replace your last commit javydreamercsw/pcgen@a66ac26090d58a6db977850574c124b71bab9e04
//See: https://github.com/TheBoegl/gradle-launch4j
//task createWindowsExe {
// new File("${projectDir}/code/pcgen.exe").delete()
// launch4j {
// mainClassName = 'pcgen.system.Main'
// icon = "${projectDir}/installers/win-installer/Local/pcgen.ico"
// outfile = "${projectDir}/code/pcgen.exe"
// jreMinVersion = '1.8.0'
// jreMaxVersion = '1.8.9'
// jdkPreference = 'preferJre'
// initialHeapSize = 128
// maxHeapSize = 512
// stayAlive = false
// jar = "pcgen.jar"
// bundledJre64Bit = true
// dontWrapJar = true
// bundledJrePath = 'jre'
// }
//}
with
//See: https://github.com/TheBoegl/gradle-launch4j
launch4j {
mainClassName = 'pcgen.system.Main'
icon = "${projectDir}/installers/win-installer/Local/pcgen.ico"
outfile = "pcgen.exe"
jreMinVersion = '1.8.0'
jreMaxVersion = '1.8.9'
jdkPreference = 'preferJre'
initialHeapSize = 128
maxHeapSize = 512
stayAlive = false
bundledJre64Bit = true
dontWrapJar = true
bundledJrePath = 'jre'
}
Then just call ./gradlew createExe
and copy the created pcgen.exe and lib folder to your destination folder. Though this can be automated, try it this way first...
Looks like that did the trick!
Still feels like your plugin goes thru the work of copying dependencies, etc when it's configured not to wrap the jar.
It has to! Wrapping the jar -- in the launch4j sense -- means to include it into the executable. Nonetheless the dependencies of that jar, wrapped or not, should be available while executing the exe. Hence, they are located next to the executable in a default location named lib.
I see. Looks like I need to tweak my files more. Looks like they did this folder manually. Thanks!
I guess it's due to the lack of experience, but the task has no output to help debugging either. Here's the script I'm using. hope it helps somehow to find my issue.
I don't see the exe file being created. Just this output: