diff --git a/launch4j/.classpath b/launch4j/.classpath index 2082e35..e158f9a 100644 --- a/launch4j/.classpath +++ b/launch4j/.classpath @@ -1,18 +1,17 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/launch4j/.gitignore b/launch4j/.gitignore deleted file mode 100644 index c3dca1b..0000000 --- a/launch4j/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/build -/target diff --git a/launch4j/.project b/launch4j/.project index 0607fa0..1c1309d 100644 --- a/launch4j/.project +++ b/launch4j/.project @@ -1,17 +1,17 @@ - - - launch4j - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - + + + launch4j + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/launch4j/.settings/org.eclipse.core.resources.prefs b/launch4j/.settings/org.eclipse.core.resources.prefs index 99f26c0..4824b80 100644 --- a/launch4j/.settings/org.eclipse.core.resources.prefs +++ b/launch4j/.settings/org.eclipse.core.resources.prefs @@ -1,2 +1,2 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/launch4j/.settings/org.eclipse.core.runtime.prefs b/launch4j/.settings/org.eclipse.core.runtime.prefs index 5a0ad22..c522e1f 100644 --- a/launch4j/.settings/org.eclipse.core.runtime.prefs +++ b/launch4j/.settings/org.eclipse.core.runtime.prefs @@ -1,2 +1,2 @@ -eclipse.preferences.version=1 -line.separator=\n +eclipse.preferences.version=1 +line.separator=\n diff --git a/launch4j/.settings/org.eclipse.jdt.core.prefs b/launch4j/.settings/org.eclipse.jdt.core.prefs index c52892e..b37c761 100644 --- a/launch4j/.settings/org.eclipse.jdt.core.prefs +++ b/launch4j/.settings/org.eclipse.jdt.core.prefs @@ -1,81 +1,117 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/launch4j/.settings/org.eclipse.m2e.core.prefs b/launch4j/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 0000000..14b697b --- /dev/null +++ b/launch4j/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/launch4j/.vscode/c_cpp_properties.json b/launch4j/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..6112e5c --- /dev/null +++ b/launch4j/.vscode/c_cpp_properties.json @@ -0,0 +1,21 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**", + "c:\\Program Files (x86)\\Dev-Cpp\\MinGW32\\include\\**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "cStandard": "gnu89", + "cppStandard": "gnu++98", + "intelliSenseMode": "windows-gcc-x86", + "compilerPath": "c:\\Program Files (x86)\\Dev-Cpp\\MinGW32\\bin\\gcc.exe" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/launch4j/.vscode/tasks.json b/launch4j/.vscode/tasks.json new file mode 100644 index 0000000..27bda68 --- /dev/null +++ b/launch4j/.vscode/tasks.json @@ -0,0 +1,17 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "make", + "targetName": "all", + "makeFileRelativePath": "head_src\\makefile", + "problemMatcher": [], + "label": "make: all", + "detail": "./head_src\\makefile", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/launch4j/LICENSE.txt b/launch4j/LICENSE.txt index 38af528..4c824e1 100644 --- a/launch4j/LICENSE.txt +++ b/launch4j/LICENSE.txt @@ -1,30 +1,30 @@ -Launch4j (http://launch4j.sourceforge.net/) -Cross-platform Java application wrapper for creating Windows native executables. - -Copyright (c) 2004, 2017 Grzegorz Kowal -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +Launch4j (http://launch4j.sourceforge.net/) +Cross-platform Java application wrapper for creating Windows native executables. + +Copyright (c) 2004, 2021 Grzegorz Kowal +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/launch4j/build.xml b/launch4j/build.xml index 9264ea9..3948303 100644 --- a/launch4j/build.xml +++ b/launch4j/build.xml @@ -1,77 +1,77 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launch4j/demo/ConsoleApp/.gitignore b/launch4j/demo/ConsoleApp/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/launch4j/demo/ConsoleApp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/launch4j/demo/ConsoleApp/ConsoleApp.jar b/launch4j/demo/ConsoleApp/ConsoleApp.jar index 14b8319..1b72533 100644 --- a/launch4j/demo/ConsoleApp/ConsoleApp.jar +++ b/launch4j/demo/ConsoleApp/ConsoleApp.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:590ea97379013c8b186810a1a81e2001f8f63d042b0f02789a31f99a270c590d -size 2099 +oid sha256:0a5b4ecbc5cf61e6b214d4da2c8c3d559376cff6fe3dbcce2fa5b31d93e12d55 +size 2101 diff --git a/launch4j/demo/ConsoleApp/build.xml b/launch4j/demo/ConsoleApp/build.xml index b53d77f..20912d9 100644 --- a/launch4j/demo/ConsoleApp/build.xml +++ b/launch4j/demo/ConsoleApp/build.xml @@ -1,57 +1,57 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java b/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java index 57dd324..eb7b3d9 100644 --- a/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java +++ b/launch4j/demo/ConsoleApp/src/net/sf/launch4j/example/ConsoleApp.java @@ -1,72 +1,72 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.example; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class ConsoleApp { - public static void main(String[] args) { - StringBuffer sb = new StringBuffer("Hello World!\n\nJava version: "); - sb.append(System.getProperty("java.version")); - sb.append("\nJava home: "); - sb.append(System.getProperty("java.home")); - sb.append("\nCurrent dir: "); - sb.append(System.getProperty("user.dir")); - if (args.length > 0) { - sb.append("\nArgs: "); - for (int i = 0; i < args.length; i++) { - sb.append(args[i]); - sb.append(' '); - } - } - sb.append("\n\nEnter a line of text, 'quit' or Ctrl-C to stop.\n\n>"); - System.out.print(sb.toString()); - try { - BufferedReader is = new BufferedReader(new InputStreamReader(System.in)); - String line; - while ((line = is.readLine()) != null && !line.equalsIgnoreCase("quit")) { - System.out.print("You wrote: " + line + "\n\n>"); - } - is.close(); - System.exit(123); - } catch (IOException e) { - System.err.print(e); - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.example; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class ConsoleApp { + public static void main(String[] args) { + StringBuffer sb = new StringBuffer("Hello World!\n\nJava version: "); + sb.append(System.getProperty("java.version")); + sb.append("\nJava home: "); + sb.append(System.getProperty("java.home")); + sb.append("\nCurrent dir: "); + sb.append(System.getProperty("user.dir")); + if (args.length > 0) { + sb.append("\nArgs: "); + for (int i = 0; i < args.length; i++) { + sb.append(args[i]); + sb.append(' '); + } + } + sb.append("\n\nEnter a line of text, 'quit' or Ctrl-C to stop.\n\n>"); + System.out.print(sb.toString()); + try { + BufferedReader is = new BufferedReader(new InputStreamReader(System.in)); + String line; + while ((line = is.readLine()) != null && !line.equalsIgnoreCase("quit")) { + System.out.print("You wrote: " + line + "\n\n>"); + } + is.close(); + System.exit(123); + } catch (IOException e) { + System.err.print(e); + } + } +} diff --git a/launch4j/demo/ExitCodeApp/.gitignore b/launch4j/demo/ExitCodeApp/.gitignore deleted file mode 100644 index c3dca1b..0000000 --- a/launch4j/demo/ExitCodeApp/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/build -/target diff --git a/launch4j/demo/ExitCodeApp/pom.xml b/launch4j/demo/ExitCodeApp/pom.xml index cc7a008..c1be1f7 100644 --- a/launch4j/demo/ExitCodeApp/pom.xml +++ b/launch4j/demo/ExitCodeApp/pom.xml @@ -1,72 +1,75 @@ - - 4.0.0 - net.sf.launch4j.example - ExitCodeApp - 1.0 - ExitCodeApp - jar - - - UTF-8 - - - - src - - - src - - **/*.java - - - - - - maven-compiler-plugin - 3.1 - - 1.6 - 1.6 - - - - com.akathist.maven.plugins.launch4j - launch4j-maven-plugin - 1.7.6 - - - l4j - package - launch4j - - console - target/ExitCodeApp.exe - target/ExitCodeApp-1.0.jar - ExitCodeApp - - net.sf.launch4j.example.ExitCodeApp - false - anything - - - 1.5.0 - - - 1.0.0.0 - 1.0 - Simple app for testing exit code. - Copyright (C) 2015 GK - 3.9.0.0 - 3.9 - ExitCodeApp - ExitCodeApp - ExitCodeApp.exe - - - - - - - - \ No newline at end of file + + 4.0.0 + net.sf.launch4j.example + ExitCodeApp + 1.0 + ExitCodeApp + jar + + + UTF-8 + + + + src + + + src + + **/*.java + + + + + + maven-compiler-plugin + 3.1 + + 1.8 + 1.8 + + + + com.akathist.maven.plugins.launch4j + launch4j-maven-plugin + 1.7.22 + + + l4j + package + + launch4j + + + console + target/ExitCodeApp.exe + target/ExitCodeApp-1.0.jar + ExitCodeApp + + net.sf.launch4j.example.ExitCodeApp + false + anything + + + %JAVA_HOME%;%PATH% + 1.8.0 + + + 1.0.0.0 + 1.0 + Simple app for testing exit code. + Copyright (C) 2022 GK + 3.9.0.0 + 3.9 + ExitCodeApp + ExitCodeApp + ExitCodeApp.exe + + + + + + + + \ No newline at end of file diff --git a/launch4j/demo/LICENSE.txt b/launch4j/demo/LICENSE.txt index b778408..c5cd21c 100644 --- a/launch4j/demo/LICENSE.txt +++ b/launch4j/demo/LICENSE.txt @@ -1,30 +1,30 @@ -Launch4j (http://launch4j.sourceforge.net/) -Cross-platform Java application wrapper for creating Windows native executables. - -Copyright (c) 2004, 2015 Grzegorz Kowal -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +Launch4j (http://launch4j.sourceforge.net/) +Cross-platform Java application wrapper for creating Windows native executables. + +Copyright (c) 2004, 2015 Grzegorz Kowal +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/launch4j/demo/SimpleApp/.gitignore b/launch4j/demo/SimpleApp/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/launch4j/demo/SimpleApp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/launch4j/demo/SimpleApp/SimpleApp.jar b/launch4j/demo/SimpleApp/SimpleApp.jar index 22316c6..cba980f 100644 --- a/launch4j/demo/SimpleApp/SimpleApp.jar +++ b/launch4j/demo/SimpleApp/SimpleApp.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6317805991aa6bb8094a2e7c39dd2604f804d761a7cca231c07b9906e43a91e1 -size 5942 +oid sha256:0cff2a0a0c80b5659376bfa6b1f7a668d99fde30306c98aeea2e50c21ebc7482 +size 5945 diff --git a/launch4j/demo/SimpleApp/build.xml b/launch4j/demo/SimpleApp/build.xml index 9b6aae0..458a40d 100644 --- a/launch4j/demo/SimpleApp/build.xml +++ b/launch4j/demo/SimpleApp/build.xml @@ -1,52 +1,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launch4j/demo/SimpleApp/l4j/SimpleApp.xml b/launch4j/demo/SimpleApp/l4j/SimpleApp.xml index eacd757..8e2f603 100644 --- a/launch4j/demo/SimpleApp/l4j/SimpleApp.xml +++ b/launch4j/demo/SimpleApp/l4j/SimpleApp.xml @@ -1,19 +1,20 @@ - - gui - SimpleApp.jar - true - ../SimpleApp.exe - SimpleApp - . - SimpleApp.ico - true - - 1.6.0 - - - splash.bmp - true - 60 - true - + + gui + SimpleApp.jar + true + ../SimpleApp.exe + SimpleApp + . + SimpleApp.ico + true + + %JAVA_HOME%;%PATH% + 1.8.0 + + + splash.bmp + true + 60 + true + \ No newline at end of file diff --git a/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java b/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java index 1b6fc5d..8008cf6 100644 --- a/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java +++ b/launch4j/demo/SimpleApp/src/net/sf/launch4j/example/SimpleApp.java @@ -1,195 +1,195 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.example; - -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.swing.AbstractAction; -import javax.swing.JFrame; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.UIManager; - -public class SimpleApp extends JFrame { - public SimpleApp(String[] args) { - super("Java Application"); - - if (args.length == 1 && "throw".equals(args[0])) { - throw new IllegalStateException("Exception thrown from SimpleApp."); - } - - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - setBounds (screenSize.width / 4, screenSize.height / 4, screenSize.width / 2, screenSize.height / 2); - - addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - System.exit(0); - }}); - - initializeMenu(); - initializeTextArea(args); - setVisible(true); - } - - public static void setLAF() { - JFrame.setDefaultLookAndFeelDecorated(true); - Toolkit.getDefaultToolkit().setDynamicLayout(true); - System.setProperty("sun.awt.noerasebackground","true"); - try { - UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); - } catch (Exception e) { - System.err.println("Failed to set LookAndFeel"); - } - } - - public static void main(String[] args) { - setLAF(); - new SimpleApp(args); - } - - private final void initializeMenu() { - JMenu menu = new JMenu("Exit with code"); - - menu.add(new JMenuItem(new AbstractAction("Exit with code 0") { - @Override - public void actionPerformed(ActionEvent e) { - System.exit(0); - } - })); - - menu.add(new JMenuItem(new AbstractAction("Exit with code 100 and restart the application") { - @Override - public void actionPerformed(ActionEvent e) { - System.exit(100); - } - })); - - JMenuBar mb = new JMenuBar(); - mb.setOpaque(true); - mb.add(menu); - setJMenuBar(mb); - } - - private final void initializeTextArea(String[] args) { - JTextArea textArea = new JTextArea(); - textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); - textArea.setEditable(false); - - JScrollPane scrollPane = new JScrollPane(); - scrollPane.setViewportView(textArea); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - getContentPane().add(scrollPane); - - textArea.setText(getMainProperties(args)); - textArea.append(getAllProperties()); - textArea.append(getEnvironmentVariables()); - } - - private final String getMainProperties(String[] args) { - StringBuffer sb = new StringBuffer("Java version: "); - sb.append(System.getProperty("java.version")); - sb.append("\nJava home: "); - sb.append(System.getProperty("java.home")); - sb.append("\nCurrent dir: "); - sb.append(System.getProperty("user.dir")); - sb.append("\nCommand line args: {"); - - for (int i = 0; i < args.length; i++) { - if (i > 0) - { - sb.append(' '); - } - sb.append(args[i]); - } - - sb.append("}\n"); - - final int mb = 1024 * 1024; - sb.append("Free memory (MB): "); - sb.append(Runtime.getRuntime().freeMemory() / mb); - sb.append("\nTotal memory (MB): "); - sb.append(Runtime.getRuntime().totalMemory() / mb); - sb.append("\nMax memory (MB): "); - sb.append(Runtime.getRuntime().maxMemory() / mb); - sb.append("\n"); - - return sb.toString(); - } - - private final String getAllProperties() { - StringBuffer sb = new StringBuffer("\n========== All properties ==========\n"); - - List keys = new ArrayList(); - keys.addAll(System.getProperties().stringPropertyNames()); - Collections.sort(keys); - - for (String key : keys) { - sb.append(key); - sb.append(": "); - sb.append(System.getProperty(key)); - sb.append("\n"); - } - - return sb.toString(); - } - - private final String getEnvironmentVariables() { - StringBuffer sb = new StringBuffer("\n========== Environment variables ==========\n"); - - List keys = new ArrayList(); - keys.addAll(System.getenv().keySet()); - Collections.sort(keys); - - for (String key : keys) { - sb.append(key); - sb.append(": "); - sb.append(System.getenv(key)); - sb.append("\n"); - } - - return sb.toString(); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.example; + +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.swing.AbstractAction; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.UIManager; + +public class SimpleApp extends JFrame { + public SimpleApp(String[] args) { + super("Java Application"); + + if (args.length == 1 && "throw".equals(args[0])) { + throw new IllegalStateException("Exception thrown from SimpleApp."); + } + + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + setBounds (screenSize.width / 4, screenSize.height / 4, screenSize.width / 2, screenSize.height / 2); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + System.exit(0); + }}); + + initializeMenu(); + initializeTextArea(args); + setVisible(true); + } + + public static void setLAF() { + JFrame.setDefaultLookAndFeelDecorated(true); + Toolkit.getDefaultToolkit().setDynamicLayout(true); + System.setProperty("sun.awt.noerasebackground","true"); + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + } catch (Exception e) { + System.err.println("Failed to set LookAndFeel"); + } + } + + public static void main(String[] args) { + setLAF(); + new SimpleApp(args); + } + + private final void initializeMenu() { + JMenu menu = new JMenu("Exit with code"); + + menu.add(new JMenuItem(new AbstractAction("Exit with code 0") { + @Override + public void actionPerformed(ActionEvent e) { + System.exit(0); + } + })); + + menu.add(new JMenuItem(new AbstractAction("Exit with code 100 and restart the application") { + @Override + public void actionPerformed(ActionEvent e) { + System.exit(100); + } + })); + + JMenuBar mb = new JMenuBar(); + mb.setOpaque(true); + mb.add(menu); + setJMenuBar(mb); + } + + private final void initializeTextArea(String[] args) { + JTextArea textArea = new JTextArea(); + textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12)); + textArea.setEditable(false); + + JScrollPane scrollPane = new JScrollPane(); + scrollPane.setViewportView(textArea); + scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + getContentPane().add(scrollPane); + + textArea.setText(getMainProperties(args)); + textArea.append(getAllProperties()); + textArea.append(getEnvironmentVariables()); + } + + private final String getMainProperties(String[] args) { + StringBuffer sb = new StringBuffer("Java version: "); + sb.append(System.getProperty("java.version")); + sb.append("\nJava home: "); + sb.append(System.getProperty("java.home")); + sb.append("\nCurrent dir: "); + sb.append(System.getProperty("user.dir")); + sb.append("\nCommand line args: {"); + + for (int i = 0; i < args.length; i++) { + if (i > 0) + { + sb.append(' '); + } + sb.append(args[i]); + } + + sb.append("}\n"); + + final int mb = 1024 * 1024; + sb.append("Free memory (MB): "); + sb.append(Runtime.getRuntime().freeMemory() / mb); + sb.append("\nTotal memory (MB): "); + sb.append(Runtime.getRuntime().totalMemory() / mb); + sb.append("\nMax memory (MB): "); + sb.append(Runtime.getRuntime().maxMemory() / mb); + sb.append("\n"); + + return sb.toString(); + } + + private final String getAllProperties() { + StringBuffer sb = new StringBuffer("\n========== All properties ==========\n"); + + List keys = new ArrayList(); + keys.addAll(System.getProperties().stringPropertyNames()); + Collections.sort(keys); + + for (String key : keys) { + sb.append(key); + sb.append(": "); + sb.append(System.getProperty(key)); + sb.append("\n"); + } + + return sb.toString(); + } + + private final String getEnvironmentVariables() { + StringBuffer sb = new StringBuffer("\n========== Environment variables ==========\n"); + + List keys = new ArrayList(); + keys.addAll(System.getenv().keySet()); + Collections.sort(keys); + + for (String key : keys) { + sb.append(key); + sb.append(": "); + sb.append(System.getenv(key)); + sb.append("\n"); + } + + return sb.toString(); + } +} diff --git a/launch4j/head/LICENSE.txt b/launch4j/head/LICENSE.txt index e95c830..824d75c 100644 --- a/launch4j/head/LICENSE.txt +++ b/launch4j/head/LICENSE.txt @@ -1,26 +1,26 @@ -Launch4j (http://launch4j.sourceforge.net/) -Cross-platform Java application wrapper for creating Windows native executables. - -Copyright (c) 2004, 2015 Grzegorz Kowal - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -Except as contained in this notice, the name(s) of the above copyright holders -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +Launch4j (http://launch4j.sourceforge.net/) +Cross-platform Java application wrapper for creating Windows native executables. + +Copyright (c) 2004, 2015 Grzegorz Kowal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Except as contained in this notice, the name(s) of the above copyright holders +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/launch4j/head/consolehead.o b/launch4j/head/consolehead.o index 60bb62f..d322344 100644 Binary files a/launch4j/head/consolehead.o and b/launch4j/head/consolehead.o differ diff --git a/launch4j/head/guihead.o b/launch4j/head/guihead.o index 7cff132..6fcc3d3 100644 Binary files a/launch4j/head/guihead.o and b/launch4j/head/guihead.o differ diff --git a/launch4j/head/head.o b/launch4j/head/head.o index 849299f..29d1e7f 100644 Binary files a/launch4j/head/head.o and b/launch4j/head/head.o differ diff --git a/launch4j/head_jni_BETA/LICENSE.txt b/launch4j/head_jni_BETA/LICENSE.txt index e95c830..824d75c 100644 --- a/launch4j/head_jni_BETA/LICENSE.txt +++ b/launch4j/head_jni_BETA/LICENSE.txt @@ -1,26 +1,26 @@ -Launch4j (http://launch4j.sourceforge.net/) -Cross-platform Java application wrapper for creating Windows native executables. - -Copyright (c) 2004, 2015 Grzegorz Kowal - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -Except as contained in this notice, the name(s) of the above copyright holders -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +Launch4j (http://launch4j.sourceforge.net/) +Cross-platform Java application wrapper for creating Windows native executables. + +Copyright (c) 2004, 2015 Grzegorz Kowal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Except as contained in this notice, the name(s) of the above copyright holders +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/launch4j/head_jni_BETA/head.o b/launch4j/head_jni_BETA/head.o index bd99219..29d1e7f 100644 Binary files a/launch4j/head_jni_BETA/head.o and b/launch4j/head_jni_BETA/head.o differ diff --git a/launch4j/head_jni_BETA/jniconsolehead.o b/launch4j/head_jni_BETA/jniconsolehead.o index 2070023..d72c65c 100644 Binary files a/launch4j/head_jni_BETA/jniconsolehead.o and b/launch4j/head_jni_BETA/jniconsolehead.o differ diff --git a/launch4j/head_jni_BETA/jniguihead.o b/launch4j/head_jni_BETA/jniguihead.o index 6ece617..f37343c 100644 Binary files a/launch4j/head_jni_BETA/jniguihead.o and b/launch4j/head_jni_BETA/jniguihead.o differ diff --git a/launch4j/head_src/LICENSE.txt b/launch4j/head_src/LICENSE.txt index a08f808..efbfaa0 100644 --- a/launch4j/head_src/LICENSE.txt +++ b/launch4j/head_src/LICENSE.txt @@ -1,26 +1,26 @@ -Launch4j (http://launch4j.sourceforge.net/) -Cross-platform Java application wrapper for creating Windows native executables. - -Copyright (c) 2004, 2015 Grzegorz Kowal - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -Except as contained in this notice, the name(s) of the above copyright holders -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +Launch4j (http://launch4j.sourceforge.net/) +Cross-platform Java application wrapper for creating Windows native executables. + +Copyright (c) 2004, 2015 Grzegorz Kowal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +Except as contained in this notice, the name(s) of the above copyright holders +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/launch4j/head_src/consolehead/.gitignore b/launch4j/head_src/consolehead/.gitignore deleted file mode 100644 index b566d3b..0000000 --- a/launch4j/head_src/consolehead/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/consolehead.exe -/consolehead.layout diff --git a/launch4j/head_src/consolehead/Makefile.win b/launch4j/head_src/consolehead/Makefile.win index 349e4c0..71cd1c0 100644 --- a/launch4j/head_src/consolehead/Makefile.win +++ b/launch4j/head_src/consolehead/Makefile.win @@ -1,30 +1,28 @@ # Project: consolehead -# Makefile created by Dev-C++ 4.9.9.2 +# Makefile created by Dev-C++ 5.7.1 -CPP = g++.exe -CC = gcc.exe -WINDRES = windres.exe -RES = -OBJ = ../../head/consolehead.o ../../head/head.o $(RES) -LINKOBJ = ../../head/consolehead.o ../../head/head.o $(RES) -LIBS = -L"C:/Dev-Cpp/lib" -n -s -INCS = -I"C:/Dev-Cpp/include" -CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -BIN = consolehead.exe -CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3 -CFLAGS = $(INCS) -fexpensive-optimizations -O3 -RM = rm -f +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +OBJ = ../../head/consolehead.o ../../head/head.o +LINKOBJ = ../../head/consolehead.o ../../head/head.o +LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -n -s +INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" +CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" +BIN = consolehead.exe +CXXFLAGS = $(CXXINCS) -Os +CFLAGS = $(INCS) -Os +RM = rm.exe -f .PHONY: all all-before all-after clean clean-custom -all: all-before consolehead.exe all-after - +all: all-before $(BIN) all-after clean: clean-custom ${RM} $(OBJ) $(BIN) $(BIN): $(OBJ) -# $(CC) $(LINKOBJ) -o "consolehead.exe" $(LIBS) + $(CC) $(LINKOBJ) -o $(BIN) $(LIBS) ../../head/consolehead.o: consolehead.c $(CC) -c consolehead.c -o ../../head/consolehead.o $(CFLAGS) diff --git a/launch4j/head_src/consolehead/consolehead.c b/launch4j/head_src/consolehead/consolehead.c index 1846a56..297cd11 100644 --- a/launch4j/head_src/consolehead/consolehead.c +++ b/launch4j/head_src/consolehead/consolehead.c @@ -1,97 +1,97 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#include "../resource.h" -#include "../head.h" - -extern FILE* hLog; - -BOOL restartOnCrash = FALSE; - -int main(int argc, char* argv[]) -{ - setConsoleFlag(); - LPTSTR cmdLine = GetCommandLine(); - - if (*cmdLine == '"') - { - if (*(cmdLine = strchr(cmdLine + 1, '"') + 1)) - { - cmdLine++; - } - } - else if ((cmdLine = strchr(cmdLine, ' ')) != NULL) - { - cmdLine++; - } - else - { - cmdLine = ""; - } - - int result = prepare(cmdLine); - - if (result == ERROR_ALREADY_EXISTS) - { - char errMsg[BIG_STR] = {0}; - loadString(INSTANCE_ALREADY_EXISTS_MSG, errMsg); - msgBox(errMsg); - closeLogFile(); - return 2; - } - - if (result != TRUE) - { - signalError(); - return 1; - } - - restartOnCrash = loadBool(RESTART_ON_CRASH); - DWORD dwExitCode; - - do - { - dwExitCode = 0; - - if (!execute(TRUE, &dwExitCode)) - { - signalError(); - break; - } - - if (restartOnCrash && dwExitCode != 0) - { - debug("Exit code:\t%d, restarting the application!\n", dwExitCode); - } - } while (restartOnCrash && dwExitCode != 0); - - debug("Exit code:\t%d\n", dwExitCode); - closeLogFile(); - return (int) dwExitCode; -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#include "../resource.h" +#include "../head.h" + +extern FILE* hLog; + +BOOL restartOnCrash = FALSE; + +int main(int argc, char* argv[]) +{ + setConsoleFlag(); + LPTSTR cmdLine = GetCommandLine(); + + if (*cmdLine == '"') + { + if (*(cmdLine = strchr(cmdLine + 1, '"') + 1)) + { + cmdLine++; + } + } + else if ((cmdLine = strchr(cmdLine, ' ')) != NULL) + { + cmdLine++; + } + else + { + cmdLine = ""; + } + + int result = prepare(cmdLine, FALSE); + + if (result == ERROR_ALREADY_EXISTS) + { + char errMsg[BIG_STR] = {0}; + loadString(INSTANCE_ALREADY_EXISTS_MSG, errMsg); + msgBox(errMsg); + closeLogFile(); + return 2; + } + + if (result != TRUE) + { + signalError(); + return 1; + } + + restartOnCrash = loadBool(RESTART_ON_CRASH); + DWORD dwExitCode; + + do + { + dwExitCode = 0; + + if (!execute(TRUE, &dwExitCode)) + { + signalError(); + break; + } + + if (restartOnCrash && dwExitCode != 0) + { + debug("Exit code:\t%d, restarting the application!\n", dwExitCode); + } + } while (restartOnCrash && dwExitCode != 0); + + debug("Exit code:\t%d\n", dwExitCode); + closeLogFile(); + return (int) dwExitCode; +} diff --git a/launch4j/head_src/consolehead/consolehead.dev b/launch4j/head_src/consolehead/consolehead.dev index 3dce2dc..7387e43 100644 --- a/launch4j/head_src/consolehead/consolehead.dev +++ b/launch4j/head_src/consolehead/consolehead.dev @@ -3,7 +3,7 @@ FileName=consolehead.dev Name=consolehead UnitCount=4 Type=1 -Ver=1 +Ver=2 ObjFiles= Includes= Libs= @@ -22,12 +22,14 @@ OverrideOutputName=consolehead.exe HostApplication= Folders= CommandLine= -UseCustomMakefile=1 +UseCustomMakefile=0 CustomMakefile=Makefile.win IncludeVersionInfo=0 SupportXPThemes=0 CompilerSet=0 -CompilerSettings=0000000001001000000100 +CompilerSettings=000000d000000000000001000 +LogOutput= +LogOutputEnabled=0 [Unit1] FileName=consolehead.c @@ -47,7 +49,7 @@ Build=1 LanguageID=1033 CharsetID=1252 CompanyName= -FileVersion= +FileVersion=0.1.1.1 FileDescription=Developed using the Dev-C++ IDE InternalName= LegalCopyright= @@ -56,6 +58,7 @@ OriginalFilename= ProductName= ProductVersion= AutoIncBuildNr=0 +SyncProduct=0 [Unit2] FileName=..\resource.h diff --git a/launch4j/head_src/guihead/.gitignore b/launch4j/head_src/guihead/.gitignore deleted file mode 100644 index 5ddac15..0000000 --- a/launch4j/head_src/guihead/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/guihead.exe -/guihead.layout diff --git a/launch4j/head_src/guihead/Makefile.win b/launch4j/head_src/guihead/Makefile.win index 30cee56..89d960a 100644 --- a/launch4j/head_src/guihead/Makefile.win +++ b/launch4j/head_src/guihead/Makefile.win @@ -1,30 +1,28 @@ # Project: guihead -# Makefile created by Dev-C++ 4.9.9.2 +# Makefile created by Dev-C++ 5.7.1 -CPP = g++.exe -CC = gcc.exe -WINDRES = windres.exe -RES = -OBJ = ../../head/guihead.o ../../head/head.o $(RES) -LINKOBJ = ../../head/guihead.o ../../head/head.o $(RES) -LIBS = -L"C:/Dev-Cpp/lib" -mwindows -n -s -INCS = -I"C:/Dev-Cpp/include" -CXXINCS = -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" -BIN = guihead.exe -CXXFLAGS = $(CXXINCS) -fexpensive-optimizations -O3 -CFLAGS = $(INCS) -fexpensive-optimizations -O3 -RM = rm -f +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +OBJ = ../../head/guihead.o ../../head/head.o +LINKOBJ = ../../head/guihead.o ../../head/head.o +LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -mwindows -n -s +INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" +CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" +BIN = guihead.exe +CXXFLAGS = $(CXXINCS) -Os +CFLAGS = $(INCS) -Os +RM = rm.exe -f .PHONY: all all-before all-after clean clean-custom -all: all-before guihead.exe all-after - +all: all-before $(BIN) all-after clean: clean-custom ${RM} $(OBJ) $(BIN) $(BIN): $(OBJ) -# $(CC) $(LINKOBJ) -o "guihead.exe" $(LIBS) + $(CC) $(LINKOBJ) -o $(BIN) $(LIBS) ../../head/guihead.o: guihead.c $(CC) -c guihead.c -o ../../head/guihead.o $(CFLAGS) diff --git a/launch4j/head_src/guihead/guihead.c b/launch4j/head_src/guihead/guihead.c index 6d165a2..04e829d 100644 --- a/launch4j/head_src/guihead/guihead.c +++ b/launch4j/head_src/guihead/guihead.c @@ -1,241 +1,241 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - Sylvain Mina (single instance patch) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#include "../resource.h" -#include "../head.h" -#include "guihead.h" - -extern FILE* hLog; -extern PROCESS_INFORMATION processInformation; - -HWND hWnd; -DWORD dwExitCode = 0; -BOOL stayAlive = FALSE; -BOOL splash = FALSE; -BOOL splashTimeoutErr; -BOOL waitForWindow; -BOOL restartOnCrash = FALSE; -int splashTimeout = DEFAULT_SPLASH_TIMEOUT; - -int APIENTRY WinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - LPSTR lpCmdLine, - int nCmdShow) -{ - int result = prepare(lpCmdLine); - - if (result == ERROR_ALREADY_EXISTS) - { - HWND handle = getInstanceWindow(); - ShowWindow(handle, SW_SHOW); - SetForegroundWindow(handle); - closeLogFile(); - return 2; - } - - if (result != TRUE) - { - signalError(); - return 1; - } - - splash = loadBool(SHOW_SPLASH) - && strstr(lpCmdLine, "--l4j-no-splash") == NULL; - restartOnCrash = loadBool(RESTART_ON_CRASH); - - // if we should restart on crash, we must also stay alive to check for crashes - stayAlive = restartOnCrash || - (loadBool(GUI_HEADER_STAYS_ALIVE) - && strstr(lpCmdLine, "--l4j-dont-wait") == NULL); - - if (splash || stayAlive) - { - hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "", - WS_POPUP | SS_BITMAP, - 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); - if (splash) - { - char timeout[10] = {0}; - if (loadString(SPLASH_TIMEOUT, timeout)) - { - splashTimeout = atoi(timeout); - if (splashTimeout <= 0 || splashTimeout > MAX_SPLASH_TIMEOUT) - { - splashTimeout = DEFAULT_SPLASH_TIMEOUT; - } - } - splashTimeout = splashTimeout * 1000; // to millis - splashTimeoutErr = loadBool(SPLASH_TIMEOUT_ERR) - && strstr(lpCmdLine, "--l4j-no-splash-err") == NULL; - waitForWindow = loadBool(SPLASH_WAITS_FOR_WINDOW); - HANDLE hImage = LoadImage(hInstance, // handle of the instance containing the image - MAKEINTRESOURCE(SPLASH_BITMAP), // name or identifier of image - IMAGE_BITMAP, // type of image - 0, // desired width - 0, // desired height - LR_DEFAULTSIZE); - if (hImage == NULL) - { - signalError(); - return 1; - } - SendMessage(hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hImage); - RECT rect; - GetWindowRect(hWnd, &rect); - int x = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2; - int y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2; - SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); - ShowWindow(hWnd, nCmdShow); - UpdateWindow (hWnd); - } - } - - do - { - if (splash || stayAlive) - { - if (!SetTimer (hWnd, ID_TIMER, TIMER_PROC_INTERVAL, TimerProc)) - { - signalError(); - return 1; - } - } - - if (!execute(FALSE, &dwExitCode)) - { - signalError(); - return 1; - } - - if (!(splash || stayAlive)) - { - debug("Exit code:\t0\n"); - closeProcessHandles(); - closeLogFile(); - return 0; - } - - MSG msg; - while (GetMessage(&msg, NULL, 0, 0)) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - if (restartOnCrash && dwExitCode != 0) - { - debug("Exit code:\t%d, restarting the application!\n", dwExitCode); - } - - closeProcessHandles(); - } while (restartOnCrash && dwExitCode != 0); - - debug("Exit code:\t%d\n", dwExitCode); - closeLogFile(); - return dwExitCode; -} - -HWND getInstanceWindow() -{ - char windowTitle[STR]; - char instWindowTitle[STR] = {0}; - if (loadString(INSTANCE_WINDOW_TITLE, instWindowTitle)) - { - HWND handle = FindWindowEx(NULL, NULL, NULL, NULL); - while (handle != NULL) - { - GetWindowText(handle, windowTitle, STR - 1); - if (strstr(windowTitle, instWindowTitle) != NULL) - { - return handle; - } - else - { - handle = FindWindowEx(NULL, handle, NULL, NULL); - } - } - } - return NULL; -} - -BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam) -{ - DWORD processId; - GetWindowThreadProcessId(hwnd, &processId); - if (processInformation.dwProcessId == processId) - { - LONG styles = GetWindowLong(hwnd, GWL_STYLE); - if ((styles & WS_VISIBLE) != 0) - { - splash = FALSE; - ShowWindow(hWnd, SW_HIDE); - return FALSE; - } - } - return TRUE; -} - -VOID CALLBACK TimerProc( - HWND hwnd, // handle of window for timer messages - UINT uMsg, // WM_TIMER message - UINT idEvent, // timer identifier - DWORD dwTime) // current system time -{ - if (splash) - { - if (splashTimeout == 0) - { - splash = FALSE; - ShowWindow(hWnd, SW_HIDE); - if (waitForWindow && splashTimeoutErr) - { - KillTimer(hwnd, ID_TIMER); - signalError(); - PostQuitMessage(0); - } - } - else - { - splashTimeout -= TIMER_PROC_INTERVAL; - if (waitForWindow) - { - EnumWindows(enumwndfn, 0); - } - } - } - - GetExitCodeProcess(processInformation.hProcess, &dwExitCode); - if (dwExitCode != STILL_ACTIVE - || !(splash || stayAlive)) - { - KillTimer(hWnd, ID_TIMER); - PostQuitMessage(0); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + Sylvain Mina (single instance patch) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#include "../resource.h" +#include "../head.h" +#include "guihead.h" + +extern FILE* hLog; +extern PROCESS_INFORMATION processInformation; + +HWND hWnd; +DWORD dwExitCode = 0; +BOOL stayAlive = FALSE; +BOOL splash = FALSE; +BOOL splashTimeoutErr; +BOOL waitForWindow; +BOOL restartOnCrash = FALSE; +int splashTimeout = DEFAULT_SPLASH_TIMEOUT; + +int APIENTRY WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) +{ + int result = prepare(lpCmdLine, FALSE); + + if (result == ERROR_ALREADY_EXISTS) + { + HWND handle = getInstanceWindow(); + ShowWindow(handle, SW_SHOW); + SetForegroundWindow(handle); + closeLogFile(); + return 2; + } + + if (result != TRUE) + { + signalError(); + return 1; + } + + splash = loadBool(SHOW_SPLASH) + && strstr(lpCmdLine, "--l4j-no-splash") == NULL; + restartOnCrash = loadBool(RESTART_ON_CRASH); + + // if we should restart on crash, we must also stay alive to check for crashes + stayAlive = restartOnCrash || + (loadBool(GUI_HEADER_STAYS_ALIVE) + && strstr(lpCmdLine, "--l4j-dont-wait") == NULL); + + if (splash || stayAlive) + { + hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, "STATIC", "", + WS_POPUP | SS_BITMAP, + 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); + if (splash) + { + char timeout[10] = {0}; + if (loadString(SPLASH_TIMEOUT, timeout)) + { + splashTimeout = atoi(timeout); + if (splashTimeout <= 0 || splashTimeout > MAX_SPLASH_TIMEOUT) + { + splashTimeout = DEFAULT_SPLASH_TIMEOUT; + } + } + splashTimeout = splashTimeout * 1000; // to millis + splashTimeoutErr = loadBool(SPLASH_TIMEOUT_ERR) + && strstr(lpCmdLine, "--l4j-no-splash-err") == NULL; + waitForWindow = loadBool(SPLASH_WAITS_FOR_WINDOW); + HANDLE hImage = LoadImage(hInstance, // handle of the instance containing the image + MAKEINTRESOURCE(SPLASH_BITMAP), // name or identifier of image + IMAGE_BITMAP, // type of image + 0, // desired width + 0, // desired height + LR_DEFAULTSIZE); + if (hImage == NULL) + { + signalError(); + return 1; + } + SendMessage(hWnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hImage); + RECT rect; + GetWindowRect(hWnd, &rect); + int x = (GetSystemMetrics(SM_CXSCREEN) - (rect.right - rect.left)) / 2; + int y = (GetSystemMetrics(SM_CYSCREEN) - (rect.bottom - rect.top)) / 2; + SetWindowPos(hWnd, HWND_TOP, x, y, 0, 0, SWP_NOSIZE); + ShowWindow(hWnd, nCmdShow); + UpdateWindow (hWnd); + } + } + + do + { + if (splash || stayAlive) + { + if (!SetTimer (hWnd, ID_TIMER, TIMER_PROC_INTERVAL, TimerProc)) + { + signalError(); + return 1; + } + } + + if (!execute(FALSE, &dwExitCode)) + { + signalError(); + return 1; + } + + if (!(splash || stayAlive)) + { + debug("Exit code:\t0\n"); + closeProcessHandles(); + closeLogFile(); + return 0; + } + + MSG msg; + while (GetMessage(&msg, NULL, 0, 0)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + if (restartOnCrash && dwExitCode != 0) + { + debug("Exit code:\t%d, restarting the application!\n", dwExitCode); + } + + closeProcessHandles(); + } while (restartOnCrash && dwExitCode != 0); + + debug("Exit code:\t%d\n", dwExitCode); + closeLogFile(); + return dwExitCode; +} + +HWND getInstanceWindow() +{ + char windowTitle[STR]; + char instWindowTitle[STR] = {0}; + if (loadString(INSTANCE_WINDOW_TITLE, instWindowTitle)) + { + HWND handle = FindWindowEx(NULL, NULL, NULL, NULL); + while (handle != NULL) + { + GetWindowText(handle, windowTitle, STR - 1); + if (strstr(windowTitle, instWindowTitle) != NULL) + { + return handle; + } + else + { + handle = FindWindowEx(NULL, handle, NULL, NULL); + } + } + } + return NULL; +} + +BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam) +{ + DWORD processId; + GetWindowThreadProcessId(hwnd, &processId); + if (processInformation.dwProcessId == processId) + { + LONG styles = GetWindowLong(hwnd, GWL_STYLE); + if ((styles & WS_VISIBLE) != 0) + { + splash = FALSE; + ShowWindow(hWnd, SW_HIDE); + return FALSE; + } + } + return TRUE; +} + +VOID CALLBACK TimerProc( + HWND hwnd, // handle of window for timer messages + UINT uMsg, // WM_TIMER message + UINT idEvent, // timer identifier + DWORD dwTime) // current system time +{ + if (splash) + { + if (splashTimeout == 0) + { + splash = FALSE; + ShowWindow(hWnd, SW_HIDE); + if (waitForWindow && splashTimeoutErr) + { + KillTimer(hwnd, ID_TIMER); + signalError(); + PostQuitMessage(0); + } + } + else + { + splashTimeout -= TIMER_PROC_INTERVAL; + if (waitForWindow) + { + EnumWindows(enumwndfn, 0); + } + } + } + + GetExitCodeProcess(processInformation.hProcess, &dwExitCode); + if (dwExitCode != STILL_ACTIVE + || !(splash || stayAlive)) + { + KillTimer(hWnd, ID_TIMER); + PostQuitMessage(0); + } +} diff --git a/launch4j/head_src/guihead/guihead.dev b/launch4j/head_src/guihead/guihead.dev index 7c30088..de4fe97 100644 --- a/launch4j/head_src/guihead/guihead.dev +++ b/launch4j/head_src/guihead/guihead.dev @@ -3,7 +3,7 @@ FileName=guihead.dev Name=guihead UnitCount=5 Type=0 -Ver=1 +Ver=2 ObjFiles= Includes= Libs= @@ -22,12 +22,14 @@ OverrideOutputName=guihead.exe HostApplication= Folders= CommandLine= -UseCustomMakefile=1 +UseCustomMakefile=0 CustomMakefile=Makefile.win IncludeVersionInfo=0 SupportXPThemes=0 CompilerSet=0 -CompilerSettings=0000000001001000000100 +CompilerSettings=000000d000000000000001000 +LogOutput= +LogOutputEnabled=0 [Unit1] FileName=guihead.c @@ -66,6 +68,7 @@ OriginalFilename= ProductName= ProductVersion= AutoIncBuildNr=0 +SyncProduct=0 [Unit4] FileName=..\head.h @@ -95,7 +98,7 @@ Compile=1 Link=1 Priority=1000 OverrideBuildCmd=0 -BuildCmd= +BuildCmd=$(CC) -c head.c -o ../../head/head.o $(CFLAGS) [Unit5] FileName=..\resource.h diff --git a/launch4j/head_src/guihead/guihead.h b/launch4j/head_src/guihead/guihead.h index e8208d3..4732c73 100644 --- a/launch4j/head_src/guihead/guihead.h +++ b/launch4j/head_src/guihead/guihead.h @@ -1,44 +1,44 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#define ID_TIMER 1 -#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */ -#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */ -#define TIMER_PROC_INTERVAL 100 /* interval in ms between calls to EnumWindows */ - -HWND getInstanceWindow(); - -BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam); - -VOID CALLBACK TimerProc( - HWND hwnd, // handle of window for timer messages - UINT uMsg, // WM_TIMER message - UINT idEvent, // timer identifier - DWORD dwTime // current system time -); +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#define ID_TIMER 1 +#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */ +#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */ +#define TIMER_PROC_INTERVAL 100 /* interval in ms between calls to EnumWindows */ + +HWND getInstanceWindow(); + +BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam); + +VOID CALLBACK TimerProc( + HWND hwnd, // handle of window for timer messages + UINT uMsg, // WM_TIMER message + UINT idEvent, // timer identifier + DWORD dwTime // current system time +); diff --git a/launch4j/head_src/head.c b/launch4j/head_src/head.c index bc13caa..62d176a 100644 --- a/launch4j/head_src/head.c +++ b/launch4j/head_src/head.c @@ -2,7 +2,7 @@ Launch4j (http://launch4j.sourceforge.net/) Cross-platform Java application wrapper for creating Windows native executables. - Copyright (c) 2004, 2015 Grzegorz Kowal, + Copyright (c) 2004, 2019 Grzegorz Kowal, Ian Roberts (jdk preference patch) Sylvain Mina (single instance patch) @@ -37,6 +37,7 @@ FILE* hLog; BOOL debugAll = FALSE; BOOL console = FALSE; BOOL wow64 = FALSE; +BOOL jniHeader = FALSE; char oldPwd[_MAX_PATH]; PROCESS_INFORMATION processInformation; @@ -51,16 +52,15 @@ struct struct { - int runtimeBits; int foundJava; - BOOL bundledJreAsFallback; + BOOL requiresJdk; + BOOL requires64Bit; BOOL corruptedJreFound; char originalJavaMinVer[STR]; char originalJavaMaxVer[STR]; char javaMinVer[STR]; char javaMaxVer[STR]; char foundJavaVer[STR]; - char foundJavaKey[_MAX_PATH]; char foundJavaHome[_MAX_PATH]; } search; @@ -71,8 +71,9 @@ struct char args[MAX_ARGS]; } launcher; -BOOL initGlobals() +BOOL initGlobals(BOOL jni) { + jniHeader = jni; hModule = GetModuleHandle(NULL); if (hModule == NULL) @@ -82,9 +83,9 @@ BOOL initGlobals() strcpy(error.title, LAUNCH4j); - search.runtimeBits = INIT_RUNTIME_BITS; - search.foundJava = NO_JAVA_FOUND; - search.bundledJreAsFallback = FALSE; + search.foundJava = JAVA_NOT_FOUND; + search.requiresJdk = FALSE; + search.requires64Bit = FALSE; search.corruptedJreFound = FALSE; return TRUE; @@ -141,7 +142,7 @@ void setWow64Flag() fnIsWow64Process(GetCurrentProcess(), &wow64); } - debug("WOW64:\t\t%s\n", wow64 ? "yes" : "no"); + debug("WOW64:\t\t%s\n", wow64 ? "Yes" : "No"); } void setConsoleFlag() @@ -464,28 +465,23 @@ void regSearch(const char* keyName, const int searchType) debug("Check:\t\t%s\n", fullKeyName); formatJavaVersion(version, originalVersion); - if (strcmp(version, search.javaMinVer) >= 0 - && (!*search.javaMaxVer || strcmp(version, search.javaMaxVer) <= 0) - && strcmp(version, search.foundJavaVer) > 0 - && isJavaHomeValid(fullKeyName, searchType)) + if (isJavaVersionGood(version, wow64KeyMask) + && isRegistryJavaHomeValid(fullKeyName, searchType)) { strcpy(search.foundJavaVer, version); - strcpy(search.foundJavaKey, fullKeyName); search.foundJava = searchType; debug("Match:\t\t%s\n", version); - } - else - { - debug("Ignore:\t\t%s\n", version); + break; } + debug("Ignore:\t\t%s\n", version); versionSize = _MAX_PATH; } RegCloseKey(hKey); } -BOOL isJavaHomeValid(const char* keyName, const int searchType) +BOOL isRegistryJavaHomeValid(const char* keyName, const int searchType) { BOOL valid = FALSE; HKEY hKey; @@ -531,6 +527,7 @@ BOOL isLauncherPathValid(const char* path) { struct _stat statBuf; char launcherPath[_MAX_PATH] = {0}; + char javacPath[_MAX_PATH] = {0}; BOOL result = FALSE; if (*path) @@ -538,6 +535,15 @@ BOOL isLauncherPathValid(const char* path) strcpy(launcherPath, path); appendLauncher(launcherPath); result = _stat(launcherPath, &statBuf) == 0; + debug("Check launcher:\t%s %s\n", launcherPath, result ? "(OK)" : "(not found)"); + + if (result && search.requiresJdk) + { + strcpy(javacPath, path); + appendPath(javacPath, "bin\\javac.exe"); + result = _stat(javacPath, &statBuf) == 0; + debug("Check javac:\t%s %s\n", javacPath, result ? "(OK)" : "(not found)"); + } if (!result) { @@ -546,120 +552,73 @@ BOOL isLauncherPathValid(const char* path) } } - debug("Check launcher:\t%s %s\n", launcherPath, result ? "(OK)" : "(not found)"); return result; } -void regSearchWow(const char* keyName, const int searchType) +void regSearchWow(const char* keyName) { - if (search.runtimeBits == INIT_RUNTIME_BITS) + if (search.foundJava != JAVA_NOT_FOUND) { - search.runtimeBits = loadInt(RUNTIME_BITS); + return; } - switch (search.runtimeBits) + if (wow64 && !jniHeader) { - case USE_64_BIT_RUNTIME: - if (wow64) - { - regSearch(keyName, searchType | KEY_WOW64_64KEY); - } - break; - - case USE_64_AND_32_BIT_RUNTIME: - if (wow64) - { - regSearch(keyName, searchType | KEY_WOW64_64KEY); + regSearch(keyName, JAVA_FOUND | KEY_WOW64_64KEY); - if ((search.foundJava & KEY_WOW64_64KEY) != NO_JAVA_FOUND) - { - break; - } - } + if ((search.foundJava & KEY_WOW64_64KEY) != JAVA_NOT_FOUND) + { + return; + } + } - regSearch(keyName, searchType); - break; - - case USE_32_AND_64_BIT_RUNTIME: - regSearch(keyName, searchType); - - if (search.foundJava != NO_JAVA_FOUND - && (search.foundJava & KEY_WOW64_64KEY) == NO_JAVA_FOUND) - { - break; - } - - if (wow64) - { - regSearch(keyName, searchType | KEY_WOW64_64KEY); - } - break; - - case USE_32_BIT_RUNTIME: - regSearch(keyName, searchType); - break; - - default: - debug("Runtime bits:\tFailed to load.\n"); - break; + if (!search.requires64Bit) + { + regSearch(keyName, JAVA_FOUND); } } -void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName, - const int jdkPreference) +BOOL findRegistryJavaHome(char* path) { - if (jdkPreference == JDK_ONLY || jdkPreference == PREFER_JDK) - { - regSearchWow(sdkKeyName, FOUND_SDK); - if (jdkPreference != JDK_ONLY) - { - regSearchWow(jreKeyName, FOUND_JRE); - } + debugAll("findRegistryJavaHome()\n"); + if (!search.requiresJdk) + { + regSearchWow("SOFTWARE\\JavaSoft\\Java Runtime Environment"); } - else - { - // jdkPreference == JRE_ONLY or PREFER_JRE - regSearchWow(jreKeyName, FOUND_JRE); - if (jdkPreference != JRE_ONLY) - { - regSearchWow(sdkKeyName, FOUND_SDK); - } - } -} - -BOOL findJavaHome(char* path, const int jdkPreference) -{ - debugAll("findJavaHome()\n"); - regSearchJreSdk("SOFTWARE\\JavaSoft\\Java Runtime Environment", - "SOFTWARE\\JavaSoft\\Java Development Kit", - jdkPreference); + regSearchWow("SOFTWARE\\JavaSoft\\Java Development Kit"); // Java 9 support - regSearchJreSdk("SOFTWARE\\JavaSoft\\JRE", - "SOFTWARE\\JavaSoft\\JDK", - jdkPreference); + if (!search.requiresJdk) + { + regSearchWow("SOFTWARE\\JavaSoft\\JRE"); + } + regSearchWow("SOFTWARE\\JavaSoft\\JDK"); // IBM Java 1.8 - if (search.foundJava == NO_JAVA_FOUND) + if (search.foundJava == JAVA_NOT_FOUND) { - regSearchJreSdk("SOFTWARE\\IBM\\Java Runtime Environment", - "SOFTWARE\\IBM\\Java Development Kit", - jdkPreference); + if (!search.requiresJdk) + { + regSearchWow("SOFTWARE\\IBM\\Java Runtime Environment"); + } + regSearchWow("SOFTWARE\\IBM\\Java Development Kit"); } // IBM Java 1.7 and earlier - if (search.foundJava == NO_JAVA_FOUND) + if (search.foundJava == JAVA_NOT_FOUND) { - regSearchJreSdk("SOFTWARE\\IBM\\Java2 Runtime Environment", - "SOFTWARE\\IBM\\Java Development Kit", - jdkPreference); + if (!search.requiresJdk) + { + regSearchWow("SOFTWARE\\IBM\\Java2 Runtime Environment"); + } + regSearchWow("SOFTWARE\\IBM\\Java Development Kit"); } - if (search.foundJava != NO_JAVA_FOUND) + if (search.foundJava != JAVA_NOT_FOUND) { strcpy(path, search.foundJavaHome); debug("Runtime used:\t%s (%s-bit)\n", search.foundJavaVer, - (search.foundJava & KEY_WOW64_64KEY) != NO_JAVA_FOUND ? "64" : "32"); + (search.foundJava & KEY_WOW64_64KEY) != JAVA_NOT_FOUND ? "64" : "32"); return TRUE; } @@ -911,51 +870,90 @@ void setWorkingDirectory(const char *exePath, const int pathLen) } } -BOOL bundledJreSearch(const char *exePath, const int pathLen) +void removeChar(char *src, const char toRemove) { - debugAll("bundledJreSearch()\n"); - char tmpPath[_MAX_PATH] = {0}; - BOOL is64BitJre = loadBool(BUNDLED_JRE_64_BIT); + char* dst = src; - if (!wow64 && is64BitJre) + do + { + if (*src != toRemove) + { + *dst++ = *src; + } + } while (*src++ != 0); +} + +BOOL pathJreSearch(const char *exePath, const int pathLen) +{ + debugAll("pathJreSearch()\n"); + char jrePathSpec[_MAX_PATH] = {0}; + + if (!wow64 && search.requires64Bit) { - debug("Bundled JRE:\tCannot use 64-bit runtime on 32-bit OS.\n"); + debug("JRE:\t\tCannot use 64-bit runtime on 32-bit OS.\n"); return FALSE; } - if (loadString(JRE_PATH, tmpPath)) + if (loadString(JRE_PATH, jrePathSpec)) { char jrePath[MAX_ARGS] = {0}; - expandVars(jrePath, tmpPath, exePath, pathLen); - debug("Bundled JRE:\t%s\n", jrePath); + expandVars(jrePath, jrePathSpec, exePath, pathLen); + debug("JRE paths:\t%s\n", jrePath); + char* path = strtok(jrePath, ";"); + + while (path != NULL) + { + char pathNoBin[_MAX_PATH] = {0}; + char *lastBackslash = strrchr(path, '\\'); + char *lastSlash = strrchr(path, '/'); - if (jrePath[0] == '\\' || jrePath[1] == ':') - { - // Absolute - strcpy(launcher.cmd, jrePath); - } - else - { - // Relative - strncpy(launcher.cmd, exePath, pathLen); - appendPath(launcher.cmd, jrePath); - } + if (lastBackslash != NULL && strcasecmp(lastBackslash, "\\bin") == 0) + { + strncpy(pathNoBin, path, lastBackslash - path); + } + else if (lastSlash != NULL && strcasecmp(lastSlash, "/bin") == 0) + { + strncpy(pathNoBin, path, lastSlash - path); + } + else + { + strcpy(pathNoBin, path); + } + + removeChar(pathNoBin, '"'); - if (isLauncherPathValid(launcher.cmd)) - { - search.foundJava = is64BitJre ? FOUND_BUNDLED | KEY_WOW64_64KEY : FOUND_BUNDLED; - strcpy(search.foundJavaHome, launcher.cmd); - return TRUE; - } + if (*pathNoBin == '\\' || (*pathNoBin != '\0' && *(pathNoBin + 1) == ':')) + { + // Absolute + strcpy(launcher.cmd, pathNoBin); + } + else + { + // Relative + strncpy(launcher.cmd, exePath, pathLen); + launcher.cmd[pathLen] = 0; + appendPath(launcher.cmd, pathNoBin); + } + + BOOL is64Bit; + if (isLauncherPathValid(launcher.cmd) && isPathJavaVersionGood(launcher.cmd, &is64Bit)) + { + search.foundJava = is64Bit ? JAVA_FOUND | KEY_WOW64_64KEY : JAVA_FOUND; + strcpy(search.foundJavaHome, launcher.cmd); + return TRUE; + } + + path = strtok(NULL, ";"); + } } return FALSE; } -BOOL installedJreSearch() +BOOL registryJreSearch() { - debugAll("installedJreSearch()\n"); - return *search.javaMinVer && findJavaHome(launcher.cmd, loadInt(JDK_PREFERENCE)); + debugAll("registryJreSearch()\n"); + return *search.javaMinVer && findRegistryJavaHome(launcher.cmd); } void createJreSearchError() @@ -972,12 +970,9 @@ void createJreSearchError() strcat(error.msg, search.originalJavaMaxVer); } - if (search.runtimeBits == USE_64_BIT_RUNTIME - || search.runtimeBits == USE_32_BIT_RUNTIME) + if (search.requires64Bit) { - strcat(error.msg, " ("); - strcat(error.msg, search.runtimeBits == USE_64_BIT_RUNTIME ? "64" : "32"); - strcat(error.msg, "-bit)"); + strcat(error.msg, " (64-bit)"); } if (search.corruptedJreFound) @@ -995,7 +990,7 @@ void createJreSearchError() } else { - loadString(BUNDLED_JRE_ERR, error.msg); + loadString(JRE_NOT_FOUND_ERR, error.msg); } } @@ -1004,7 +999,10 @@ BOOL jreSearch(const char *exePath, const int pathLen) debugAll("jreSearch()\n"); BOOL result = TRUE; - search.bundledJreAsFallback = loadBool(BUNDLED_JRE_AS_FALLBACK); + search.requiresJdk = loadBool(REQUIRES_JDK); + debug("Requires JDK:\t%s\n", search.requiresJdk ? "Yes" : "No"); + search.requires64Bit = loadBool(REQUIRES_64_BIT); + debug("Requires 64-Bit: %s\n", search.requires64Bit ? "Yes" : "No"); loadString(JAVA_MIN_VER, search.originalJavaMinVer); formatJavaVersion(search.javaMinVer, search.originalJavaMinVer); debug("Java min ver:\t%s\n", search.javaMinVer); @@ -1012,21 +1010,11 @@ BOOL jreSearch(const char *exePath, const int pathLen) formatJavaVersion(search.javaMaxVer, search.originalJavaMaxVer); debug("Java max ver:\t%s\n", search.javaMaxVer); - if (search.bundledJreAsFallback) + if (!pathJreSearch(exePath, pathLen)) { - if (!installedJreSearch()) - { - result = bundledJreSearch(exePath, pathLen); - } + result = registryJreSearch(); } - else - { - if (!bundledJreSearch(exePath, pathLen)) - { - result = installedJreSearch(); - } - } - + if (!result) { createJreSearchError(); @@ -1209,9 +1197,9 @@ void setCommandLineArgs(const char *lpCmdLine) } } -int prepare(const char *lpCmdLine) +int prepare(const char *lpCmdLine, BOOL jni) { - if (!initGlobals()) + if (!initGlobals(jni)) { return FALSE; } @@ -1230,6 +1218,7 @@ int prepare(const char *lpCmdLine) return FALSE; } + debug("JNI:\t\t%s\n", jniHeader ? "Yes" : "No"); setWow64Flag(); // Set default error message, title and optional support web site url. @@ -1333,3 +1322,131 @@ const char* getLauncherArgs() return launcher.args; } +/* read java version output and save version string in version */ +void getVersionFromOutput(HANDLE outputRd, char *version, int versionLen, BOOL *is64Bit) +{ + CHAR chBuf[BIG_STR] = {0}, *bptr = chBuf; + DWORD dwRead, remain = sizeof(chBuf); + BOOL bSuccess = FALSE; + + while (remain > 0) { + bSuccess = ReadFile(outputRd, bptr, remain, &dwRead, NULL); + if (! bSuccess || dwRead == 0) break; + bptr += dwRead; + remain -= dwRead; + } + debugAll("Java version output: %s\n", chBuf); + *version = '\0'; + const char *verStartPtr = strchr(chBuf, '"'); + if (verStartPtr == NULL) + { + debug("Cannot get version string: cannot find quote\n"); + return; + } + const char *verEndPtr = strchr(++verStartPtr, '"'); + if (verEndPtr == NULL) + { + debug("Cannot get version string: missing end quote\n"); + return; + } + size_t len = verEndPtr - verStartPtr; + if (len >= versionLen) { + debug("Cannot get version string: data too large\n"); + return; + } + memcpy(version, verStartPtr, len); + version[len] = '\0'; + *is64Bit = strstr(chBuf, "64-Bit") != NULL || strstr(chBuf, "64-bit") != NULL; +} + +/* create a child process with cmdline and set stderr/stdout to outputWr */ +BOOL CreateChildProcess(char *cmdline, HANDLE outputWr) +{ + PROCESS_INFORMATION piProcInfo; + STARTUPINFO siStartInfo; + BOOL bSuccess = FALSE; + + ZeroMemory(&piProcInfo, sizeof(PROCESS_INFORMATION)); + ZeroMemory(&siStartInfo, sizeof(STARTUPINFO)); + siStartInfo.cb = sizeof(STARTUPINFO); + siStartInfo.hStdError = outputWr; + siStartInfo.hStdOutput = outputWr; + siStartInfo.dwFlags |= STARTF_USESTDHANDLES; + + debugAll("Create process: %s\n", cmdline); + bSuccess = CreateProcess(NULL, cmdline, NULL, NULL, TRUE, CREATE_NO_WINDOW, NULL, NULL, &siStartInfo, &piProcInfo); + if (!bSuccess) + { + debug("Cannot create process %s\n", cmdline); + } + else + { + CloseHandle(piProcInfo.hProcess); + CloseHandle(piProcInfo.hThread); + } + CloseHandle(outputWr); + return bSuccess; +} + +BOOL isJavaVersionGood(const char *version, BOOL is64Bit) +{ + BOOL result = (!*search.javaMinVer || strcmp(version, search.javaMinVer) >= 0) + && (!*search.javaMaxVer || strcmp(version, search.javaMaxVer) <= 0) + && (!search.requires64Bit || is64Bit) + && (!jniHeader || !is64Bit); + debug("Version string: %s / %s-Bit (%s)\n", version, is64Bit ? "64" : "32", result ? "OK" : "Ignore"); + return result; +} + +/* + * Run /bin/java(w) -version. Return TRUE if version is good. + */ +BOOL isPathJavaVersionGood(const char *path, BOOL *is64Bit) +{ + SECURITY_ATTRIBUTES saAttr; + HANDLE outputRd = NULL; + HANDLE outputWr = NULL; + + debugAll("Check Java Version: %s min=%s max=%s\n", path, search.javaMinVer, search.javaMaxVer); + + saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); + saAttr.bInheritHandle = TRUE; + saAttr.lpSecurityDescriptor = NULL; + + // Create a pipe for the child process's STDOUT. + if (!CreatePipe(&outputRd, &outputWr, &saAttr, 0)) + { + debug("Cannot create pipe\n"); + return FALSE; + } + // Ensure the read handle to the pipe for STDOUT is not inherited. + if (!SetHandleInformation(outputRd, HANDLE_FLAG_INHERIT, 0)) + { + debug("Cannot set handle information\n"); + CloseHandle(outputRd); + CloseHandle(outputWr); + return FALSE; + } + // create child process + char cmdline[MAX_ARGS] = {0}; + char launcherPath[_MAX_PATH] = {0}; + strcpy(launcherPath, path); + appendLauncher(launcherPath); + snprintf(cmdline, MAX_ARGS, "\"%s\" -version", launcherPath); + if (!CreateChildProcess(cmdline, outputWr)) + { + debug("Cannot run java(w) -version\n"); + CloseHandle(outputRd); + return FALSE; + } + char version[STR] = {0}, formattedVersion[STR] = {0}; + + getVersionFromOutput(outputRd, version, sizeof(version), is64Bit); + CloseHandle(outputRd); + if (*version != '\0') + { + formatJavaVersion(formattedVersion, version); + return isJavaVersionGood(formattedVersion, *is64Bit); + } + return FALSE; +} diff --git a/launch4j/head_src/head.h b/launch4j/head_src/head.h index 2d56a2d..4986f84 100644 --- a/launch4j/head_src/head.h +++ b/launch4j/head_src/head.h @@ -54,25 +54,12 @@ #include #define LAUNCH4j "Launch4j" -#define VERSION "3.12" +#define VERSION "3.50" #define JRE_VER_MAX_DIGITS_PER_PART 3 -#define NO_JAVA_FOUND 0 -#define FOUND_JRE 1 -#define FOUND_SDK 2 -#define FOUND_BUNDLED 4 - -#define JRE_ONLY 0 -#define PREFER_JRE 1 -#define PREFER_JDK 2 -#define JDK_ONLY 3 - -#define USE_64_BIT_RUNTIME 1 -#define USE_64_AND_32_BIT_RUNTIME 2 -#define USE_32_AND_64_BIT_RUNTIME 3 -#define USE_32_BIT_RUNTIME 4 -#define INIT_RUNTIME_BITS 9 +#define JAVA_NOT_FOUND 0 +#define JAVA_FOUND 1 #define KEY_WOW64_64KEY 0x0100 @@ -97,7 +84,7 @@ typedef void (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); -BOOL initGlobals(); +BOOL initGlobals(BOOL jni); FILE* openLogFile(const char* exePath, const int pathLen); void closeLogFile(); BOOL initializeLogging(const char *lpCmdLine, const char* exePath, const int pathLen); @@ -110,12 +97,10 @@ BOOL regQueryValue(const char* regPath, unsigned char* buffer, unsigned long bufferLength); void formatJavaVersion(char* version, const char* originalVersion); void regSearch(const char* keyName, const int searchType); -BOOL isJavaHomeValid(const char* keyName, const int searchType); +BOOL isRegistryJavaHomeValid(const char* keyName, const int searchType); BOOL isLauncherPathValid(const char* path); -void regSearchWow(const char* keyName, const int searchType); -void regSearchJreSdk(const char* jreKeyName, const char* sdkKeyName, - const int jdkPreference); -BOOL findJavaHome(char* path, const int jdkPreference); +void regSearchWow(const char* keyName); +BOOL findRegistryJavaHome(char* path); int getExePath(char* exePath); void appendPath(char* basepath, const char* path); void appendLauncher(char* jrePath); @@ -127,8 +112,9 @@ void appendHeapSize(char *dst, const int megabytesID, const int percentID, void setJvmOptions(char *jvmOptions, const char *exePath); BOOL createMutex(); void setWorkingDirectory(const char *exePath, const int pathLen); -BOOL bundledJreSearch(const char *exePath, const int pathLen); -BOOL installedJreSearch(); +void removeChar(char *src, const char toRemove); +BOOL pathJreSearch(const char *exePath, const int pathLen); +BOOL registryJreSearch(); void createJreSearchError(); BOOL jreSearch(const char *exePath, const int pathLen); BOOL appendToPathVar(const char* path); @@ -136,11 +122,15 @@ BOOL appendJreBinToPathVar(); void setEnvironmentVariables(const char *exePath, const int pathLen); void setMainClassAndClassPath(const char *exePath, const int pathLen); void setCommandLineArgs(const char *lpCmdLine); -int prepare(const char *lpCmdLine); +int prepare(const char *lpCmdLine, BOOL jni); void closeProcessHandles(); BOOL execute(const BOOL wait, DWORD *dwExitCode); const char* getJavaHome(); const char* getMainClass(); const char* getLauncherArgs(); +void getVersionFromOutput(HANDLE outputRd, char *version, int versionLen, BOOL *is64Bit); +BOOL CreateChildProcess(char *cmdline, HANDLE outputWr); +BOOL isJavaVersionGood(const char* version, BOOL is64Bit); +BOOL isJavaPathVersionGood(const char *path, BOOL *is64Bit); #endif // _LAUNCH4J_HEAD__INCLUDED_ diff --git a/launch4j/head_src/jniconsolehead_BETA/.gitignore b/launch4j/head_src/jniconsolehead_BETA/.gitignore deleted file mode 100644 index 1c252a6..0000000 --- a/launch4j/head_src/jniconsolehead_BETA/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/jniconsolehead.exe -/jniconsolehead.layout diff --git a/launch4j/head_src/jniconsolehead_BETA/Makefile.win b/launch4j/head_src/jniconsolehead_BETA/Makefile.win index b2357ac..7e3d79f 100644 --- a/launch4j/head_src/jniconsolehead_BETA/Makefile.win +++ b/launch4j/head_src/jniconsolehead_BETA/Makefile.win @@ -6,9 +6,9 @@ CC = gcc.exe WINDRES = windres.exe OBJ = ../../head_jni_BETA/jniconsolehead.o ../../head_jni_BETA/head.o ../../head_jni_BETA/jnihead.o LINKOBJ = ../../head_jni_BETA/jniconsolehead.o ../../head_jni_BETA/head.o ../../head_jni_BETA/jnihead.o -LIBS = -L"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib" -L"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -n -s -INCS = -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include/win32" -CXXINCS = -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" -I"C:/Program Files (x86)/Java/jdk 1.4/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include/win32" +LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -n -s +INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include/win32" +CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include/win32" BIN = jniconsolehead.exe CXXFLAGS = $(CXXINCS) -Os CFLAGS = $(INCS) -Os diff --git a/launch4j/head_src/jniconsolehead_BETA/jniconsolehead.c b/launch4j/head_src/jniconsolehead_BETA/jniconsolehead.c index 0e7f6dd..22261ef 100644 --- a/launch4j/head_src/jniconsolehead_BETA/jniconsolehead.c +++ b/launch4j/head_src/jniconsolehead_BETA/jniconsolehead.c @@ -56,7 +56,7 @@ int main(int argc, char* argv[]) cmdLine = ""; } - int result = prepare(cmdLine); + int result = prepare(cmdLine, TRUE); if (result == ERROR_ALREADY_EXISTS) { diff --git a/launch4j/head_src/jniconsolehead_BETA/jniconsolehead.dev b/launch4j/head_src/jniconsolehead_BETA/jniconsolehead.dev index 0b585a5..2bfbe14 100644 --- a/launch4j/head_src/jniconsolehead_BETA/jniconsolehead.dev +++ b/launch4j/head_src/jniconsolehead_BETA/jniconsolehead.dev @@ -5,7 +5,7 @@ UnitCount=6 Type=1 Ver=2 ObjFiles= -Includes="C:\Program Files (x86)\Java\jdk 1.4\include";"C:\Program Files (x86)\Java\jdk 1.4\include\win32" +Includes="c:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\include";"c:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\include\win32" Libs= PrivateResource= ResourceIncludes= diff --git a/launch4j/head_src/jniguihead_BETA/.gitignore b/launch4j/head_src/jniguihead_BETA/.gitignore deleted file mode 100644 index 033e91b..0000000 --- a/launch4j/head_src/jniguihead_BETA/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/jniguihead.exe -/jniguihead.layout diff --git a/launch4j/head_src/jniguihead_BETA/Makefile.win b/launch4j/head_src/jniguihead_BETA/Makefile.win index 8bdac72..ed48593 100644 --- a/launch4j/head_src/jniguihead_BETA/Makefile.win +++ b/launch4j/head_src/jniguihead_BETA/Makefile.win @@ -6,9 +6,9 @@ CC = gcc.exe WINDRES = windres.exe OBJ = ../../head_jni_BETA/jniguihead.o ../../head_jni_BETA/head.o ../../head_jni_BETA/jnihead.o LINKOBJ = ../../head_jni_BETA/jniguihead.o ../../head_jni_BETA/head.o ../../head_jni_BETA/jnihead.o -LIBS = -L"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib" -L"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -mwindows -n -s -INCS = -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include/win32" -CXXINCS = -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/mingw32/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Users/GMan/Dev-Cpp 5.7.1/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" -I"C:/Program Files (x86)/Java/jdk 1.4/include" -I"C:/Program Files (x86)/Java/jdk 1.4/include/win32" +LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -mwindows -n -s +INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include/win32" +CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include" -I"c:/Program Files/AdoptOpenJDK/jdk-8.0.282.8-hotspot/include/win32" BIN = jniguihead.exe CXXFLAGS = $(CXXINCS) -Os CFLAGS = $(INCS) -Os diff --git a/launch4j/head_src/jniguihead_BETA/jniguihead.c b/launch4j/head_src/jniguihead_BETA/jniguihead.c index 0259a27..9551404 100644 --- a/launch4j/head_src/jniguihead_BETA/jniguihead.c +++ b/launch4j/head_src/jniguihead_BETA/jniguihead.c @@ -50,7 +50,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow) { - int result = prepare(lpCmdLine); + int result = prepare(lpCmdLine, TRUE); if (result == ERROR_ALREADY_EXISTS) { diff --git a/launch4j/head_src/jniguihead_BETA/jniguihead.dev b/launch4j/head_src/jniguihead_BETA/jniguihead.dev index a2667ed..4dfbfb2 100644 --- a/launch4j/head_src/jniguihead_BETA/jniguihead.dev +++ b/launch4j/head_src/jniguihead_BETA/jniguihead.dev @@ -5,7 +5,7 @@ UnitCount=7 Type=0 Ver=2 ObjFiles= -Includes="C:\Program Files (x86)\Java\jdk 1.4\include";"C:\Program Files (x86)\Java\jdk 1.4\include\win32" +Includes="c:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\include";"c:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\include\win32" Libs= PrivateResource= ResourceIncludes= diff --git a/launch4j/head_src/jniguihead_BETA/jniguihead.h b/launch4j/head_src/jniguihead_BETA/jniguihead.h index ebef396..2fc71e3 100644 --- a/launch4j/head_src/jniguihead_BETA/jniguihead.h +++ b/launch4j/head_src/jniguihead_BETA/jniguihead.h @@ -1,43 +1,43 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2007 Grzegorz Kowal - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -#define ID_TIMER 1 -#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */ -#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */ - -HWND getInstanceWindow(); - -BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam); - -VOID CALLBACK TimerProc( - HWND hwnd, // handle of window for timer messages - UINT uMsg, // WM_TIMER message - UINT idEvent, // timer identifier - DWORD dwTime // current system time -); +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2007 Grzegorz Kowal + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +#define ID_TIMER 1 +#define DEFAULT_SPLASH_TIMEOUT 60 /* 60 seconds */ +#define MAX_SPLASH_TIMEOUT 60 * 15 /* 15 minutes */ + +HWND getInstanceWindow(); + +BOOL CALLBACK enumwndfn(HWND hwnd, LPARAM lParam); + +VOID CALLBACK TimerProc( + HWND hwnd, // handle of window for timer messages + UINT uMsg, // WM_TIMER message + UINT idEvent, // timer identifier + DWORD dwTime // current system time +); diff --git a/launch4j/head_src/makefile b/launch4j/head_src/makefile new file mode 100644 index 0000000..1220bb5 --- /dev/null +++ b/launch4j/head_src/makefile @@ -0,0 +1,13 @@ +MAKE = mingw32-make.exe + +all: + $(MAKE) -C guihead -f Makefile.win all + $(MAKE) -C consolehead -f Makefile.win all + $(MAKE) -C jniguihead_BETA -f Makefile.win all + $(MAKE) -C jniconsolehead_BETA -f Makefile.win all + +clean: + $(MAKE) -C guihead -f Makefile.win clean + $(MAKE) -C consolehead -f Makefile.win clean + $(MAKE) -C jniguihead_BETA -f Makefile.win clean + $(MAKE) -C jniconsolehead_BETA -f Makefile.win clean diff --git a/launch4j/head_src/resource.h b/launch4j/head_src/resource.h index 829923d..cf53579 100644 --- a/launch4j/head_src/resource.h +++ b/launch4j/head_src/resource.h @@ -1,75 +1,72 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2014 Grzegorz Kowal - Ian Roberts (jdk preference patch) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - Except as contained in this notice, the name(s) of the above copyright holders - shall not be used in advertising or otherwise to promote the sale, use or other - dealings in this Software without prior written authorization. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. -*/ - -// ICON -#define APP_ICON 1 - -// BITMAP -#define SPLASH_BITMAP 1 - -// RCDATA -#define JRE_PATH 1 -#define JAVA_MIN_VER 2 -#define JAVA_MAX_VER 3 -#define SHOW_SPLASH 4 -#define SPLASH_WAITS_FOR_WINDOW 5 -#define SPLASH_TIMEOUT 6 -#define SPLASH_TIMEOUT_ERR 7 -#define CHDIR 8 -#define SET_PROC_NAME 9 -#define ERR_TITLE 10 -#define GUI_HEADER_STAYS_ALIVE 11 -#define JVM_OPTIONS 12 -#define CMD_LINE 13 -#define JAR 14 -#define MAIN_CLASS 15 -#define CLASSPATH 16 -#define WRAPPER 17 -#define JDK_PREFERENCE 18 -#define ENV_VARIABLES 19 -#define PRIORITY_CLASS 20 -#define DOWNLOAD_URL 21 -#define SUPPORT_URL 22 -#define MUTEX_NAME 23 -#define INSTANCE_WINDOW_TITLE 24 -#define INITIAL_HEAP_SIZE 25 -#define INITIAL_HEAP_PERCENT 26 -#define MAX_HEAP_SIZE 27 -#define MAX_HEAP_PERCENT 28 -#define BUNDLED_JRE_64_BIT 29 -#define RUNTIME_BITS 30 -#define RESTART_ON_CRASH 31 -#define BUNDLED_JRE_AS_FALLBACK 32 - -#define STARTUP_ERR 101 -#define BUNDLED_JRE_ERR 102 -#define JRE_VERSION_ERR 103 -#define LAUNCHER_ERR 104 -#define INSTANCE_ALREADY_EXISTS_MSG 105 +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2014 Grzegorz Kowal + Ian Roberts (jdk preference patch) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + Except as contained in this notice, the name(s) of the above copyright holders + shall not be used in advertising or otherwise to promote the sale, use or other + dealings in this Software without prior written authorization. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +// ICON +#define APP_ICON 1 + +// BITMAP +#define SPLASH_BITMAP 1 + +// RCDATA +#define JRE_PATH 1 +#define JAVA_MIN_VER 2 +#define JAVA_MAX_VER 3 +#define SHOW_SPLASH 4 +#define SPLASH_WAITS_FOR_WINDOW 5 +#define SPLASH_TIMEOUT 6 +#define SPLASH_TIMEOUT_ERR 7 +#define CHDIR 8 +#define ERR_TITLE 10 +#define GUI_HEADER_STAYS_ALIVE 11 +#define JVM_OPTIONS 12 +#define CMD_LINE 13 +#define JAR 14 +#define MAIN_CLASS 15 +#define CLASSPATH 16 +#define WRAPPER 17 +#define REQUIRES_JDK 18 +#define ENV_VARIABLES 19 +#define PRIORITY_CLASS 20 +#define DOWNLOAD_URL 21 +#define SUPPORT_URL 22 +#define MUTEX_NAME 23 +#define INSTANCE_WINDOW_TITLE 24 +#define INITIAL_HEAP_SIZE 25 +#define INITIAL_HEAP_PERCENT 26 +#define MAX_HEAP_SIZE 27 +#define MAX_HEAP_PERCENT 28 +#define REQUIRES_64_BIT 29 +#define RESTART_ON_CRASH 31 + +#define STARTUP_ERR 101 +#define JRE_NOT_FOUND_ERR 102 +#define JRE_VERSION_ERR 103 +#define LAUNCHER_ERR 104 +#define INSTANCE_ALREADY_EXISTS_MSG 105 diff --git a/launch4j/launch4j b/launch4j/launch4j index 7d65191..6bb71fd 100755 --- a/launch4j/launch4j +++ b/launch4j/launch4j @@ -1,7 +1,7 @@ -#!/bin/sh -LAUNCH4J="$(dirname "$0")"/launch4j.jar -if [ -n "$JAVA_HOME" ]; then - $JAVA_HOME/bin/java -jar "$LAUNCH4J" "$@" -else - java -jar "$LAUNCH4J" "$@" -fi +#!/bin/sh +LAUNCH4J="$(dirname "$0")"/launch4j.jar +if [ -n "$JAVA_HOME" ]; then + $JAVA_HOME/bin/java -jar "$LAUNCH4J" "$@" +else + java -jar "$LAUNCH4J" "$@" +fi diff --git a/launch4j/launch4j.jar b/launch4j/launch4j.jar index 722e53d..edbbb1a 100644 --- a/launch4j/launch4j.jar +++ b/launch4j/launch4j.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a69034740a0d8973cd65750cd690226146b217f402489d00111d5f2e7610d17 -size 199603 +oid sha256:c82fa95a0584dfb61fbae57966ad5ef37739158254faf4961173e81900574d8b +size 196743 diff --git a/launch4j/launch4jc b/launch4j/launch4jc new file mode 100755 index 0000000..e862c35 --- /dev/null +++ b/launch4j/launch4jc @@ -0,0 +1,8 @@ +#!/bin/sh +LAUNCH4J="$(dirname "$0")"/launch4j.jar +if [ -n "$JAVA_HOME" ]; then + $JAVA_HOME/bin/java -Djava.awt.headless=true -jar "$LAUNCH4J" "$@" +else + java -Djava.awt.headless=true -jar "$LAUNCH4J" "$@" +fi + diff --git a/launch4j/lib/JGoodies.Looks.LICENSE.txt b/launch4j/lib/JGoodies.Looks.LICENSE.txt deleted file mode 100644 index a70977e..0000000 --- a/launch4j/lib/JGoodies.Looks.LICENSE.txt +++ /dev/null @@ -1,31 +0,0 @@ - - The BSD License for the JGoodies Looks - ====================================== - -Copyright (c) 2001-2014 JGoodies Software GmbH. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - o Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - o Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - o Neither the name of JGoodies Software GmbH nor the names of - its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt b/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt index b1e3f5a..cbee875 100644 --- a/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt +++ b/launch4j/lib/Nuvola.Icon.Theme.LICENSE.txt @@ -1,504 +1,504 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/launch4j/lib/XStream.LICENSE.txt b/launch4j/lib/XStream.LICENSE.txt index 4848b3e..96047d8 100644 --- a/launch4j/lib/XStream.LICENSE.txt +++ b/launch4j/lib/XStream.LICENSE.txt @@ -1,27 +1,28 @@ -(BSD Style License) - -Copyright (c) 2003-2004, Joe Walnes -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list of -conditions and the following disclaimer. Redistributions in binary form must reproduce -the above copyright notice, this list of conditions and the following disclaimer in -the documentation and/or other materials provided with the distribution. - -Neither the name of XStream nor the names of its contributors may be used to endorse -or promote products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY -WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. +(BSD Style License) + +Copyright (c) 2003-2006, Joe Walnes +Copyright (c) 2006-2019, XStream Committers +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. Redistributions in binary form must reproduce +the above copyright notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the distribution. + +Neither the name of XStream nor the names of its contributors may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. diff --git a/launch4j/lib/ant.LICENSE.txt b/launch4j/lib/ant.LICENSE.txt index 261eeb9..29f81d8 100644 --- a/launch4j/lib/ant.LICENSE.txt +++ b/launch4j/lib/ant.LICENSE.txt @@ -1,201 +1,201 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/launch4j/lib/ant.jar b/launch4j/lib/ant.jar index bb35823..cc9ff6a 100644 --- a/launch4j/lib/ant.jar +++ b/launch4j/lib/ant.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2a0a134303854e52e39baf14547305ba259c35849704095041684720a563a65a -size 1927228 +oid sha256:0715478af585ea80a18985613ebecdc7922122d45b2c3c970ff9b352cddb75fc +size 2276652 diff --git a/launch4j/lib/commons-beanutils.jar b/launch4j/lib/commons-beanutils.jar index ba49450..a9685df 100644 --- a/launch4j/lib/commons-beanutils.jar +++ b/launch4j/lib/commons-beanutils.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24bcaa20ccbdc7c856ce0c0aea144566943403e2e9f27bd9779cda1d76823ef4 -size 188671 +oid sha256:7d938c81789028045c08c065e94be75fc280527620d5bd62b519d5838532368a +size 246918 diff --git a/launch4j/lib/commons.LICENSE.txt b/launch4j/lib/commons.LICENSE.txt index fdb6475..75b5248 100644 --- a/launch4j/lib/commons.LICENSE.txt +++ b/launch4j/lib/commons.LICENSE.txt @@ -1,50 +1,202 @@ -/* - ============================================================================ - The Apache Software License, Version 1.1 - ============================================================================ - - Copyright (C) @year@ The Apache Software Foundation. All rights reserved. - - Redistribution and use in source and binary forms, with or without modifica- - tion, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. The end-user documentation included with the redistribution, if any, must - include the following acknowledgment: "This product includes software - developed by the Apache Software Foundation (http://www.apache.org/)." - Alternately, this acknowledgment may appear in the software itself, if - and wherever such third-party acknowledgments normally appear. - - 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be - used to endorse or promote products derived from this software without - prior written permission. For written permission, please contact - apache@apache.org. - - 5. Products derived from this software may not be called "Apache", nor may - "Apache" appear in their name, without prior written permission of the - Apache Software Foundation. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- - DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - This software consists of voluntary contributions made by many individuals - on behalf of the Apache Software Foundation and was originally created by - Stefano Mazzocchi . For more information on the Apache - Software Foundation, please see . - -*/ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/launch4j/lib/flatlaf.LICENSE.txt b/launch4j/lib/flatlaf.LICENSE.txt new file mode 100644 index 0000000..29f81d8 --- /dev/null +++ b/launch4j/lib/flatlaf.LICENSE.txt @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/launch4j/lib/flatlaf.jar b/launch4j/lib/flatlaf.jar new file mode 100644 index 0000000..418eb92 --- /dev/null +++ b/launch4j/lib/flatlaf.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:135d8d5ac39fec29d9b3ff52cb30726d3f976b0698615be32534fd7924f29ec7 +size 497932 diff --git a/launch4j/lib/foxtrot.LICENSE.txt b/launch4j/lib/foxtrot.LICENSE.txt deleted file mode 100644 index 5fa4019..0000000 --- a/launch4j/lib/foxtrot.LICENSE.txt +++ /dev/null @@ -1,25 +0,0 @@ -Copyright (c) 2002, Simone Bordet & Marco Cravero -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - - Neither the name of Foxtrot nor the names of the contributors may be used - to endorse or promote products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/launch4j/lib/foxtrot.jar b/launch4j/lib/foxtrot.jar deleted file mode 100644 index 0460567..0000000 --- a/launch4j/lib/foxtrot.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4cdce2f57b9679040b37c65ab6d4196a3c8e30c8dc9a59c126bce7b543a32eeb -size 25676 diff --git a/launch4j/lib/jgoodies-looks.jar b/launch4j/lib/jgoodies-looks.jar deleted file mode 100644 index 177ee47..0000000 --- a/launch4j/lib/jgoodies-looks.jar +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:536fb1e76cf49c76ca336368b1d133294bc48358be6fc5160087a60d38599227 -size 401436 diff --git a/launch4j/lib/xstream.jar b/launch4j/lib/xstream.jar index 47f526a..806d226 100644 --- a/launch4j/lib/xstream.jar +++ b/launch4j/lib/xstream.jar @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:81bc96cd5de2519bac50b8a7d13e6cb52d81315c576dc4304817089eb8bde934 -size 261710 +oid sha256:3277849961aa9eb055f8771810450086d38cc2e407eeb8346d0239ea0218a453 +size 627848 diff --git a/launch4j/manifest/uac.exe.manifest b/launch4j/manifest/uac.exe.manifest index 3041fbc..7b29e98 100644 --- a/launch4j/manifest/uac.exe.manifest +++ b/launch4j/manifest/uac.exe.manifest @@ -1,12 +1,12 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/launch4j/maven/.classpath b/launch4j/maven/.classpath index 9f62fb5..dce4d96 100644 --- a/launch4j/maven/.classpath +++ b/launch4j/maven/.classpath @@ -1,24 +1,24 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/launch4j/maven/assembly/assemble-dist.xml b/launch4j/maven/assembly/assemble-dist.xml index 20f2c17..27c6f27 100644 --- a/launch4j/maven/assembly/assemble-dist.xml +++ b/launch4j/maven/assembly/assemble-dist.xml @@ -1,14 +1,14 @@ - - distribution-libs - - dir - - false - - - - false - - + + distribution-libs + + dir + + false + + + + false + + \ No newline at end of file diff --git a/launch4j/maven/assembly/assemble-linux.xml b/launch4j/maven/assembly/assemble-linux.xml index 94d4cf9..d199505 100644 --- a/launch4j/maven/assembly/assemble-linux.xml +++ b/launch4j/maven/assembly/assemble-linux.xml @@ -1,53 +1,53 @@ - - - - workdir-linux - - jar - - false - - - bin/bin-linux - ${finalName}-workdir-linux/bin - - - ${finalName}-workdir-linux - - w32api/**/* - w32api_jni/**/* - head/**/* - head_jni_BETA/**/* - - - - + + + + workdir-linux + + jar + + false + + + bin/bin-linux + ${finalName}-workdir-linux/bin + + + ${finalName}-workdir-linux + + w32api/**/* + w32api_jni/**/* + head/**/* + head_jni_BETA/**/* + + + + diff --git a/launch4j/maven/assembly/assemble-linux64.xml b/launch4j/maven/assembly/assemble-linux64.xml index d116be7..aae7cba 100644 --- a/launch4j/maven/assembly/assemble-linux64.xml +++ b/launch4j/maven/assembly/assemble-linux64.xml @@ -1,53 +1,53 @@ - - - - workdir-linux64 - - jar - - false - - - bin/bin-linux64 - ${finalName}-workdir-linux64/bin - - - ${finalName}-workdir-linux64 - - w32api/**/* - w32api_jni/**/* - head/**/* - head_jni_BETA/**/* - - - - + + + + workdir-linux64 + + jar + + false + + + bin/bin-linux64 + ${finalName}-workdir-linux64/bin + + + ${finalName}-workdir-linux64 + + w32api/**/* + w32api_jni/**/* + head/**/* + head_jni_BETA/**/* + + + + diff --git a/launch4j/maven/assembly/assemble-mac.xml b/launch4j/maven/assembly/assemble-mac.xml index e813f72..db73176 100644 --- a/launch4j/maven/assembly/assemble-mac.xml +++ b/launch4j/maven/assembly/assemble-mac.xml @@ -1,53 +1,53 @@ - - - - workdir-mac - - jar - - false - - - bin/bin-macosx-x86 - ${finalName}-workdir-mac/bin - - - ${finalName}-workdir-mac - - w32api/**/* - w32api_jni/**/* - head/**/* - head_jni_BETA/**/* - - - - + + + + workdir-mac + + jar + + false + + + bin/bin-macosx-x86 + ${finalName}-workdir-mac/bin + + + ${finalName}-workdir-mac + + w32api/**/* + w32api_jni/**/* + head/**/* + head_jni_BETA/**/* + + + + diff --git a/launch4j/maven/assembly/assemble-win32.xml b/launch4j/maven/assembly/assemble-win32.xml index 4680f89..e5ab6b5 100644 --- a/launch4j/maven/assembly/assemble-win32.xml +++ b/launch4j/maven/assembly/assemble-win32.xml @@ -1,53 +1,53 @@ - - - - workdir-win32 - - jar - - false - - - bin/bin-win32 - ${finalName}-workdir-win32/bin - - - ${finalName}-workdir-win32 - - w32api/**/* - w32api_jni/**/* - head/**/* - head_jni_BETA/**/* - - - - + + + + workdir-win32 + + jar + + false + + + bin/bin-win32 + ${finalName}-workdir-win32/bin + + + ${finalName}-workdir-win32 + + w32api/**/* + w32api_jni/**/* + head/**/* + head_jni_BETA/**/* + + + + diff --git a/launch4j/maven/assembly/src.xml b/launch4j/maven/assembly/src.xml index c930835..5da8fc6 100644 --- a/launch4j/maven/assembly/src.xml +++ b/launch4j/maven/assembly/src.xml @@ -1,55 +1,55 @@ - - - - src - - tar.gz - zip - - - - - README* - LICENSE* - NOTICE* - TODO - pom.xml - - - - src - - **/.*.swp - - - - + + + + src + + tar.gz + zip + + + + + README* + LICENSE* + NOTICE* + TODO + pom.xml + + + + src + + **/.*.swp + + + + diff --git a/launch4j/maven/maven-readme.txt b/launch4j/maven/maven-readme.txt index c977ad8..0ce83de 100644 --- a/launch4j/maven/maven-readme.txt +++ b/launch4j/maven/maven-readme.txt @@ -1,8 +1,8 @@ -Run once the Ant target switch-to-maven, it will reconfigure the project to use maven. - -*** Creation of Distribution Release *** -Windows: mvn -P dist,win32 clean package - -Linux: mvn -P dist,linux clean package - -MacOsX: mvn -P dist,macosx-x86 clean package +Run once the Ant target switch-to-maven, it will reconfigure the project to use maven. + +*** Creation of Distribution Release *** +Windows: mvn -P dist,win32 clean package + +Linux: mvn -P dist,linux clean package + +MacOsX: mvn -P dist,macosx-x86 clean package diff --git a/launch4j/maven/pom.xml b/launch4j/maven/pom.xml index e53dd05..5347600 100644 --- a/launch4j/maven/pom.xml +++ b/launch4j/maven/pom.xml @@ -1,4 +1,5 @@ - 4.0.0 net.sf.launch4j @@ -115,11 +116,6 @@ - - foxtrot - foxtrot - 2.0 - com.jgoodies jgoodies-common @@ -131,9 +127,9 @@ 1.2.1 - com.jgoodies - looks - 2.2.2 + com.formdev + flatlaf + 1.0 com.thoughtworks.xstream @@ -143,7 +139,7 @@ org.apache.ant ant - 1.9.15 + 1.10.9 @@ -161,10 +157,10 @@ maven-compiler-plugin - 3.1 + 3.8.1 - 1.6 - 1.6 + 1.8 + 1.8 @@ -321,7 +317,10 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9.1 + 3.2.0 + + none + attach-javadocs @@ -381,12 +380,12 @@ bin-win32 - + com.akathist.maven.plugins.launch4j launch4j-maven-plugin - 1.6 + 1.7.25 launch4j @@ -404,7 +403,7 @@ false - 1.6.0 + 1.8.0 ${versionNumber} @@ -427,7 +426,7 @@ - dist + dist @@ -435,7 +434,7 @@ maven-clean-plugin 2.6 - + ${basedir}/bin @@ -450,7 +449,7 @@ launch4j.exe - + ${basedir} @@ -505,8 +504,8 @@ - - + + - + \ No newline at end of file diff --git a/launch4j/sign4j/README.txt b/launch4j/sign4j/README.txt deleted file mode 100644 index a05b644..0000000 --- a/launch4j/sign4j/README.txt +++ /dev/null @@ -1,18 +0,0 @@ -sign4j version 3.0 ------------------- - -sign4j is a very simple utility to digitally sign executables containing an appended jar file, like those created by launch4j. - -It works by first signing a temporary file to detect the size of the applied signature, and by then adding that size to a counter in the ZIP_END_HEADER of the embedded jar, so as to pretend that the signature is a comment belonging to it. That way the jar remains formally correct, and java accepts it. - -This manipulation must be done atomically with the signing process, because doing it before would invalidate the jar file, while doing it later would break the signature. That's why the whole command line of your signing tool must be passed to sign4j, which will do the job. - -Any signing tool can be used, as long as the name of the output file can be recognized among its parameters. This is currently done by either using an -out option if present, or taking the last filename with an exe suffix after all supplied options. - -If the involved tool is able to remove a previous signature before adding the new one (as is normally the case) the initial test can be performed on the target executable itself, avoiding the creation of a temporary file. You can use the option --onthespot to signal that to sign4j. - -The option --strict can be used to suppress the use of double quotes around parameters that strictly don't need them. The option --verbose shows diagnostics about intermediary steps of the process. - -This utility can also be used to sign normal executables, but then it will remember you that the file can be signed directly. - -Please send comments to bramfeld@diogen.de diff --git a/launch4j/sign4j/sign4j.c b/launch4j/sign4j/sign4j.c deleted file mode 100644 index 4918011..0000000 --- a/launch4j/sign4j/sign4j.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - sign4j.c: a simple utility to sign executables created by Launch4j - - Copyright (c) 2012 Servoy - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include -#include -#include -#ifdef _WIN32 -#include -#include -#else -#include -#include -#endif -#include -#include - -#define ZIP_END_HEADER "\x50\x4B\x05\x06" -#define END_HEADER_SIZE 22 -#define MAX_COMMENT_SIZE 0xFFFF -#define SWAP_BLOCK_SIZE (4 * 1024 * 1024) -#define TEST_FILE_NAME "sign4j_temporary.exe" -#define SIGN4J_VERSION "3.0" - -#ifndef _WIN32 -#define O_BINARY 0 -#define _O_SHORT_LIVED 0 -#define _S_IREAD S_IREAD -#define _S_IWRITE S_IWRITE -#define stricmp strcasecmp -#endif - -typedef unsigned char byte; - -char command[4096]; -byte* image = 0; - -void usage (void); -void quit (int rsn); -void clear (void); - -int main (int argc, char* argv[]) -{ - char bfr[2]; - char* inf; - char* outf; - char* trg; - byte* lmt; - long lng, ext, off, blck, sgm; - int fd, td; - int fnd, spt, unq, vrb, qts, cmn; - int i, j, n; - byte* p; - - inf = outf = 0, fnd = spt = unq = vrb = 0; - for (i = 1; i < argc && argv[i][0] == '-'; i++) - if (! strcmp (argv[i], "--onthespot")) - spt = 1; - else if (! strcmp (argv[i], "--strict")) - unq = 1; - else if (! strcmp (argv[i], "--verbose")) - vrb = 1; - j = i; - for (i = j + 1; i < argc; i++) - if (! strcmp (argv[i], "-in") && i < argc - 1) - inf = argv[++i], fnd = 1; - else if (! strcmp (argv[i], "-out") && i < argc - 1) - outf = argv[++i], fnd = 1; - else if (argv[i][0] == '-' || (argv[i][0] == '/' && strlen (argv[i]) < 5)) - (! fnd ? (inf = outf = 0) : 0); - else if (! fnd && (n = strlen (argv[i])) > 4 && ! stricmp (argv[i] + n - 4, ".exe")) - inf = outf = argv[i]; - if (! inf || ! outf) - usage (); - atexit (clear); - - if ((fd = open (inf, O_RDONLY | O_BINARY)) < 0) - quit (1); - if ((lng = lseek (fd, 0, SEEK_END)) < 0) - quit (2); - blck = (lng > SWAP_BLOCK_SIZE ? SWAP_BLOCK_SIZE : lng); - if (! (image = (byte*) malloc (blck))) - quit (4); - sgm = (blck > END_HEADER_SIZE + MAX_COMMENT_SIZE ? END_HEADER_SIZE + MAX_COMMENT_SIZE : blck); - if (lseek (fd, -sgm, SEEK_END) < 0 || read (fd, image, sgm) != sgm) - quit (2); - for (p = image + sgm - END_HEADER_SIZE; p > image; p--) - if (! memcmp (p, ZIP_END_HEADER, 4) && ((p[END_HEADER_SIZE - 1] << 8) | p[END_HEADER_SIZE - 2]) == (image + sgm) - (p + END_HEADER_SIZE)) - break; - if (p > image) - { - off = lng - ((image + sgm) - (p + END_HEADER_SIZE - 2)); - cmn = (p[END_HEADER_SIZE - 1] << 8) | p[END_HEADER_SIZE - 2]; - - if (! spt && (inf == outf || ! strcmp (inf, outf))) - { - printf ("Making temporary file\n"); - if ((td = open (TEST_FILE_NAME, O_CREAT | _O_SHORT_LIVED | O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE)) < 0) - quit (5); - if (lseek (fd, 0, SEEK_SET) < 0) - quit (2); - for (ext = lng; ext > 0; ext -= blck) - { - sgm = (ext > blck ? blck : ext); - if (read (fd, image, sgm) != sgm || write (td, image, sgm) != sgm) - quit (6); - } - close (td); - trg = TEST_FILE_NAME; - } - else - trg = outf; - close (fd); - -#ifdef _WIN32 - strcpy (command, "\" "); -#else - strcpy (command, ""); -#endif - - for (i = j; i < argc; i++) - { - p = (argv[i] == outf ? trg : argv[i]); - qts = (! unq || strchr (p, 32)); - if (qts) - strcat (command, "\""); - strcat (command, p); - if (qts) - strcat (command, "\""); - strcat (command, " "); - } - -#ifdef _WIN32 - strcat (command, "\""); -#endif - - if (! vrb) -#ifdef _WIN32 - strcat (command, " > NUL"); -#else - strcat (command, " > /dev/null"); -#endif - - system (command); - - if ((td = open (trg, O_RDONLY | O_BINARY)) < 0) - quit (7); - if ((ext = lseek (td, 0, SEEK_END)) < 0) - quit (7); - close (td); - if ((cmn += ext - lng) < 0 || cmn > MAX_COMMENT_SIZE) - quit (8); - - if ((fd = open (inf, O_WRONLY | O_BINARY)) < 0) - quit (1); - if (lseek (fd, off, SEEK_SET) < 0) - quit (3); - bfr[0] = cmn & 0xFF; - bfr[1] = (cmn >> 8) & 0xFF; - if (write (fd, bfr, 2) != 2) - quit (3); - close (fd); - } - else - { - close (fd); - printf ("You don't need sign4j to sign this file\n"); - } - -#ifdef _WIN32 - strcpy (command, "\" "); -#else - strcpy (command, ""); -#endif - - for (i = j; i < argc; i++) - { - p = argv[i]; - qts = (! unq || strchr (p, 32)); - if (qts) - strcat (command, "\""); - strcat (command, p); - if (qts) - strcat (command, "\""); - strcat (command, " "); - } - -#ifdef _WIN32 - strcat (command, "\""); -#endif - - return system (command); -} - - -void usage () -{ - printf ("\nThis is sign4j version " SIGN4J_VERSION "\n\n"); - printf ("Usage: sign4j [options] \n\n"); - printf (" * options:\n"); - printf (" --onthespot avoid the creation of a temporary file (your tool must be able to sign twice)\n"); - printf (" --strict supress the use of double quotes around parameters that strictly don't need them\n"); - printf (" --verbose show diagnostics about intermediary steps of the process\n"); - printf (" * arguments must specify verbatim the command line for your signing tool\n"); - printf (" * only one file can be signed on each invocation\n"); - exit (-1); -} - -void quit (int rsn) -{ - switch (rsn) - { - case 1: puts ("Could not open file\n"); break; - case 2: puts ("Could not read file\n"); break; - case 3: puts ("Could not write file\n"); break; - case 4: puts ("Not enough memory\n"); break; - case 5: puts ("Could not open temporary\n"); break; - case 6: puts ("Could not write temporary\n"); break; - case 7: puts ("Could not read target\n"); break; - case 8: puts ("Unsupported operation\n"); break; - } - exit (-1); -} - -void clear () -{ - if (access (TEST_FILE_NAME, 0) == 0) - remove (TEST_FILE_NAME); - if (image) - free (image); -} diff --git a/launch4j/src/LICENSE.txt b/launch4j/src/LICENSE.txt index 38af528..40b4a8c 100644 --- a/launch4j/src/LICENSE.txt +++ b/launch4j/src/LICENSE.txt @@ -1,30 +1,30 @@ -Launch4j (http://launch4j.sourceforge.net/) -Cross-platform Java application wrapper for creating Windows native executables. - -Copyright (c) 2004, 2017 Grzegorz Kowal -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +Launch4j (http://launch4j.sourceforge.net/) +Cross-platform Java application wrapper for creating Windows native executables. + +Copyright (c) 2004, 2019 Grzegorz Kowal +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/launch4j/src/launch4j.properties b/launch4j/src/launch4j.properties index a14697f..5dbec29 100644 --- a/launch4j/src/launch4j.properties +++ b/launch4j/src/launch4j.properties @@ -1,2 +1,2 @@ -versionNumber=3.12.0.0 -version=3.12 +versionNumber=3.50.0.0 +version=3.50 diff --git a/launch4j/src/net/sf/launch4j/Builder.java b/launch4j/src/net/sf/launch4j/Builder.java index 644b7d6..8279f63 100644 --- a/launch4j/src/net/sf/launch4j/Builder.java +++ b/launch4j/src/net/sf/launch4j/Builder.java @@ -1,217 +1,217 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2005-04-24 - */ -package net.sf.launch4j; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -import net.sf.launch4j.binding.InvariantViolationException; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.ConfigPersister; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Builder { - private final Log _log; - private final File _basedir; - - public Builder(Log log) { - _log = log; - _basedir = Util.getJarBasedir(); - } - - public Builder(Log log, File basedir) { - _log = log; - _basedir = basedir; - } - - /** - * @return Output file path. - */ - public File build() throws BuilderException { - final Config c = ConfigPersister.getInstance().getConfig(); - try { - c.validate(); - } catch (InvariantViolationException e) { - throw new BuilderException(e.getMessage()); - } - File rc = null; - File ro = null; - File outfile = null; - FileInputStream is = null; - FileOutputStream os = null; - final RcBuilder rcb = new RcBuilder(); - try { - if (c.isJniApplication()) { - _log.append("WARNING: Some features are not implemented in JNI headers, see documentation."); - } - - rc = rcb.build(c); - ro = Util.createTempFile("o"); - outfile = ConfigPersister.getInstance().getOutputFile(); - - Cmd resCmd = new Cmd(_basedir); - resCmd.addExe("windres") - .add(Util.WINDOWS_OS ? "--preprocessor=type" : "--preprocessor=cat") - .add("-J rc -O coff -F pe-i386") - .addAbsFile(rc) - .addAbsFile(ro); - _log.append(Messages.getString("Builder.compiling.resources")); - resCmd.exec(_log); - - Cmd ldCmd = new Cmd(_basedir); - ldCmd.addExe("ld") - .add("-mi386pe") - .add("--oformat pei-i386") - .add("--dynamicbase") - .add("--nxcompat") - .add("--no-seh") - .add(c.isGuiApplication() ? "--subsystem windows" : "--subsystem console") - .add("-s") // strip symbols - .addFiles(c.getHeaderObjects()) - .addAbsFile(ro) - .addFiles(c.getLibs()) - .add("-o") - .addAbsFile(outfile); - _log.append(Messages.getString("Builder.linking")); - ldCmd.exec(_log); - - if (!c.isDontWrapJar()) { - _log.append(Messages.getString("Builder.wrapping")); - int len; - byte[] buffer = new byte[1024]; - is = new FileInputStream(Util.getAbsoluteFile( - ConfigPersister.getInstance().getConfigPath(), c.getJar())); - os = new FileOutputStream(outfile, true); - while ((len = is.read(buffer)) > 0) { - os.write(buffer, 0, len); - } - } - _log.append(Messages.getString("Builder.success") + outfile.getPath()); - return outfile; - } catch (IOException e) { - Util.delete(outfile); - _log.append(e.getMessage()); - throw new BuilderException(e); - } catch (ExecException e) { - Util.delete(outfile); - String msg = e.getMessage(); - if (msg != null && msg.indexOf("windres") != -1) { - if (e.getErrLine() != -1) { - _log.append(Messages.getString("Builder.line.has.errors", - String.valueOf(e.getErrLine()))); - _log.append(rcb.getLine(e.getErrLine())); - } else { - _log.append(Messages.getString("Builder.generated.resource.file")); - _log.append(rcb.getContent()); - } - } - throw new BuilderException(e); - } finally { - Util.close(is); - Util.close(os); - Util.delete(rc); - Util.delete(ro); - } - } -} - -class Cmd { - private final List _cmd = new ArrayList(); - private final File _basedir; - private final File _bindir; - - public Cmd(File basedir) { - _basedir = basedir; - String path = System.getProperty("launch4j.bindir"); - - if (path == null) { - _bindir = new File(basedir, "bin"); - } else { - File bindir = new File(path); - _bindir = bindir.isAbsolute() ? bindir : new File(basedir, path); - } - } - - public Cmd add(String s) { - StringTokenizer st = new StringTokenizer(s); - - while (st.hasMoreTokens()) { - _cmd.add(st.nextToken()); - } - - return this; - } - - public Cmd addAbsFile(File file) { - _cmd.add(file.getPath()); - return this; - } - - public Cmd addFile(String pathname) { - _cmd.add(new File(_basedir, pathname).getPath()); - return this; - } - - public Cmd addExe(String pathname) { - if (Util.WINDOWS_OS) { - pathname += ".exe"; - } - - _cmd.add(new File(_bindir, pathname).getPath()); - return this; - } - - public Cmd addFiles(List files) { - for (String f : files) { - addFile(f); - } - - return this; - } - - public void exec(Log log) throws ExecException { - String[] cmd = (String[]) _cmd.toArray(new String[_cmd.size()]); - Util.exec(cmd, log); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2005-04-24 + */ +package net.sf.launch4j; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +import net.sf.launch4j.binding.InvariantViolationException; +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.ConfigPersister; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Builder { + private final Log _log; + private final File _basedir; + + public Builder(Log log) { + _log = log; + _basedir = Util.getJarBasedir(); + } + + public Builder(Log log, File basedir) { + _log = log; + _basedir = basedir; + } + + /** + * @return Output file path. + */ + public File build() throws BuilderException { + final Config c = ConfigPersister.getInstance().getConfig(); + try { + c.validate(); + } catch (InvariantViolationException e) { + throw new BuilderException(e.getMessage()); + } + File rc = null; + File ro = null; + File outfile = null; + FileInputStream is = null; + FileOutputStream os = null; + final RcBuilder rcb = new RcBuilder(); + try { + if (c.isJniApplication()) { + _log.append("WARNING: Some features are not implemented in JNI headers, see documentation."); + } + + rc = rcb.build(c); + ro = Util.createTempFile("o"); + outfile = ConfigPersister.getInstance().getOutputFile(); + + Cmd resCmd = new Cmd(_basedir); + resCmd.addExe("windres") + .add(Util.WINDOWS_OS ? "--preprocessor=type" : "--preprocessor=cat") + .add("-J rc -O coff -F pe-i386") + .addAbsFile(rc) + .addAbsFile(ro); + _log.append(Messages.getString("Builder.compiling.resources")); + resCmd.exec(_log); + + Cmd ldCmd = new Cmd(_basedir); + ldCmd.addExe("ld") + .add("-mi386pe") + .add("--oformat pei-i386") + .add("--dynamicbase") + .add("--nxcompat") + .add("--no-seh") + .add(c.isGuiApplication() ? "--subsystem windows" : "--subsystem console") + .add("-s") // strip symbols + .addFiles(c.getHeaderObjects()) + .addAbsFile(ro) + .addFiles(c.getLibs()) + .add("-o") + .addAbsFile(outfile); + _log.append(Messages.getString("Builder.linking")); + ldCmd.exec(_log); + + if (!c.isDontWrapJar()) { + _log.append(Messages.getString("Builder.wrapping")); + int len; + byte[] buffer = new byte[1024]; + is = new FileInputStream(Util.getAbsoluteFile( + ConfigPersister.getInstance().getConfigPath(), c.getJar())); + os = new FileOutputStream(outfile, true); + while ((len = is.read(buffer)) > 0) { + os.write(buffer, 0, len); + } + } + _log.append(Messages.getString("Builder.success") + outfile.getPath()); + return outfile; + } catch (IOException e) { + Util.delete(outfile); + _log.append(e.getMessage()); + throw new BuilderException(e); + } catch (ExecException e) { + Util.delete(outfile); + String msg = e.getMessage(); + if (msg != null && msg.indexOf("windres") != -1) { + if (e.getErrLine() != -1) { + _log.append(Messages.getString("Builder.line.has.errors", + String.valueOf(e.getErrLine()))); + _log.append(rcb.getLine(e.getErrLine())); + } else { + _log.append(Messages.getString("Builder.generated.resource.file")); + _log.append(rcb.getContent()); + } + } + throw new BuilderException(e); + } finally { + Util.close(is); + Util.close(os); + Util.delete(rc); + Util.delete(ro); + } + } +} + +class Cmd { + private final List _cmd = new ArrayList(); + private final File _basedir; + private final File _bindir; + + public Cmd(File basedir) { + _basedir = basedir; + String path = System.getProperty("launch4j.bindir"); + + if (path == null) { + _bindir = new File(basedir, "bin"); + } else { + File bindir = new File(path); + _bindir = bindir.isAbsolute() ? bindir : new File(basedir, path); + } + } + + public Cmd add(String s) { + StringTokenizer st = new StringTokenizer(s); + + while (st.hasMoreTokens()) { + _cmd.add(st.nextToken()); + } + + return this; + } + + public Cmd addAbsFile(File file) { + _cmd.add(file.getPath()); + return this; + } + + public Cmd addFile(String pathname) { + _cmd.add(new File(_basedir, pathname).getPath()); + return this; + } + + public Cmd addExe(String pathname) { + if (Util.WINDOWS_OS) { + pathname += ".exe"; + } + + _cmd.add(new File(_bindir, pathname).getPath()); + return this; + } + + public Cmd addFiles(List files) { + for (String f : files) { + addFile(f); + } + + return this; + } + + public void exec(Log log) throws ExecException { + String[] cmd = (String[]) _cmd.toArray(new String[_cmd.size()]); + Util.exec(cmd, log); + } +} diff --git a/launch4j/src/net/sf/launch4j/BuilderException.java b/launch4j/src/net/sf/launch4j/BuilderException.java index 76d814d..ab679ce 100644 --- a/launch4j/src/net/sf/launch4j/BuilderException.java +++ b/launch4j/src/net/sf/launch4j/BuilderException.java @@ -1,52 +1,52 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 13, 2005 - */ -package net.sf.launch4j; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class BuilderException extends Exception { - public BuilderException() {} - - public BuilderException(Throwable t) { - super(t); - } - - public BuilderException(String msg) { - super(msg); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 13, 2005 + */ +package net.sf.launch4j; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class BuilderException extends Exception { + public BuilderException() {} + + public BuilderException(Throwable t) { + super(t); + } + + public BuilderException(String msg) { + super(msg); + } +} diff --git a/launch4j/src/net/sf/launch4j/ExecException.java b/launch4j/src/net/sf/launch4j/ExecException.java index 059b2a8..ad2f1e1 100644 --- a/launch4j/src/net/sf/launch4j/ExecException.java +++ b/launch4j/src/net/sf/launch4j/ExecException.java @@ -1,66 +1,66 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 14, 2005 - */ -package net.sf.launch4j; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class ExecException extends Exception { - private final int _errLine; - - public ExecException(Throwable t, int errLine) { - super(t); - _errLine = errLine; - } - - public ExecException(Throwable t) { - this(t, -1); - } - - public ExecException(String msg, int errLine) { - super(msg); - _errLine = errLine; - } - - public ExecException(String msg) { - this(msg, -1); - } - - public int getErrLine() { - return _errLine; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 14, 2005 + */ +package net.sf.launch4j; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class ExecException extends Exception { + private final int _errLine; + + public ExecException(Throwable t, int errLine) { + super(t); + _errLine = errLine; + } + + public ExecException(Throwable t) { + this(t, -1); + } + + public ExecException(String msg, int errLine) { + super(msg); + _errLine = errLine; + } + + public ExecException(String msg) { + this(msg, -1); + } + + public int getErrLine() { + return _errLine; + } +} diff --git a/launch4j/src/net/sf/launch4j/FileChooserFilter.java b/launch4j/src/net/sf/launch4j/FileChooserFilter.java index e4d8d6f..5390226 100644 --- a/launch4j/src/net/sf/launch4j/FileChooserFilter.java +++ b/launch4j/src/net/sf/launch4j/FileChooserFilter.java @@ -1,76 +1,76 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2004-01-15 - */ -package net.sf.launch4j; - -import java.io.File; - -import javax.swing.filechooser.FileFilter; - -/** - * @author Copyright (C) 2004 Grzegorz Kowal - */ -public class FileChooserFilter extends FileFilter { - String _description; - String[] _extensions; - - public FileChooserFilter(String description, String extension) { - _description = description; - _extensions = new String[] {extension}; - } - - public FileChooserFilter(String description, String[] extensions) { - _description = description; - _extensions = extensions; - } - - public boolean accept(File f) { - if (f.isDirectory()) { - return true; - } - String ext = Util.getExtension(f); - for (int i = 0; i < _extensions.length; i++) { - if (ext.toLowerCase().equals(_extensions[i].toLowerCase())) { - return true; - } - } - return false; - } - - public String getDescription() { - return _description; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2004-01-15 + */ +package net.sf.launch4j; + +import java.io.File; + +import javax.swing.filechooser.FileFilter; + +/** + * @author Copyright (C) 2004 Grzegorz Kowal + */ +public class FileChooserFilter extends FileFilter { + String _description; + String[] _extensions; + + public FileChooserFilter(String description, String extension) { + _description = description; + _extensions = new String[] {extension}; + } + + public FileChooserFilter(String description, String[] extensions) { + _description = description; + _extensions = extensions; + } + + public boolean accept(File f) { + if (f.isDirectory()) { + return true; + } + String ext = Util.getExtension(f); + for (int i = 0; i < _extensions.length; i++) { + if (ext.toLowerCase().equals(_extensions[i].toLowerCase())) { + return true; + } + } + return false; + } + + public String getDescription() { + return _description; + } +} diff --git a/launch4j/src/net/sf/launch4j/KanjiEscapeOutputStream.java b/launch4j/src/net/sf/launch4j/KanjiEscapeOutputStream.java index 9f26726..25f2ef1 100644 --- a/launch4j/src/net/sf/launch4j/KanjiEscapeOutputStream.java +++ b/launch4j/src/net/sf/launch4j/KanjiEscapeOutputStream.java @@ -1,86 +1,86 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2013 toshimm - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.sf.launch4j; - -import java.io.OutputStream; -import java.io.IOException; - -/** - * @author toshimm (2013) - * - * This class makes Japanese Kanji characters in MS932 charcode escaped - * in octal form. - */ -public class KanjiEscapeOutputStream extends OutputStream { - - protected OutputStream parent; - - public KanjiEscapeOutputStream(OutputStream out) { - this.parent = out; - } - - private final int MASK = 0x000000FF; - private boolean state = true; - - public void write(int b) throws IOException { - b = b & MASK; - - if (state) { - if (0x00 <= b && b <= 0x7f) { - this.parent.write(b); - } else { - this.octprint(b); - if ((0x81 <= b && b <= 0x9f) || (0xe0 <= b && b <= 0xfc)) { - this.state = false; - } - } - } else { - if ((0x40 <= b && b <= 0x7e) || (0x80 <= b && b <= 0xfc)) { - this.octprint(b); - } else if (0x00 <= b && b <= 0x7f) { - this.parent.write(b); - } else { - this.octprint(b); - } - this.state = true; - } - } - - private void octprint(int b) throws IOException { - String oct = "\\" + String.format("%o", b & MASK); - for (int i = 0; i < oct.length(); ++i) { - int bb = oct.charAt(i); - this.parent.write(bb); - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2013 toshimm + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.sf.launch4j; + +import java.io.OutputStream; +import java.io.IOException; + +/** + * @author toshimm (2013) + * + * This class makes Japanese Kanji characters in MS932 charcode escaped + * in octal form. + */ +public class KanjiEscapeOutputStream extends OutputStream { + + protected OutputStream parent; + + public KanjiEscapeOutputStream(OutputStream out) { + this.parent = out; + } + + private final int MASK = 0x000000FF; + private boolean state = true; + + public void write(int b) throws IOException { + b = b & MASK; + + if (state) { + if (0x00 <= b && b <= 0x7f) { + this.parent.write(b); + } else { + this.octprint(b); + if ((0x81 <= b && b <= 0x9f) || (0xe0 <= b && b <= 0xfc)) { + this.state = false; + } + } + } else { + if ((0x40 <= b && b <= 0x7e) || (0x80 <= b && b <= 0xfc)) { + this.octprint(b); + } else if (0x00 <= b && b <= 0x7f) { + this.parent.write(b); + } else { + this.octprint(b); + } + this.state = true; + } + } + + private void octprint(int b) throws IOException { + String oct = "\\" + String.format("%o", b & MASK); + for (int i = 0; i < oct.length(); ++i) { + int bb = oct.charAt(i); + this.parent.write(bb); + } + } +} diff --git a/launch4j/src/net/sf/launch4j/Log.java b/launch4j/src/net/sf/launch4j/Log.java index 369befc..5c69d04 100644 --- a/launch4j/src/net/sf/launch4j/Log.java +++ b/launch4j/src/net/sf/launch4j/Log.java @@ -1,105 +1,105 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 12, 2005 - */ -package net.sf.launch4j; - -import javax.swing.JTextArea; -import javax.swing.SwingUtilities; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public abstract class Log { - private static final Log _consoleLog = new ConsoleLog(); - private static final Log _antLog = new AntLog(); - - public abstract void clear(); - public abstract void append(String line); - - public static Log getConsoleLog() { - return _consoleLog; - } - - public static Log getAntLog() { - return _antLog; - } - - public static Log getSwingLog(JTextArea textArea) { - return new SwingLog(textArea); - } -} - -class ConsoleLog extends Log { - public void clear() { - System.out.println("\n"); - } - - public void append(String line) { - System.out.println("launch4j: " + line); - } -} - -class AntLog extends Log { - public void clear() { - System.out.println("\n"); - } - - public void append(String line) { - System.out.println(line); - } -} - -class SwingLog extends Log { - private final JTextArea _textArea; - - public SwingLog(JTextArea textArea) { - _textArea = textArea; - } - - public void clear() { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - _textArea.setText(""); - }}); - } - - public void append(final String line) { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - _textArea.append(line + "\n"); - }}); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 12, 2005 + */ +package net.sf.launch4j; + +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public abstract class Log { + private static final Log _consoleLog = new ConsoleLog(); + private static final Log _antLog = new AntLog(); + + public abstract void clear(); + public abstract void append(String line); + + public static Log getConsoleLog() { + return _consoleLog; + } + + public static Log getAntLog() { + return _antLog; + } + + public static Log getSwingLog(JTextArea textArea) { + return new SwingLog(textArea); + } +} + +class ConsoleLog extends Log { + public void clear() { + System.out.println("\n"); + } + + public void append(String line) { + System.out.println("launch4j: " + line); + } +} + +class AntLog extends Log { + public void clear() { + System.out.println("\n"); + } + + public void append(String line) { + System.out.println(line); + } +} + +class SwingLog extends Log { + private final JTextArea _textArea; + + public SwingLog(JTextArea textArea) { + _textArea = textArea; + } + + public void clear() { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + _textArea.setText(""); + }}); + } + + public void append(final String line) { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + _textArea.append(line + "\n"); + }}); + } +} diff --git a/launch4j/src/net/sf/launch4j/Main.java b/launch4j/src/net/sf/launch4j/Main.java index 820f4be..864eb03 100644 --- a/launch4j/src/net/sf/launch4j/Main.java +++ b/launch4j/src/net/sf/launch4j/Main.java @@ -1,95 +1,95 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 21, 2005 - */ -package net.sf.launch4j; - -import java.io.File; -import java.util.Properties; - -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.formimpl.MainFrame; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Main { - private static String _name; - private static String _description; - - public static void main(String[] args) { - try { - Properties props = Util.getProperties(); - setDescription(props); - - if (args.length == 0) { - ConfigPersister.getInstance().createBlank(); - MainFrame.createInstance(); - } else if (args.length == 1 && !args[0].startsWith("-")) { - ConfigPersister.getInstance().load(new File(args[0])); - Builder b = new Builder(Log.getConsoleLog()); - b.build(); - } else { - System.out.println(_description - + Messages.getString("Main.usage") - + ": launch4j config.xml"); - } - } catch (Exception e) { - Log.getConsoleLog().append(e.getMessage()); - System.exit(1); - } - } - - public static String getName() { - return _name; - } - - public static String getDescription() { - return _description; - } - - private static void setDescription(Properties props) { - _name = "Launch4j " + props.getProperty("version"); - _description = _name + - " (http://launch4j.sourceforge.net/)\n" + - "Cross-platform Java application wrapper" + - " for creating Windows native executables.\n\n" + - "Copyright (C) 2004, 2018 Grzegorz Kowal\n\n" + - "Launch4j comes with ABSOLUTELY NO WARRANTY.\n" + - "This is free software, licensed under the BSD License.\n" + - "This product includes software developed by the Apache Software Foundation" + - " (http://www.apache.org/)."; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 21, 2005 + */ +package net.sf.launch4j; + +import java.io.File; +import java.util.Properties; + +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.formimpl.MainFrame; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Main { + private static String _name; + private static String _description; + + public static void main(String[] args) { + try { + Properties props = Util.getProperties(); + setDescription(props); + + if (args.length == 0) { + ConfigPersister.getInstance().createBlank(); + MainFrame.createInstance(); + } else if (args.length == 1 && !args[0].startsWith("-")) { + ConfigPersister.getInstance().load(new File(args[0])); + Builder b = new Builder(Log.getConsoleLog()); + b.build(); + } else { + System.out.println(_description + + Messages.getString("Main.usage") + + ": launch4j config.xml"); + } + } catch (Exception e) { + Log.getConsoleLog().append(e.getMessage()); + System.exit(1); + } + } + + public static String getName() { + return _name; + } + + public static String getDescription() { + return _description; + } + + private static void setDescription(Properties props) { + _name = "Launch4j " + props.getProperty("version"); + _description = _name + + " (http://launch4j.sourceforge.net/)\n" + + "Cross-platform Java application wrapper" + + " for creating Windows native executables.\n\n" + + "Copyright (C) 2004, 2022 Grzegorz Kowal\n\n" + + "Launch4j comes with ABSOLUTELY NO WARRANTY.\n" + + "This is free software, licensed under the BSD License.\n" + + "This product includes software developed by the Apache Software Foundation" + + " (http://www.apache.org/)."; + } +} diff --git a/launch4j/src/net/sf/launch4j/Messages.java b/launch4j/src/net/sf/launch4j/Messages.java index 687683d..a4bcaab 100644 --- a/launch4j/src/net/sf/launch4j/Messages.java +++ b/launch4j/src/net/sf/launch4j/Messages.java @@ -1,78 +1,78 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j; - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - private static final MessageFormat FORMATTER = new MessageFormat(""); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } - - public static String getString(String key, String arg0) { - return getString(key, new Object[] {arg0}); - } - - public static String getString(String key, String arg0, String arg1) { - return getString(key, new Object[] {arg0, arg1}); - } - - public static String getString(String key, String arg0, String arg1, String arg2) { - return getString(key, new Object[] {arg0, arg1, arg2}); - } - - public static String getString(String key, Object[] args) { - try { - FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); - return FORMATTER.format(args); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + private static final MessageFormat FORMATTER = new MessageFormat(""); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + public static String getString(String key, String arg0) { + return getString(key, new Object[] {arg0}); + } + + public static String getString(String key, String arg0, String arg1) { + return getString(key, new Object[] {arg0, arg1}); + } + + public static String getString(String key, String arg0, String arg1, String arg2) { + return getString(key, new Object[] {arg0, arg1, arg2}); + } + + public static String getString(String key, Object[] args) { + try { + FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); + return FORMATTER.format(args); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/launch4j/src/net/sf/launch4j/RcBuilder.java b/launch4j/src/net/sf/launch4j/RcBuilder.java index 45f2339..fe9c26b 100644 --- a/launch4j/src/net/sf/launch4j/RcBuilder.java +++ b/launch4j/src/net/sf/launch4j/RcBuilder.java @@ -1,420 +1,415 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2005-04-24 - */ -package net.sf.launch4j; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.util.List; - -import net.sf.launch4j.config.CharsetID; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.config.Jre; -import net.sf.launch4j.config.Msg; -import net.sf.launch4j.config.Splash; -import net.sf.launch4j.config.VersionInfo; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class RcBuilder { - - // winnt.h - public static final int LANG_NEUTRAL = 0; - public static final int SUBLANG_NEUTRAL = 0; - public static final int SUBLANG_DEFAULT = 1; - public static final int SUBLANG_SYS_DEFAULT = 2; - - // MANIFEST - public static final int MANIFEST = 1; - - // ICON - public static final int APP_ICON = 1; - - // BITMAP - public static final int SPLASH_BITMAP = 1; - - // RCDATA - public static final int JRE_PATH = 1; - public static final int JAVA_MIN_VER = 2; - public static final int JAVA_MAX_VER = 3; - public static final int SHOW_SPLASH = 4; - public static final int SPLASH_WAITS_FOR_WINDOW = 5; - public static final int SPLASH_TIMEOUT = 6; - public static final int SPLASH_TIMEOUT_ERR = 7; - public static final int CHDIR = 8; - public static final int ERR_TITLE = 10; - public static final int GUI_HEADER_STAYS_ALIVE = 11; - public static final int JVM_OPTIONS = 12; - public static final int CMD_LINE = 13; - public static final int JAR = 14; - public static final int MAIN_CLASS = 15; - public static final int CLASSPATH = 16; - public static final int WRAPPER = 17; - public static final int JDK_PREFERENCE = 18; - public static final int ENV_VARIABLES = 19; - public static final int PRIORITY_CLASS = 20; - public static final int DOWNLOAD_URL = 21; - public static final int SUPPORT_URL = 22; - public static final int MUTEX_NAME = 23; - public static final int INSTANCE_WINDOW_TITLE = 24; - public static final int INITIAL_HEAP_SIZE = 25; - public static final int INITIAL_HEAP_PERCENT = 26; - public static final int MAX_HEAP_SIZE = 27; - public static final int MAX_HEAP_PERCENT = 28; - public static final int BUNDLED_JRE_64_BIT = 29; - public static final int RUNTIME_BITS = 30; - public static final int RESTART_ON_CRASH = 31; - public static final int BUNDLED_JRE_AS_FALLBACK = 32; - - public static final int STARTUP_ERR = 101; - public static final int BUNDLED_JRE_ERR = 102; - public static final int JRE_VERSION_ERR = 103; - public static final int LAUNCHER_ERR = 104; - public static final int INSTANCE_ALREADY_EXISTS_MSG = 105; - - private final StringBuffer _sb = new StringBuffer(); - - public String getContent() { - return _sb.toString(); - } - - public String getLine(int line) { - return _sb.toString().split("\n")[line - 1]; - } - - public File build(Config c) throws IOException { - _sb.append("LANGUAGE "); - _sb.append(LANG_NEUTRAL); - _sb.append(", "); - _sb.append(SUBLANG_DEFAULT); - _sb.append('\n'); - addVersionInfo(c.getVersionInfo()); - addJre(c.getJre()); - addManifest(MANIFEST, c.getManifest()); - addIcon(APP_ICON, c.getIcon()); - addText(ERR_TITLE, c.getErrTitle()); - addText(DOWNLOAD_URL, c.getDownloadUrl()); - addText(SUPPORT_URL, c.getSupportUrl()); - addText(CMD_LINE, c.getCmdLine()); - addWindowsPath(CHDIR, c.getChdir()); - addText(PRIORITY_CLASS, String.valueOf(c.getPriorityClass())); - addTrue(GUI_HEADER_STAYS_ALIVE, c.isStayAlive()); - addTrue(RESTART_ON_CRASH, c.isRestartOnCrash()); - addSplash(c.getSplash()); - addMessages(c); - - if (c.getSingleInstance() != null) { - addText(MUTEX_NAME, c.getSingleInstance().getMutexName()); - addText(INSTANCE_WINDOW_TITLE, c.getSingleInstance().getWindowTitle()); - } - - if (c.getVariables() != null && !c.getVariables().isEmpty()) { - StringBuffer vars = new StringBuffer(); - append(vars, c.getVariables(), "\t"); - addText(ENV_VARIABLES, vars.toString()); - } - - // MAIN_CLASS / JAR - addTrue(WRAPPER, !c.isDontWrapJar()); - - if (c.getClassPath() != null) { - addText(MAIN_CLASS, c.getClassPath().getMainClass()); - addWindowsPath(CLASSPATH, c.getClassPath().getPathsString()); - } - - if (c.isDontWrapJar() && c.getJar() != null) { - addWindowsPath(JAR, c.getJar().getPath()); - } - - File file = Util.createTempFile("rc"); - - if ("MS932".equals(System.getProperty("file.encoding"))) { - writeKanjiResourceFile(file); - } else { - writeResourceFile(file); - } - - return file; - } - - private void writeResourceFile(File file) throws IOException { - FileOutputStream os = null; - OutputStreamWriter osw = null; - BufferedWriter w = null; - - try { - os = new FileOutputStream(file); - osw = new OutputStreamWriter(os, "ISO-8859-1"); - w = new BufferedWriter(osw); - w.write(_sb.toString()); - } finally { - Util.close(w); - Util.close(osw); - Util.close(os); - } - } - - /** - * Handle Japanese encoding - by toshimm. - */ - private void writeKanjiResourceFile(File file) throws IOException { - FileOutputStream output = null; - KanjiEscapeOutputStream kanji = null; - OutputStreamWriter writer = null; - BufferedWriter w = null; - - try { - output = new FileOutputStream(file); - kanji = new KanjiEscapeOutputStream(output); - writer = new OutputStreamWriter(kanji); - w = new BufferedWriter(writer); - w.write(_sb.toString()); - } finally { - Util.close(w); - Util.close(writer); - Util.close(kanji); - Util.close(output); - } - } - - private void addVersionInfo(VersionInfo v) { - if (v == null) { - return; - } - - _sb.append("1 VERSIONINFO\n"); - _sb.append("FILEVERSION "); - _sb.append(v.getFileVersion().replaceAll("\\.", ", ")); - _sb.append("\nPRODUCTVERSION "); - _sb.append(v.getProductVersion().replaceAll("\\.", ", ")); - _sb.append("\nFILEFLAGSMASK 0\n" + - "FILEOS 0x40000\n" + - "FILETYPE 1\n" + - "{\n" + - " BLOCK \"StringFileInfo\"\n" + - " {\n" + - " BLOCK \""); - _sb.append(String.format("%04X%04X", v.getLanguage().getId(), CharsetID.MULTILINGUAL.getId())); - _sb.append("\"\n" + - " {\n"); - - addVerBlockValue("CompanyName", v.getCompanyName()); - addVerBlockValue("FileDescription", v.getFileDescription()); - addVerBlockValue("FileVersion", v.getTxtFileVersion()); - addVerBlockValue("InternalName", v.getInternalName()); - addVerBlockValue("LegalCopyright", v.getCopyright()); - addVerBlockValue("LegalTrademarks", v.getTrademarks()); - addVerBlockValue("OriginalFilename", v.getOriginalFilename()); - addVerBlockValue("ProductName", v.getProductName()); - addVerBlockValue("ProductVersion", v.getTxtProductVersion()); - _sb.append(" }\n }\nBLOCK \"VarFileInfo\"\n{\nVALUE \"Translation\", "); - _sb.append(String.format("0x%04X, 0x%04X", v.getLanguage().getId(), CharsetID.MULTILINGUAL.getId())); - _sb.append("\n}\n}"); - } - - private void addJre(Jre jre) { - addWindowsPath(JRE_PATH, jre.getPath()); - addTrue(BUNDLED_JRE_64_BIT, jre.getBundledJre64Bit()); - addTrue(BUNDLED_JRE_AS_FALLBACK, jre.getBundledJreAsFallback()); - addText(JAVA_MIN_VER, jre.getMinVersion()); - addText(JAVA_MAX_VER, jre.getMaxVersion()); - addText(JDK_PREFERENCE, String.valueOf(jre.getJdkPreferenceIndex())); - - addInteger(RUNTIME_BITS, jre.getRuntimeBitsIndex() + 1); - addInteger(INITIAL_HEAP_SIZE, jre.getInitialHeapSize()); - addInteger(INITIAL_HEAP_PERCENT, jre.getInitialHeapPercent()); - addInteger(MAX_HEAP_SIZE, jre.getMaxHeapSize()); - addInteger(MAX_HEAP_PERCENT, jre.getMaxHeapPercent()); - - StringBuffer options = new StringBuffer(); - - if (jre.getOptions() != null && !jre.getOptions().isEmpty()) { - addSpace(options); - append(options, jre.getOptions(), " "); - } - - addText(JVM_OPTIONS, options.toString()); - } - - private void addSplash(Splash splash) { - if (splash == null) { - return; - } - - addTrue(SHOW_SPLASH, true); - addTrue(SPLASH_WAITS_FOR_WINDOW, splash.getWaitForWindow()); - addText(SPLASH_TIMEOUT, String.valueOf(splash.getTimeout())); - addTrue(SPLASH_TIMEOUT_ERR, splash.isTimeoutErr()); - addBitmap(SPLASH_BITMAP, splash.getFile()); - } - - private void addMessages(Config c) { - Msg msg = c.getMessages(); - - if (msg == null) { - msg = new Msg(); - } - - addText(STARTUP_ERR, msg.getStartupErr()); - addText(BUNDLED_JRE_ERR, msg.getBundledJreErr()); - addText(JRE_VERSION_ERR, msg.getJreVersionErr()); - addText(LAUNCHER_ERR, msg.getLauncherErr()); - - if (c.getSingleInstance() != null) { - addText(INSTANCE_ALREADY_EXISTS_MSG, msg.getInstanceAlreadyExistsMsg()); - } - } - - private void append(StringBuffer sb, List list, String separator) { - for (int i = 0; i < list.size(); i++) { - sb.append(list.get(i)); - - if (i < list.size() - 1) { - sb.append(separator); - } - } - } - - private void addText(int id, String text) { - if (text == null || text.equals("")) { - return; - } - - _sb.append(id); - _sb.append(" RCDATA BEGIN \""); - _sb.append(escape(text)); - _sb.append("\\0\" END\n"); - } - - private void addTrue(int id, boolean value) { - if (value) { - addText(id, "true"); - } - } - - private void addInteger(int id, Integer value) { - if (value != null) { - addText(id, value.toString()); - } - } - - /** - * Stores path in Windows format with '\' separators. - */ - private void addWindowsPath(int id, String path) { - if (path == null || path.equals("")) { - return; - } - - _sb.append(id); - _sb.append(" RCDATA BEGIN \""); - _sb.append(path.replaceAll("\\\\", "\\\\\\\\") - .replaceAll("/", "\\\\\\\\")); - _sb.append("\\0\" END\n"); - } - - private void addManifest(int id, File manifest) { - if (manifest == null || manifest.getPath().equals("")) { - return; - } - - _sb.append(id); - _sb.append(" 24 \""); - _sb.append(getPath(Util.getAbsoluteFile( - ConfigPersister.getInstance().getConfigPath(), manifest))); - _sb.append("\"\n"); - } - - private void addIcon(int id, File icon) { - if (icon == null || icon.getPath().equals("")) { - return; - } - - _sb.append(id); - _sb.append(" ICON DISCARDABLE \""); - _sb.append(getPath(Util.getAbsoluteFile( - ConfigPersister.getInstance().getConfigPath(), icon))); - _sb.append("\"\n"); - } - - private void addBitmap(int id, File bitmap) { - if (bitmap == null) { - return; - } - - _sb.append(id); - _sb.append(" BITMAP \""); - _sb.append(getPath(Util.getAbsoluteFile( - ConfigPersister.getInstance().getConfigPath(), bitmap))); - _sb.append("\"\n"); - } - - private String getPath(File f) { - return f.getPath().replaceAll("\\\\", "\\\\\\\\"); - } - - private void addSpace(StringBuffer sb) { - int len = sb.length(); - - if (len-- > 0 && sb.charAt(len) != ' ') { - sb.append(' '); - } - } - - private void addVerBlockValue(String key, String value) { - _sb.append(" VALUE \""); - _sb.append(key); - _sb.append("\", \""); - - if (value != null) { - _sb.append(escape(value)); - } - - _sb.append("\"\n"); - } - - private String escape(String text) { - return text.replace("\"", "\"\"") - .replace("\\", "\\\\") - .replace("\n", "\\r\\n"); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2005-04-24 + */ +package net.sf.launch4j; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.List; + +import net.sf.launch4j.config.CharsetID; +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.config.Jre; +import net.sf.launch4j.config.Msg; +import net.sf.launch4j.config.Splash; +import net.sf.launch4j.config.VersionInfo; + +/** + * @author Copyright (C) 2022 Grzegorz Kowal + */ +public class RcBuilder { + + // winnt.h + public static final int LANG_NEUTRAL = 0; + public static final int SUBLANG_NEUTRAL = 0; + public static final int SUBLANG_DEFAULT = 1; + public static final int SUBLANG_SYS_DEFAULT = 2; + + // MANIFEST + public static final int MANIFEST = 1; + + // ICON + public static final int APP_ICON = 1; + + // BITMAP + public static final int SPLASH_BITMAP = 1; + + // RCDATA + public static final int JRE_PATH = 1; + public static final int JAVA_MIN_VER = 2; + public static final int JAVA_MAX_VER = 3; + public static final int SHOW_SPLASH = 4; + public static final int SPLASH_WAITS_FOR_WINDOW = 5; + public static final int SPLASH_TIMEOUT = 6; + public static final int SPLASH_TIMEOUT_ERR = 7; + public static final int CHDIR = 8; + public static final int ERR_TITLE = 10; + public static final int GUI_HEADER_STAYS_ALIVE = 11; + public static final int JVM_OPTIONS = 12; + public static final int CMD_LINE = 13; + public static final int JAR = 14; + public static final int MAIN_CLASS = 15; + public static final int CLASSPATH = 16; + public static final int WRAPPER = 17; + public static final int REQUIRES_JDK = 18; + public static final int ENV_VARIABLES = 19; + public static final int PRIORITY_CLASS = 20; + public static final int DOWNLOAD_URL = 21; + public static final int SUPPORT_URL = 22; + public static final int MUTEX_NAME = 23; + public static final int INSTANCE_WINDOW_TITLE = 24; + public static final int INITIAL_HEAP_SIZE = 25; + public static final int INITIAL_HEAP_PERCENT = 26; + public static final int MAX_HEAP_SIZE = 27; + public static final int MAX_HEAP_PERCENT = 28; + public static final int REQUIRES_64_BIT = 29; + public static final int RESTART_ON_CRASH = 31; + + public static final int STARTUP_ERR = 101; + public static final int JRE_NOT_FOUND_ERR = 102; + public static final int JRE_VERSION_ERR = 103; + public static final int LAUNCHER_ERR = 104; + public static final int INSTANCE_ALREADY_EXISTS_MSG = 105; + + private final StringBuffer _sb = new StringBuffer(); + + public String getContent() { + return _sb.toString(); + } + + public String getLine(int line) { + return _sb.toString().split("\n")[line - 1]; + } + + public File build(Config c) throws IOException { + _sb.append("LANGUAGE "); + _sb.append(LANG_NEUTRAL); + _sb.append(", "); + _sb.append(SUBLANG_DEFAULT); + _sb.append('\n'); + addVersionInfo(c.getVersionInfo()); + addJre(c.getJre()); + addManifest(MANIFEST, c.getManifest()); + addIcon(APP_ICON, c.getIcon()); + addText(ERR_TITLE, c.getErrTitle()); + addText(DOWNLOAD_URL, c.getDownloadUrl()); + addText(SUPPORT_URL, c.getSupportUrl()); + addText(CMD_LINE, c.getCmdLine()); + addWindowsPath(CHDIR, c.getChdir()); + addText(PRIORITY_CLASS, String.valueOf(c.getPriorityClass())); + addTrue(GUI_HEADER_STAYS_ALIVE, c.isStayAlive()); + addTrue(RESTART_ON_CRASH, c.isRestartOnCrash()); + addSplash(c.getSplash()); + addMessages(c); + + if (c.getSingleInstance() != null) { + addText(MUTEX_NAME, c.getSingleInstance().getMutexName()); + addText(INSTANCE_WINDOW_TITLE, c.getSingleInstance().getWindowTitle()); + } + + if (c.getVariables() != null && !c.getVariables().isEmpty()) { + StringBuffer vars = new StringBuffer(); + append(vars, c.getVariables(), "\t"); + addText(ENV_VARIABLES, vars.toString()); + } + + // MAIN_CLASS / JAR + addTrue(WRAPPER, !c.isDontWrapJar()); + + if (c.getClassPath() != null) { + addText(MAIN_CLASS, c.getClassPath().getMainClass()); + addWindowsPath(CLASSPATH, c.getClassPath().getPathsString()); + } + + if (c.isDontWrapJar() && c.getJar() != null) { + addWindowsPath(JAR, c.getJar().getPath()); + } + + File file = Util.createTempFile("rc"); + + if ("MS932".equals(System.getProperty("file.encoding"))) { + writeKanjiResourceFile(file); + } else { + writeResourceFile(file); + } + + return file; + } + + private void writeResourceFile(File file) throws IOException { + FileOutputStream os = null; + OutputStreamWriter osw = null; + BufferedWriter w = null; + + try { + os = new FileOutputStream(file); + osw = new OutputStreamWriter(os, "ISO-8859-1"); + w = new BufferedWriter(osw); + w.write(_sb.toString()); + } finally { + Util.close(w); + Util.close(osw); + Util.close(os); + } + } + + /** + * Handle Japanese encoding - by toshimm. + */ + private void writeKanjiResourceFile(File file) throws IOException { + FileOutputStream output = null; + KanjiEscapeOutputStream kanji = null; + OutputStreamWriter writer = null; + BufferedWriter w = null; + + try { + output = new FileOutputStream(file); + kanji = new KanjiEscapeOutputStream(output); + writer = new OutputStreamWriter(kanji); + w = new BufferedWriter(writer); + w.write(_sb.toString()); + } finally { + Util.close(w); + Util.close(writer); + Util.close(kanji); + Util.close(output); + } + } + + private void addVersionInfo(VersionInfo v) { + if (v == null) { + return; + } + + _sb.append("1 VERSIONINFO\n"); + _sb.append("FILEVERSION "); + _sb.append(v.getFileVersion().replaceAll("\\.", ", ")); + _sb.append("\nPRODUCTVERSION "); + _sb.append(v.getProductVersion().replaceAll("\\.", ", ")); + _sb.append("\nFILEFLAGSMASK 0\n" + + "FILEOS 0x40000\n" + + "FILETYPE 1\n" + + "{\n" + + " BLOCK \"StringFileInfo\"\n" + + " {\n" + + " BLOCK \""); + _sb.append(String.format("%04X%04X", v.getLanguage().getId(), CharsetID.MULTILINGUAL.getId())); + _sb.append("\"\n" + + " {\n"); + + addVerBlockValue("CompanyName", v.getCompanyName()); + addVerBlockValue("FileDescription", v.getFileDescription()); + addVerBlockValue("FileVersion", v.getTxtFileVersion()); + addVerBlockValue("InternalName", v.getInternalName()); + addVerBlockValue("LegalCopyright", v.getCopyright()); + addVerBlockValue("LegalTrademarks", v.getTrademarks()); + addVerBlockValue("OriginalFilename", v.getOriginalFilename()); + addVerBlockValue("ProductName", v.getProductName()); + addVerBlockValue("ProductVersion", v.getTxtProductVersion()); + _sb.append(" }\n }\nBLOCK \"VarFileInfo\"\n{\nVALUE \"Translation\", "); + _sb.append(String.format("0x%04X, 0x%04X", v.getLanguage().getId(), CharsetID.MULTILINGUAL.getId())); + _sb.append("\n}\n}"); + } + + private void addJre(Jre jre) { + addWindowsPath(JRE_PATH, jre.getPath()); + addTrue(REQUIRES_JDK, jre.getRequiresJdk()); + addTrue(REQUIRES_64_BIT, jre.getRequires64Bit()); + addText(JAVA_MIN_VER, jre.getMinVersion()); + addText(JAVA_MAX_VER, jre.getMaxVersion()); + + addInteger(INITIAL_HEAP_SIZE, jre.getInitialHeapSize()); + addInteger(INITIAL_HEAP_PERCENT, jre.getInitialHeapPercent()); + addInteger(MAX_HEAP_SIZE, jre.getMaxHeapSize()); + addInteger(MAX_HEAP_PERCENT, jre.getMaxHeapPercent()); + + StringBuffer options = new StringBuffer(); + + if (jre.getOptions() != null && !jre.getOptions().isEmpty()) { + addSpace(options); + append(options, jre.getOptions(), " "); + } + + addText(JVM_OPTIONS, options.toString()); + } + + private void addSplash(Splash splash) { + if (splash == null) { + return; + } + + addTrue(SHOW_SPLASH, true); + addTrue(SPLASH_WAITS_FOR_WINDOW, splash.getWaitForWindow()); + addText(SPLASH_TIMEOUT, String.valueOf(splash.getTimeout())); + addTrue(SPLASH_TIMEOUT_ERR, splash.isTimeoutErr()); + addBitmap(SPLASH_BITMAP, splash.getFile()); + } + + private void addMessages(Config c) { + Msg msg = c.getMessages(); + + if (msg == null) { + msg = new Msg(); + } + + addText(STARTUP_ERR, msg.getStartupErr()); + addText(JRE_NOT_FOUND_ERR, msg.getJreNotFoundErr()); + addText(JRE_VERSION_ERR, msg.getJreVersionErr()); + addText(LAUNCHER_ERR, msg.getLauncherErr()); + + if (c.getSingleInstance() != null) { + addText(INSTANCE_ALREADY_EXISTS_MSG, msg.getInstanceAlreadyExistsMsg()); + } + } + + private void append(StringBuffer sb, List list, String separator) { + for (int i = 0; i < list.size(); i++) { + sb.append(list.get(i)); + + if (i < list.size() - 1) { + sb.append(separator); + } + } + } + + private void addText(int id, String text) { + if (text == null || text.equals("")) { + return; + } + + _sb.append(id); + _sb.append(" RCDATA BEGIN \""); + _sb.append(escape(text)); + _sb.append("\\0\" END\n"); + } + + private void addTrue(int id, boolean value) { + if (value) { + addText(id, "true"); + } + } + + private void addInteger(int id, Integer value) { + if (value != null) { + addText(id, value.toString()); + } + } + + /** + * Stores path in Windows format with '\' separators. + */ + private void addWindowsPath(int id, String path) { + if (path == null || path.equals("")) { + return; + } + + _sb.append(id); + _sb.append(" RCDATA BEGIN \""); + _sb.append(path.replaceAll("\\\\", "\\\\\\\\") + .replaceAll("/", "\\\\\\\\")); + _sb.append("\\0\" END\n"); + } + + private void addManifest(int id, File manifest) { + if (manifest == null || manifest.getPath().equals("")) { + return; + } + + _sb.append(id); + _sb.append(" 24 \""); + _sb.append(getPath(Util.getAbsoluteFile( + ConfigPersister.getInstance().getConfigPath(), manifest))); + _sb.append("\"\n"); + } + + private void addIcon(int id, File icon) { + if (icon == null || icon.getPath().equals("")) { + return; + } + + _sb.append(id); + _sb.append(" ICON DISCARDABLE \""); + _sb.append(getPath(Util.getAbsoluteFile( + ConfigPersister.getInstance().getConfigPath(), icon))); + _sb.append("\"\n"); + } + + private void addBitmap(int id, File bitmap) { + if (bitmap == null) { + return; + } + + _sb.append(id); + _sb.append(" BITMAP \""); + _sb.append(getPath(Util.getAbsoluteFile( + ConfigPersister.getInstance().getConfigPath(), bitmap))); + _sb.append("\"\n"); + } + + private String getPath(File f) { + return f.getPath().replaceAll("\\\\", "\\\\\\\\"); + } + + private void addSpace(StringBuffer sb) { + int len = sb.length(); + + if (len-- > 0 && sb.charAt(len) != ' ') { + sb.append(' '); + } + } + + private void addVerBlockValue(String key, String value) { + _sb.append(" VALUE \""); + _sb.append(key); + _sb.append("\", \""); + + if (value != null) { + _sb.append(escape(value)); + } + + _sb.append("\"\n"); + } + + private String escape(String text) { + return text.replace("\"", "\"\"") + .replace("\\", "\\\\") + .replace("\n", "\\r\\n"); + } +} diff --git a/launch4j/src/net/sf/launch4j/Util.java b/launch4j/src/net/sf/launch4j/Util.java index b1006b8..c96ef58 100644 --- a/launch4j/src/net/sf/launch4j/Util.java +++ b/launch4j/src/net/sf/launch4j/Util.java @@ -1,220 +1,220 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2005-04-24 - */ -package net.sf.launch4j; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Util { - public static final boolean WINDOWS_OS = System.getProperty("os.name") - .toLowerCase().startsWith("windows"); - - private static final String Launch4jProperties = "launch4j.properties"; - - private Util() {} - - public static Properties getProperties() throws IOException { - Properties props = new Properties(); - InputStream in = Main.class.getClassLoader().getResourceAsStream(Launch4jProperties); - props.load(in); - in.close(); - return props; - } - - public static File createTempFile(String suffix) throws IOException { - String tmpdir = System.getProperty("launch4j.tmpdir"); - if (tmpdir != null) { - if (tmpdir.indexOf(' ') != -1) { - throw new IOException(Messages.getString("Util.tmpdir")); - } - return File.createTempFile("launch4j", suffix, new File(tmpdir)); - } else { - return File.createTempFile("launch4j", suffix); - } - } - - public static File getJarBasedir() { - try { - URI uri = new URI(Util.class.getClassLoader() - .getResource(Launch4jProperties) - .getFile()); - - String path = uri.getPath(); - - if (path.startsWith("/") && path.contains("!")) { - // jar file - String jarPath = path.substring(0, path.lastIndexOf('!')); - String basedir = jarPath.substring(0, jarPath.lastIndexOf('/') + 1); - return new File(basedir); - } else { - // class files - launch4j development - return new File("."); - } - } catch (URISyntaxException e) { - throw new RuntimeException(e); - } - } - - public static File getAbsoluteFile(File basepath, File f) { - return f.isAbsolute() ? f : new File(basepath, f.getPath()); - } - - public static String getExtension(File f) { - String name = f.getName(); - int x = name.lastIndexOf('.'); - if (x != -1) { - return name.substring(x); - } else { - return ""; - } - } - - public static void exec(String[] cmd, Log log) throws ExecException { - BufferedReader is = null; - try { - if (WINDOWS_OS) { - for (int i = 0; i < cmd.length; i++) { - cmd[i] = cmd[i].replaceAll("/", "\\\\"); - } - } - Process p = Runtime.getRuntime().exec(cmd); - is = new BufferedReader(new InputStreamReader(p.getErrorStream())); - String line; - int errLine = -1; - Pattern pattern = Pattern.compile(":\\d+:"); - while ((line = is.readLine()) != null) { - log.append(line); - Matcher matcher = pattern.matcher(line); - if (matcher.find()) { - errLine = Integer.valueOf( - line.substring(matcher.start() + 1, matcher.end() - 1)) - .intValue(); - break; - } - } - is.close(); - p.waitFor(); - if (errLine != -1) { - StringBuffer sb = new StringBuffer(Messages.getString("Util.exec.failed")); - AppendCommandLine(sb, cmd); - throw new ExecException(sb.toString(), errLine); - } - if (p.exitValue() != 0) { - StringBuffer sb = new StringBuffer(Messages.getString("Util.exec.failed")); - sb.append(" ("); - sb.append(p.exitValue()); - sb.append(')'); - AppendCommandLine(sb, cmd); - throw new ExecException(sb.toString()); - } - } catch (IOException e) { - close(is); - throw new ExecException(e); - } catch (InterruptedException e) { - close(is); - throw new ExecException(e); - } - } - - private static void AppendCommandLine(StringBuffer sb, String[] cmd) { - sb.append(": "); - for (int i = 0; i < cmd.length; i++) { - sb.append(cmd[i]); - if (i < cmd.length - 1) { - sb.append(' '); - } - } - } - - public static void close(final InputStream o) { - if (o != null) { - try { - o.close(); - } catch (IOException e) { - System.err.println(e); // XXX log - } - } - } - - public static void close(final OutputStream o) { - if (o != null) { - try { - o.close(); - } catch (IOException e) { - System.err.println(e); // XXX log - } - } - } - - public static void close(final Reader o) { - if (o != null) { - try { - o.close(); - } catch (IOException e) { - System.err.println(e); // XXX log - } - } - } - - public static void close(final Writer o) { - if (o != null) { - try { - o.close(); - } catch (IOException e) { - System.err.println(e); // XXX log - } - } - } - - public static boolean delete(File f) { - return (f != null) ? f.delete() : false; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2005-04-24 + */ +package net.sf.launch4j; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.Reader; +import java.io.Writer; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Util { + public static final boolean WINDOWS_OS = System.getProperty("os.name") + .toLowerCase().startsWith("windows"); + + private static final String Launch4jProperties = "launch4j.properties"; + + private Util() {} + + public static Properties getProperties() throws IOException { + Properties props = new Properties(); + InputStream in = Main.class.getClassLoader().getResourceAsStream(Launch4jProperties); + props.load(in); + in.close(); + return props; + } + + public static File createTempFile(String suffix) throws IOException { + String tmpdir = System.getProperty("launch4j.tmpdir"); + if (tmpdir != null) { + if (tmpdir.indexOf(' ') != -1) { + throw new IOException(Messages.getString("Util.tmpdir")); + } + return File.createTempFile("launch4j", suffix, new File(tmpdir)); + } else { + return File.createTempFile("launch4j", suffix); + } + } + + public static File getJarBasedir() { + try { + URI uri = new URI(Util.class.getClassLoader() + .getResource(Launch4jProperties) + .getFile()); + + String path = uri.getPath(); + + if (path.startsWith("/") && path.contains("!")) { + // jar file + String jarPath = path.substring(0, path.lastIndexOf('!')); + String basedir = jarPath.substring(0, jarPath.lastIndexOf('/') + 1); + return new File(basedir); + } else { + // class files - launch4j development + return new File("."); + } + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + } + + public static File getAbsoluteFile(File basepath, File f) { + return f.isAbsolute() ? f : new File(basepath, f.getPath()); + } + + public static String getExtension(File f) { + String name = f.getName(); + int x = name.lastIndexOf('.'); + if (x != -1) { + return name.substring(x); + } else { + return ""; + } + } + + public static void exec(String[] cmd, Log log) throws ExecException { + BufferedReader is = null; + try { + if (WINDOWS_OS) { + for (int i = 0; i < cmd.length; i++) { + cmd[i] = cmd[i].replaceAll("/", "\\\\"); + } + } + Process p = Runtime.getRuntime().exec(cmd); + is = new BufferedReader(new InputStreamReader(p.getErrorStream())); + String line; + int errLine = -1; + Pattern pattern = Pattern.compile(":\\d+:"); + while ((line = is.readLine()) != null) { + log.append(line); + Matcher matcher = pattern.matcher(line); + if (matcher.find()) { + errLine = Integer.valueOf( + line.substring(matcher.start() + 1, matcher.end() - 1)) + .intValue(); + break; + } + } + is.close(); + p.waitFor(); + if (errLine != -1) { + StringBuffer sb = new StringBuffer(Messages.getString("Util.exec.failed")); + AppendCommandLine(sb, cmd); + throw new ExecException(sb.toString(), errLine); + } + if (p.exitValue() != 0) { + StringBuffer sb = new StringBuffer(Messages.getString("Util.exec.failed")); + sb.append(" ("); + sb.append(p.exitValue()); + sb.append(')'); + AppendCommandLine(sb, cmd); + throw new ExecException(sb.toString()); + } + } catch (IOException e) { + close(is); + throw new ExecException(e); + } catch (InterruptedException e) { + close(is); + throw new ExecException(e); + } + } + + private static void AppendCommandLine(StringBuffer sb, String[] cmd) { + sb.append(": "); + for (int i = 0; i < cmd.length; i++) { + sb.append(cmd[i]); + if (i < cmd.length - 1) { + sb.append(' '); + } + } + } + + public static void close(final InputStream o) { + if (o != null) { + try { + o.close(); + } catch (IOException e) { + System.err.println(e); // XXX log + } + } + } + + public static void close(final OutputStream o) { + if (o != null) { + try { + o.close(); + } catch (IOException e) { + System.err.println(e); // XXX log + } + } + } + + public static void close(final Reader o) { + if (o != null) { + try { + o.close(); + } catch (IOException e) { + System.err.println(e); // XXX log + } + } + } + + public static void close(final Writer o) { + if (o != null) { + try { + o.close(); + } catch (IOException e) { + System.err.println(e); // XXX log + } + } + } + + public static boolean delete(File f) { + return (f != null) ? f.delete() : false; + } +} diff --git a/launch4j/src/net/sf/launch4j/ant/AntClassPath.java b/launch4j/src/net/sf/launch4j/ant/AntClassPath.java index 171a930..7a7c30e 100644 --- a/launch4j/src/net/sf/launch4j/ant/AntClassPath.java +++ b/launch4j/src/net/sf/launch4j/ant/AntClassPath.java @@ -1,63 +1,63 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jul 19, 2006 - */ -package net.sf.launch4j.ant; - -import java.util.ArrayList; -import java.util.List; - -import net.sf.launch4j.config.ClassPath; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class AntClassPath extends ClassPath { - private final List wrappedPaths = new ArrayList(); - - public void setCp(String cp){ - StringWrapper wrapper = new StringWrapper(); - wrapper.addText(cp); - wrappedPaths.add(wrapper); - } - - public void addCp(StringWrapper cp) { - wrappedPaths.add(cp); - } - - public void unwrap() { - setPaths(StringWrapper.unwrap(wrappedPaths)); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jul 19, 2006 + */ +package net.sf.launch4j.ant; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.launch4j.config.ClassPath; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class AntClassPath extends ClassPath { + private final List wrappedPaths = new ArrayList(); + + public void setCp(String cp){ + StringWrapper wrapper = new StringWrapper(); + wrapper.addText(cp); + wrappedPaths.add(wrapper); + } + + public void addCp(StringWrapper cp) { + wrappedPaths.add(cp); + } + + public void unwrap() { + setPaths(StringWrapper.unwrap(wrappedPaths)); + } +} diff --git a/launch4j/src/net/sf/launch4j/ant/AntConfig.java b/launch4j/src/net/sf/launch4j/ant/AntConfig.java index ae4ed2f..bc6b284 100644 --- a/launch4j/src/net/sf/launch4j/ant/AntConfig.java +++ b/launch4j/src/net/sf/launch4j/ant/AntConfig.java @@ -1,131 +1,131 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 24, 2005 - */ -package net.sf.launch4j.ant; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tools.ant.BuildException; - -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.Msg; -import net.sf.launch4j.config.SingleInstance; -import net.sf.launch4j.config.Splash; -import net.sf.launch4j.config.VersionInfo; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class AntConfig extends Config { - private final List wrappedHeaderObjects = new ArrayList(); - private final List wrappedLibs = new ArrayList(); - private final List wrappedVariables = new ArrayList(); - - public void setJarPath(String path) { - setJar(new File(path)); - } - - public void addObj(StringWrapper obj) { - wrappedHeaderObjects.add(obj); - } - - public void addLib(StringWrapper lib) { - wrappedLibs.add(lib); - } - - public void addVar(StringWrapper var) { - wrappedVariables.add(var); - } - - // __________________________________________________________________________________ - - public void addSingleInstance(SingleInstance singleInstance) { - checkNull(getSingleInstance(), "singleInstance"); - setSingleInstance(singleInstance); - } - - public void addClassPath(AntClassPath classPath) { - checkNull(getClassPath(), "classPath"); - setClassPath(classPath); - } - - public void addJre(AntJre jre) { - checkNull(getJre(), "jre"); - setJre(jre); - } - - public void addSplash(Splash splash) { - checkNull(getSplash(), "splash"); - setSplash(splash); - } - - public void addVersionInfo(VersionInfo versionInfo) { - checkNull(getVersionInfo(), "versionInfo"); - setVersionInfo(versionInfo); - } - - public void addMessages(Msg messages) { - checkNull(getMessages(), "messages"); - setMessages(messages); - } - - // __________________________________________________________________________________ - - public void unwrap() { - setHeaderObjects(StringWrapper.unwrap(wrappedHeaderObjects)); - setLibs(StringWrapper.unwrap(wrappedLibs)); - setVariables(StringWrapper.unwrap(wrappedVariables)); - - if (getClassPath() != null) { - ((AntClassPath) getClassPath()).unwrap(); - } - - if (getJre() != null) { - ((AntJre) getJre()).unwrap(); - } - } - - private void checkNull(Object o, String name) { - if (o != null) { - throw new BuildException( - Messages.getString("AntConfig.duplicate.element") - + ": " - + name); - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 24, 2005 + */ +package net.sf.launch4j.ant; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.tools.ant.BuildException; + +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.Msg; +import net.sf.launch4j.config.SingleInstance; +import net.sf.launch4j.config.Splash; +import net.sf.launch4j.config.VersionInfo; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class AntConfig extends Config { + private final List wrappedHeaderObjects = new ArrayList(); + private final List wrappedLibs = new ArrayList(); + private final List wrappedVariables = new ArrayList(); + + public void setJarPath(String path) { + setJar(new File(path)); + } + + public void addObj(StringWrapper obj) { + wrappedHeaderObjects.add(obj); + } + + public void addLib(StringWrapper lib) { + wrappedLibs.add(lib); + } + + public void addVar(StringWrapper var) { + wrappedVariables.add(var); + } + + // __________________________________________________________________________________ + + public void addSingleInstance(SingleInstance singleInstance) { + checkNull(getSingleInstance(), "singleInstance"); + setSingleInstance(singleInstance); + } + + public void addClassPath(AntClassPath classPath) { + checkNull(getClassPath(), "classPath"); + setClassPath(classPath); + } + + public void addJre(AntJre jre) { + checkNull(getJre(), "jre"); + setJre(jre); + } + + public void addSplash(Splash splash) { + checkNull(getSplash(), "splash"); + setSplash(splash); + } + + public void addVersionInfo(VersionInfo versionInfo) { + checkNull(getVersionInfo(), "versionInfo"); + setVersionInfo(versionInfo); + } + + public void addMessages(Msg messages) { + checkNull(getMessages(), "messages"); + setMessages(messages); + } + + // __________________________________________________________________________________ + + public void unwrap() { + setHeaderObjects(StringWrapper.unwrap(wrappedHeaderObjects)); + setLibs(StringWrapper.unwrap(wrappedLibs)); + setVariables(StringWrapper.unwrap(wrappedVariables)); + + if (getClassPath() != null) { + ((AntClassPath) getClassPath()).unwrap(); + } + + if (getJre() != null) { + ((AntJre) getJre()).unwrap(); + } + } + + private void checkNull(Object o, String name) { + if (o != null) { + throw new BuildException( + Messages.getString("AntConfig.duplicate.element") + + ": " + + name); + } + } +} diff --git a/launch4j/src/net/sf/launch4j/ant/AntJre.java b/launch4j/src/net/sf/launch4j/ant/AntJre.java index ee30b77..e213432 100644 --- a/launch4j/src/net/sf/launch4j/ant/AntJre.java +++ b/launch4j/src/net/sf/launch4j/ant/AntJre.java @@ -1,69 +1,57 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jul 18, 2006 - */ -package net.sf.launch4j.ant; - -import java.util.ArrayList; -import java.util.List; - -import net.sf.launch4j.config.Jre; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class AntJre extends Jre { - private final List wrappedOptions = new ArrayList(); - - public void addOpt(StringWrapper opt) { - wrappedOptions.add(opt); - } - - public void unwrap() { - setOptions(StringWrapper.unwrap(wrappedOptions)); - } - - /** - * For backwards compatibility. - */ - public void setDontUsePrivateJres(boolean dontUse) { - if (dontUse) { - setJdkPreference(JDK_PREFERENCE_JRE_ONLY); - } - else { - setJdkPreference(JDK_PREFERENCE_PREFER_JRE); - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jul 18, 2006 + */ +package net.sf.launch4j.ant; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.launch4j.config.Jre; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class AntJre extends Jre { + private final List wrappedOptions = new ArrayList(); + + public void addOpt(StringWrapper opt) { + wrappedOptions.add(opt); + } + + public void unwrap() { + setOptions(StringWrapper.unwrap(wrappedOptions)); + } +} diff --git a/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java b/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java index 22234a1..f41c84f 100644 --- a/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java +++ b/launch4j/src/net/sf/launch4j/ant/Launch4jTask.java @@ -1,162 +1,162 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 24, 2005 - */ -package net.sf.launch4j.ant; - -import java.io.File; - -import net.sf.launch4j.Builder; -import net.sf.launch4j.BuilderException; -import net.sf.launch4j.Log; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.config.ConfigPersisterException; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Launch4jTask extends Task { - private File _configFile; - private AntConfig _config; - - // System properties - private File tmpdir; // launch4j.tmpdir - private File bindir; // launch4j.bindir - - // Override configFile settings - private File jar; - private File outfile; - private String fileVersion; - private String txtFileVersion; - private String productVersion; - private String txtProductVersion; - - public void execute() throws BuildException { - try { - if (tmpdir != null) { - System.setProperty("launch4j.tmpdir", tmpdir.getPath()); - } - if (bindir != null) { - System.setProperty("launch4j.bindir", bindir.getPath()); - } - if (_configFile != null && _config != null) { - throw new BuildException( - Messages.getString("Launch4jTask.specify.config")); - } else if (_configFile != null) { - ConfigPersister.getInstance().load(_configFile); - Config c = ConfigPersister.getInstance().getConfig(); - if (jar != null) { - c.setJar(jar); - } - if (outfile != null) { - c.setOutfile(outfile); - } - if (fileVersion != null) { - c.getVersionInfo().setFileVersion(fileVersion); - } - if (txtFileVersion != null) { - c.getVersionInfo().setTxtFileVersion(txtFileVersion); - } - if (productVersion != null) { - c.getVersionInfo().setProductVersion(productVersion); - } - if (txtProductVersion != null) { - c.getVersionInfo().setTxtProductVersion(txtProductVersion); - } - } else if (_config != null) { - _config.unwrap(); - ConfigPersister.getInstance().setAntConfig(_config, - getProject().getBaseDir()); - } else { - throw new BuildException( - Messages.getString("Launch4jTask.specify.config")); - } - final Builder b = new Builder(Log.getAntLog()); - b.build(); - } catch (ConfigPersisterException e) { - throw new BuildException(e); - } catch (BuilderException e) { - throw new BuildException(e); - } - } - - public void setConfigFile(File configFile) { - _configFile = configFile; - } - - public void addConfig(AntConfig config) { - _config = config; - } - - public void setBindir(File bindir) { - this.bindir = bindir; - } - - public void setTmpdir(File tmpdir) { - this.tmpdir = tmpdir; - } - - public void setFileVersion(String fileVersion) { - this.fileVersion = fileVersion; - } - - public void setJar(File jar) { - this.jar = jar; - } - - public void setJarPath(String path) { - this.jar = new File(path); - } - - public void setOutfile(File outfile) { - this.outfile = outfile; - } - - public void setProductVersion(String productVersion) { - this.productVersion = productVersion; - } - - public void setTxtFileVersion(String txtFileVersion) { - this.txtFileVersion = txtFileVersion; - } - - public void setTxtProductVersion(String txtProductVersion) { - this.txtProductVersion = txtProductVersion; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 24, 2005 + */ +package net.sf.launch4j.ant; + +import java.io.File; + +import net.sf.launch4j.Builder; +import net.sf.launch4j.BuilderException; +import net.sf.launch4j.Log; +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.config.ConfigPersisterException; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Launch4jTask extends Task { + private File _configFile; + private AntConfig _config; + + // System properties + private File tmpdir; // launch4j.tmpdir + private File bindir; // launch4j.bindir + + // Override configFile settings + private File jar; + private File outfile; + private String fileVersion; + private String txtFileVersion; + private String productVersion; + private String txtProductVersion; + + public void execute() throws BuildException { + try { + if (tmpdir != null) { + System.setProperty("launch4j.tmpdir", tmpdir.getPath()); + } + if (bindir != null) { + System.setProperty("launch4j.bindir", bindir.getPath()); + } + if (_configFile != null && _config != null) { + throw new BuildException( + Messages.getString("Launch4jTask.specify.config")); + } else if (_configFile != null) { + ConfigPersister.getInstance().load(_configFile); + Config c = ConfigPersister.getInstance().getConfig(); + if (jar != null) { + c.setJar(jar); + } + if (outfile != null) { + c.setOutfile(outfile); + } + if (fileVersion != null) { + c.getVersionInfo().setFileVersion(fileVersion); + } + if (txtFileVersion != null) { + c.getVersionInfo().setTxtFileVersion(txtFileVersion); + } + if (productVersion != null) { + c.getVersionInfo().setProductVersion(productVersion); + } + if (txtProductVersion != null) { + c.getVersionInfo().setTxtProductVersion(txtProductVersion); + } + } else if (_config != null) { + _config.unwrap(); + ConfigPersister.getInstance().setAntConfig(_config, + getProject().getBaseDir()); + } else { + throw new BuildException( + Messages.getString("Launch4jTask.specify.config")); + } + final Builder b = new Builder(Log.getAntLog()); + b.build(); + } catch (ConfigPersisterException e) { + throw new BuildException(e); + } catch (BuilderException e) { + throw new BuildException(e); + } + } + + public void setConfigFile(File configFile) { + _configFile = configFile; + } + + public void addConfig(AntConfig config) { + _config = config; + } + + public void setBindir(File bindir) { + this.bindir = bindir; + } + + public void setTmpdir(File tmpdir) { + this.tmpdir = tmpdir; + } + + public void setFileVersion(String fileVersion) { + this.fileVersion = fileVersion; + } + + public void setJar(File jar) { + this.jar = jar; + } + + public void setJarPath(String path) { + this.jar = new File(path); + } + + public void setOutfile(File outfile) { + this.outfile = outfile; + } + + public void setProductVersion(String productVersion) { + this.productVersion = productVersion; + } + + public void setTxtFileVersion(String txtFileVersion) { + this.txtFileVersion = txtFileVersion; + } + + public void setTxtProductVersion(String txtProductVersion) { + this.txtProductVersion = txtProductVersion; + } +} diff --git a/launch4j/src/net/sf/launch4j/ant/Messages.java b/launch4j/src/net/sf/launch4j/ant/Messages.java index 7bd5262..375787e 100644 --- a/launch4j/src/net/sf/launch4j/ant/Messages.java +++ b/launch4j/src/net/sf/launch4j/ant/Messages.java @@ -1,55 +1,55 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.ant; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.ant.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.ant; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.ant.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/launch4j/src/net/sf/launch4j/ant/StringWrapper.java b/launch4j/src/net/sf/launch4j/ant/StringWrapper.java index 70ab715..ecbfd39 100644 --- a/launch4j/src/net/sf/launch4j/ant/StringWrapper.java +++ b/launch4j/src/net/sf/launch4j/ant/StringWrapper.java @@ -1,69 +1,69 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jul 18, 2006 - */ -package net.sf.launch4j.ant; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class StringWrapper { - private String text; - - public static List unwrap(List wrappers) { - if (wrappers.isEmpty()) { - return null; - } - - List strings = new ArrayList(wrappers.size()); - - for (StringWrapper w : wrappers) { - strings.add(w.toString()); - } - - return strings; - } - - public void addText(String text) { - this.text = text; - } - - public String toString() { - return text; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jul 18, 2006 + */ +package net.sf.launch4j.ant; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class StringWrapper { + private String text; + + public static List unwrap(List wrappers) { + if (wrappers.isEmpty()) { + return null; + } + + List strings = new ArrayList(wrappers.size()); + + for (StringWrapper w : wrappers) { + strings.add(w.toString()); + } + + return strings; + } + + public void addText(String text) { + this.text = text; + } + + public String toString() { + return text; + } +} diff --git a/launch4j/src/net/sf/launch4j/ant/messages.properties b/launch4j/src/net/sf/launch4j/ant/messages.properties index b78a6f8..8131029 100644 --- a/launch4j/src/net/sf/launch4j/ant/messages.properties +++ b/launch4j/src/net/sf/launch4j/ant/messages.properties @@ -1,35 +1,35 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2015 Grzegorz Kowal -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Launch4jTask.specify.config=Specify configFile or config -AntConfig.duplicate.element=Duplicate element +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2015 Grzegorz Kowal +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +Launch4jTask.specify.config=Specify configFile or config +AntConfig.duplicate.element=Duplicate element diff --git a/launch4j/src/net/sf/launch4j/ant/messages_es.properties b/launch4j/src/net/sf/launch4j/ant/messages_es.properties deleted file mode 100644 index a48d4a8..0000000 --- a/launch4j/src/net/sf/launch4j/ant/messages_es.properties +++ /dev/null @@ -1,35 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Launch4jTask.specify.config=Specify configFile or config -AntConfig.duplicate.element=Duplicate element diff --git a/launch4j/src/net/sf/launch4j/binding/Binding.java b/launch4j/src/net/sf/launch4j/binding/Binding.java index e4202dd..4cf6f19 100644 --- a/launch4j/src/net/sf/launch4j/binding/Binding.java +++ b/launch4j/src/net/sf/launch4j/binding/Binding.java @@ -1,62 +1,62 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public interface Binding { - /** Used to mark components with invalid data. */ - public final static Color INVALID_COLOR = Color.PINK; - - /** Java Bean property bound to a component */ - public String getProperty(); - /** Clear component, set it to the default value */ - public void clear(IValidatable bean); - /** Java Bean property -> Component */ - public void put(IValidatable bean); - /** Component -> Java Bean property */ - public void get(IValidatable bean); - /** Mark component as valid */ - public void markValid(); - /** Mark component as invalid */ - public void markInvalid(); - /** Enable or disable the component */ - public void setEnabled(boolean enabled); -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public interface Binding { + /** Used to mark components with invalid data. */ + public final static Color INVALID_COLOR = Color.PINK; + + /** Java Bean property bound to a component */ + public String getProperty(); + /** Clear component, set it to the default value */ + public void clear(IValidatable bean); + /** Java Bean property -> Component */ + public void put(IValidatable bean); + /** Component -> Java Bean property */ + public void get(IValidatable bean); + /** Mark component as valid */ + public void markValid(); + /** Mark component as invalid */ + public void markInvalid(); + /** Enable or disable the component */ + public void setEnabled(boolean enabled); +} diff --git a/launch4j/src/net/sf/launch4j/binding/BindingException.java b/launch4j/src/net/sf/launch4j/binding/BindingException.java index 868a1df..170c757 100644 --- a/launch4j/src/net/sf/launch4j/binding/BindingException.java +++ b/launch4j/src/net/sf/launch4j/binding/BindingException.java @@ -1,52 +1,52 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -/** - * Signals a runtime error, a missing property in a Java Bean for example. - * - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class BindingException extends RuntimeException { - public BindingException(Throwable t) { - super(t); - } - - public BindingException(String msg) { - super(msg); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +/** + * Signals a runtime error, a missing property in a Java Bean for example. + * + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class BindingException extends RuntimeException { + public BindingException(Throwable t) { + super(t); + } + + public BindingException(String msg) { + super(msg); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/Bindings.java b/launch4j/src/net/sf/launch4j/binding/Bindings.java index 29ddb7f..2a4fdab 100644 --- a/launch4j/src/net/sf/launch4j/binding/Bindings.java +++ b/launch4j/src/net/sf/launch4j/binding/Bindings.java @@ -1,333 +1,333 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.HashMap; -import java.util.Map; - -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JList; -import javax.swing.JRadioButton; -import javax.swing.JTextArea; -import javax.swing.JToggleButton; -import javax.swing.text.JTextComponent; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * Creates and handles bindings. - * - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Bindings implements PropertyChangeListener, ActionListener { - private final Map _bindings = new HashMap(); - private final Map _optComponents = new HashMap(); - private boolean _modified = false; - - /** - * Used to track component modifications. - */ - @Override - public void propertyChange(PropertyChangeEvent evt) { - String prop = evt.getPropertyName(); - if ("AccessibleValue".equals(prop) - || "AccessibleText".equals(prop) - || ("AccessibleVisibleData".equals(prop) - && evt.getSource().getClass().getName().contains("JList"))) { - _modified = true; - } - } - - @Override - public void actionPerformed(ActionEvent e) { - _modified = true; - } - - /** - * Any of the components modified? - */ - public boolean isModified() { - return _modified; - } - - public Binding getBinding(String property) { - return _bindings.get(property); - } - - private void registerPropertyChangeListener(JComponent c) { - c.getAccessibleContext().addPropertyChangeListener(this); - } - - private void registerPropertyChangeListener(JComponent[] components) { - for (JComponent c : components) { - c.getAccessibleContext().addPropertyChangeListener(this); - } - } - - private boolean isPropertyNull(IValidatable bean, Binding b) { - try { - for (String property : _optComponents.keySet()) { - if (b.getProperty().startsWith(property)) { - return PropertyUtils.getProperty(bean, property) == null; - } - } - - return false; - } catch (Exception e) { - throw new BindingException(e); - } - } - - /** - * Enables or disables all components bound to properties that begin with given prefix. - */ - public void setComponentsEnabled(String prefix, boolean enabled) { - for (Binding b : _bindings.values()) { - if (b.getProperty().startsWith(prefix)) { - b.setEnabled(enabled); - } - } - } - - /** - * Clear all components, set them to their default values. - * Clears the _modified flag. - */ - public void clear(IValidatable bean) { - for (Binding b : _optComponents.values()) { - b.clear(bean); - } - - for (Binding b : _bindings.values()) { - b.clear(bean); - } - - _modified = false; - } - - /** - * Copies data from the Java Bean to the UI components. - * Clears the _modified flag. - */ - public void put(IValidatable bean) { - for (Binding b : _optComponents.values()) { - b.put(bean); - } - - for (Binding b : _bindings.values()) { - if (isPropertyNull(bean, b)) { - b.clear(null); - } else { - b.put(bean); - } - } - - _modified = false; - } - - /** - * Copies data from UI components to the Java Bean and checks it's class invariants. - * Clears the _modified flag. - * @throws InvariantViolationException - * @throws BindingException - */ - public void get(IValidatable bean) { - try { - for (Binding b : _optComponents.values()) { - b.get(bean); - } - - for (Binding b : _bindings.values()) { - if (!isPropertyNull(bean, b)) { - b.get(bean); - } - } - - bean.checkInvariants(); - - for (String property : _optComponents.keySet()) { - IValidatable component = (IValidatable) PropertyUtils.getProperty(bean, - property); - - if (component != null) { - component.checkInvariants(); - } - } - - _modified = false; // XXX - } catch (InvariantViolationException e) { - e.setBinding(getBinding(e.getProperty())); - throw e; - } catch (Exception e) { - throw new BindingException(e); - } - } - - private Bindings add(Binding b) { - if (_bindings.containsKey(b.getProperty())) { - throw new BindingException(Messages.getString("Bindings.duplicate.binding")); - } - - _bindings.put(b.getProperty(), b); - return this; - } - - /** - * Add an optional (nullable) Java Bean component of type clazz. - */ - public Bindings addOptComponent(String property, Class clazz, JToggleButton c, - boolean enabledByDefault) { - Binding b = new OptComponentBinding(this, property, clazz, c, enabledByDefault); - - if (_optComponents.containsKey(property)) { - throw new BindingException(Messages.getString("Bindings.duplicate.binding")); - } - - _optComponents.put(property, b); - return this; - } - - /** - * Add an optional (nullable) Java Bean component of type clazz. - */ - public Bindings addOptComponent(String property, Class clazz, JToggleButton c) { - return addOptComponent(property, clazz, c, false); - } - - /** - * Handles JEditorPane, JTextArea, JTextField - */ - public Bindings add(String property, JTextComponent c, String defaultValue) { - registerPropertyChangeListener(c); - return add(new JTextComponentBinding(property, c, defaultValue)); - } - - /** - * Handles JEditorPane, JTextArea, JTextField - */ - public Bindings add(String property, JTextComponent c) { - registerPropertyChangeListener(c); - return add(new JTextComponentBinding(property, c, "")); - } - - /** - * Handles JToggleButton, JCheckBox - */ - public Bindings add(String property, JToggleButton c, boolean defaultValue) { - registerPropertyChangeListener(c); - return add(new JToggleButtonBinding(property, c, defaultValue)); - } - - /** - * Handles JToggleButton, JCheckBox - */ - public Bindings add(String property, JToggleButton c) { - registerPropertyChangeListener(c); - return add(new JToggleButtonBinding(property, c, false)); - } - - /** - * Handles JRadioButton - */ - public Bindings add(String property, JRadioButton[] cs, int defaultValue) { - registerPropertyChangeListener(cs); - return add(new JRadioButtonBinding(property, cs, defaultValue)); - } - - /** - * Handles JRadioButton - */ - public Bindings add(String property, JRadioButton[] cs) { - registerPropertyChangeListener(cs); - return add(new JRadioButtonBinding(property, cs, 0)); - } - - /** - * Handles JTextArea - */ - public Bindings add(String property, JTextArea textArea, String defaultValue) { - registerPropertyChangeListener(textArea); - return add(new JTextComponentBinding(property, textArea, defaultValue)); - } - - /** - * Handles JTextArea lists - */ - public Bindings add(String property, JTextArea textArea) { - registerPropertyChangeListener(textArea); - return add(new JTextAreaBinding(property, textArea)); - } - - /** - * Handles Optional JTextArea lists - */ - public Bindings add(String property, String stateProperty, - JToggleButton button, JTextArea textArea) { - registerPropertyChangeListener(button); - registerPropertyChangeListener(textArea); - return add(new OptJTextAreaBinding(property, stateProperty, button, textArea)); - } - - /** - * Handles JList - */ - public Bindings add(String property, JList list) { - registerPropertyChangeListener(list); - return add(new JListBinding(property, list)); - } - - /** - * Handles JComboBox - */ - public Bindings add(String property, JComboBox combo, int defaultValue) { - combo.addActionListener(this); - return add(new JComboBoxBinding(property, combo, defaultValue)); - } - - /** - * Handles JComboBox - */ - public Bindings add(String property, JComboBox combo) { - combo.addActionListener(this); - return add(new JComboBoxBinding(property, combo, 0)); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.HashMap; +import java.util.Map; + +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JList; +import javax.swing.JRadioButton; +import javax.swing.JTextArea; +import javax.swing.JToggleButton; +import javax.swing.text.JTextComponent; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * Creates and handles bindings. + * + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Bindings implements PropertyChangeListener, ActionListener { + private final Map _bindings = new HashMap(); + private final Map _optComponents = new HashMap(); + private boolean _modified = false; + + /** + * Used to track component modifications. + */ + @Override + public void propertyChange(PropertyChangeEvent evt) { + String prop = evt.getPropertyName(); + if ("AccessibleValue".equals(prop) + || "AccessibleText".equals(prop) + || ("AccessibleVisibleData".equals(prop) + && evt.getSource().getClass().getName().contains("JList"))) { + _modified = true; + } + } + + @Override + public void actionPerformed(ActionEvent e) { + _modified = true; + } + + /** + * Any of the components modified? + */ + public boolean isModified() { + return _modified; + } + + public Binding getBinding(String property) { + return _bindings.get(property); + } + + private void registerPropertyChangeListener(JComponent c) { + c.getAccessibleContext().addPropertyChangeListener(this); + } + + private void registerPropertyChangeListener(JComponent[] components) { + for (JComponent c : components) { + c.getAccessibleContext().addPropertyChangeListener(this); + } + } + + private boolean isPropertyNull(IValidatable bean, Binding b) { + try { + for (String property : _optComponents.keySet()) { + if (b.getProperty().startsWith(property)) { + return PropertyUtils.getProperty(bean, property) == null; + } + } + + return false; + } catch (Exception e) { + throw new BindingException(e); + } + } + + /** + * Enables or disables all components bound to properties that begin with given prefix. + */ + public void setComponentsEnabled(String prefix, boolean enabled) { + for (Binding b : _bindings.values()) { + if (b.getProperty().startsWith(prefix)) { + b.setEnabled(enabled); + } + } + } + + /** + * Clear all components, set them to their default values. + * Clears the _modified flag. + */ + public void clear(IValidatable bean) { + for (Binding b : _optComponents.values()) { + b.clear(bean); + } + + for (Binding b : _bindings.values()) { + b.clear(bean); + } + + _modified = false; + } + + /** + * Copies data from the Java Bean to the UI components. + * Clears the _modified flag. + */ + public void put(IValidatable bean) { + for (Binding b : _optComponents.values()) { + b.put(bean); + } + + for (Binding b : _bindings.values()) { + if (isPropertyNull(bean, b)) { + b.clear(null); + } else { + b.put(bean); + } + } + + _modified = false; + } + + /** + * Copies data from UI components to the Java Bean and checks it's class invariants. + * Clears the _modified flag. + * @throws InvariantViolationException + * @throws BindingException + */ + public void get(IValidatable bean) { + try { + for (Binding b : _optComponents.values()) { + b.get(bean); + } + + for (Binding b : _bindings.values()) { + if (!isPropertyNull(bean, b)) { + b.get(bean); + } + } + + bean.checkInvariants(); + + for (String property : _optComponents.keySet()) { + IValidatable component = (IValidatable) PropertyUtils.getProperty(bean, + property); + + if (component != null) { + component.checkInvariants(); + } + } + + _modified = false; // XXX + } catch (InvariantViolationException e) { + e.setBinding(getBinding(e.getProperty())); + throw e; + } catch (Exception e) { + throw new BindingException(e); + } + } + + private Bindings add(Binding b) { + if (_bindings.containsKey(b.getProperty())) { + throw new BindingException(Messages.getString("Bindings.duplicate.binding")); + } + + _bindings.put(b.getProperty(), b); + return this; + } + + /** + * Add an optional (nullable) Java Bean component of type clazz. + */ + public Bindings addOptComponent(String property, Class clazz, JToggleButton c, + boolean enabledByDefault) { + Binding b = new OptComponentBinding(this, property, clazz, c, enabledByDefault); + + if (_optComponents.containsKey(property)) { + throw new BindingException(Messages.getString("Bindings.duplicate.binding")); + } + + _optComponents.put(property, b); + return this; + } + + /** + * Add an optional (nullable) Java Bean component of type clazz. + */ + public Bindings addOptComponent(String property, Class clazz, JToggleButton c) { + return addOptComponent(property, clazz, c, false); + } + + /** + * Handles JEditorPane, JTextArea, JTextField + */ + public Bindings add(String property, JTextComponent c, String defaultValue) { + registerPropertyChangeListener(c); + return add(new JTextComponentBinding(property, c, defaultValue)); + } + + /** + * Handles JEditorPane, JTextArea, JTextField + */ + public Bindings add(String property, JTextComponent c) { + registerPropertyChangeListener(c); + return add(new JTextComponentBinding(property, c, "")); + } + + /** + * Handles JToggleButton, JCheckBox + */ + public Bindings add(String property, JToggleButton c, boolean defaultValue) { + registerPropertyChangeListener(c); + return add(new JToggleButtonBinding(property, c, defaultValue)); + } + + /** + * Handles JToggleButton, JCheckBox + */ + public Bindings add(String property, JToggleButton c) { + registerPropertyChangeListener(c); + return add(new JToggleButtonBinding(property, c, false)); + } + + /** + * Handles JRadioButton + */ + public Bindings add(String property, JRadioButton[] cs, int defaultValue) { + registerPropertyChangeListener(cs); + return add(new JRadioButtonBinding(property, cs, defaultValue)); + } + + /** + * Handles JRadioButton + */ + public Bindings add(String property, JRadioButton[] cs) { + registerPropertyChangeListener(cs); + return add(new JRadioButtonBinding(property, cs, 0)); + } + + /** + * Handles JTextArea + */ + public Bindings add(String property, JTextArea textArea, String defaultValue) { + registerPropertyChangeListener(textArea); + return add(new JTextComponentBinding(property, textArea, defaultValue)); + } + + /** + * Handles JTextArea lists + */ + public Bindings add(String property, JTextArea textArea) { + registerPropertyChangeListener(textArea); + return add(new JTextAreaBinding(property, textArea)); + } + + /** + * Handles Optional JTextArea lists + */ + public Bindings add(String property, String stateProperty, + JToggleButton button, JTextArea textArea) { + registerPropertyChangeListener(button); + registerPropertyChangeListener(textArea); + return add(new OptJTextAreaBinding(property, stateProperty, button, textArea)); + } + + /** + * Handles JList + */ + public Bindings add(String property, JList list) { + registerPropertyChangeListener(list); + return add(new JListBinding(property, list)); + } + + /** + * Handles JComboBox + */ + public Bindings add(String property, JComboBox combo, int defaultValue) { + combo.addActionListener(this); + return add(new JComboBoxBinding(property, combo, defaultValue)); + } + + /** + * Handles JComboBox + */ + public Bindings add(String property, JComboBox combo) { + combo.addActionListener(this); + return add(new JComboBoxBinding(property, combo, 0)); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/IValidatable.java b/launch4j/src/net/sf/launch4j/binding/IValidatable.java index 4865967..f8fcd21 100644 --- a/launch4j/src/net/sf/launch4j/binding/IValidatable.java +++ b/launch4j/src/net/sf/launch4j/binding/IValidatable.java @@ -1,44 +1,44 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2004-01-30 - */ -package net.sf.launch4j.binding; - -/** - * @author Copyright (C) 2004 Grzegorz Kowal - */ -public interface IValidatable { - public void checkInvariants(); -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2004-01-30 + */ +package net.sf.launch4j.binding; + +/** + * @author Copyright (C) 2004 Grzegorz Kowal + */ +public interface IValidatable { + public void checkInvariants(); +} diff --git a/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java b/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java index 67db27b..004caf4 100644 --- a/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java +++ b/launch4j/src/net/sf/launch4j/binding/InvariantViolationException.java @@ -1,67 +1,67 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jun 23, 2003 - */ -package net.sf.launch4j.binding; - -/** - * @author Copyright (C) 2003 Grzegorz Kowal - */ -public class InvariantViolationException extends RuntimeException { - private final String _property; - private Binding _binding; - - public InvariantViolationException(String msg) { - super(msg); - _property = null; - } - - public InvariantViolationException(String property, String msg) { - super(msg); - _property = property; - } - - public String getProperty() { - return _property; - } - - public Binding getBinding() { - return _binding; - } - - public void setBinding(Binding binding) { - _binding = binding; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jun 23, 2003 + */ +package net.sf.launch4j.binding; + +/** + * @author Copyright (C) 2003 Grzegorz Kowal + */ +public class InvariantViolationException extends RuntimeException { + private final String _property; + private Binding _binding; + + public InvariantViolationException(String msg) { + super(msg); + _property = null; + } + + public InvariantViolationException(String property, String msg) { + super(msg); + _property = property; + } + + public String getProperty() { + return _property; + } + + public Binding getBinding() { + return _binding; + } + + public void setBinding(Binding binding) { + _binding = binding; + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java b/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java index a3f611e..695c1cc 100644 --- a/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java +++ b/launch4j/src/net/sf/launch4j/binding/JComboBoxBinding.java @@ -1,119 +1,119 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2007 Ian Roberts - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 10, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -import javax.swing.JComboBox; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2007 Ian Roberts - */ -public class JComboBoxBinding implements Binding { - private final String _property; - private final JComboBox _combo; - private final int _defaultValue; - private final Color _validColor; - - public JComboBoxBinding(String property, JComboBox combo, int defaultValue) { - if (property == null || combo == null) { - throw new NullPointerException(); - } - if (property.equals("") - || combo.getItemCount() == 0 - || defaultValue < 0 || defaultValue >= combo.getItemCount()) { - throw new IllegalArgumentException(); - } - _property = property; - _combo = combo; - _defaultValue = defaultValue; - _validColor = combo.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - select(_defaultValue); - } - - public void put(IValidatable bean) { - try { - Integer i = (Integer) PropertyUtils.getProperty(bean, _property); - if (i == null) { - throw new BindingException( - Messages.getString("JComboBoxBinding.property.null")); - } - select(i.intValue()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - PropertyUtils.setProperty(bean, _property, new Integer(_combo.getSelectedIndex())); - return; - } catch (Exception e) { - throw new BindingException(e); - } - } - - private void select(int index) { - if (index < 0 || index >= _combo.getItemCount()) { - throw new BindingException( - Messages.getString("JComboBoxBinding.index.out.of.bounds")); - } - _combo.setSelectedIndex(index); - } - - public void markValid() { - _combo.setBackground(_validColor); - _combo.requestFocusInWindow(); - } - - public void markInvalid() { - _combo.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _combo.setEnabled(enabled); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2007 Ian Roberts + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 10, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +import javax.swing.JComboBox; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2007 Ian Roberts + */ +public class JComboBoxBinding implements Binding { + private final String _property; + private final JComboBox _combo; + private final int _defaultValue; + private final Color _validColor; + + public JComboBoxBinding(String property, JComboBox combo, int defaultValue) { + if (property == null || combo == null) { + throw new NullPointerException(); + } + if (property.equals("") + || combo.getItemCount() == 0 + || defaultValue < 0 || defaultValue >= combo.getItemCount()) { + throw new IllegalArgumentException(); + } + _property = property; + _combo = combo; + _defaultValue = defaultValue; + _validColor = combo.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + select(_defaultValue); + } + + public void put(IValidatable bean) { + try { + Integer i = (Integer) PropertyUtils.getProperty(bean, _property); + if (i == null) { + throw new BindingException( + Messages.getString("JComboBoxBinding.property.null")); + } + select(i.intValue()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + PropertyUtils.setProperty(bean, _property, new Integer(_combo.getSelectedIndex())); + return; + } catch (Exception e) { + throw new BindingException(e); + } + } + + private void select(int index) { + if (index < 0 || index >= _combo.getItemCount()) { + throw new BindingException( + Messages.getString("JComboBoxBinding.index.out.of.bounds")); + } + _combo.setSelectedIndex(index); + } + + public void markValid() { + _combo.setBackground(_validColor); + _combo.requestFocusInWindow(); + } + + public void markInvalid() { + _combo.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _combo.setEnabled(enabled); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/JListBinding.java b/launch4j/src/net/sf/launch4j/binding/JListBinding.java index 060f89f..10176f6 100644 --- a/launch4j/src/net/sf/launch4j/binding/JListBinding.java +++ b/launch4j/src/net/sf/launch4j/binding/JListBinding.java @@ -1,121 +1,122 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.DefaultListModel; -import javax.swing.JList; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class JListBinding implements Binding { - private final String _property; - private final JList _list; - private final Color _validColor; - - public JListBinding(String property, JList list) { - if (property == null || list == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _list = list; - _validColor = _list.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - _list.setModel(new DefaultListModel()); - } - - public void put(IValidatable bean) { - try { - DefaultListModel model = new DefaultListModel(); - List list = (List) PropertyUtils.getProperty(bean, _property); - - if (list != null) { - for (Object o : list) { - model.addElement(o); - } - } - - _list.setModel(model); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - DefaultListModel model = (DefaultListModel) _list.getModel(); - final int size = model.getSize(); - List list = new ArrayList(size); - - for (int i = 0; i < size; i++) { - list.add(model.get(i)); - } - - PropertyUtils.setProperty(bean, _property, list); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _list.setBackground(_validColor); - _list.requestFocusInWindow(); - } - - public void markInvalid() { - _list.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _list.setEnabled(enabled); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.DefaultListModel; +import javax.swing.JList; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class JListBinding implements Binding { + private final String _property; + private final JList _list; + private final Color _validColor; + + public JListBinding(String property, JList list) { + if (property == null || list == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _list = list; + _validColor = _list.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + _list.setModel(new DefaultListModel()); + } + + public void put(IValidatable bean) { + try { + DefaultListModel model = new DefaultListModel(); + @SuppressWarnings("unchecked") + List list = (List) PropertyUtils.getProperty(bean, _property); + + if (list != null) { + for (T item : list) { + model.addElement(item); + } + } + + _list.setModel(model); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + DefaultListModel model = (DefaultListModel) _list.getModel(); + final int size = model.getSize(); + List list = new ArrayList(size); + + for (int i = 0; i < size; i++) { + list.add(model.get(i)); + } + + PropertyUtils.setProperty(bean, _property, list); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _list.setBackground(_validColor); + _list.requestFocusInWindow(); + } + + public void markInvalid() { + _list.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _list.setEnabled(enabled); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java b/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java index 345f802..b9e458b 100644 --- a/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java +++ b/launch4j/src/net/sf/launch4j/binding/JRadioButtonBinding.java @@ -1,146 +1,146 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 10, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -import javax.swing.JRadioButton; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class JRadioButtonBinding implements Binding { - private final String _property; - private final JRadioButton[] _buttons; - private final int _defaultValue; - private final Color _validColor; - - public JRadioButtonBinding(String property, JRadioButton[] buttons, int defaultValue) { - if (property == null || buttons == null) { - throw new NullPointerException(); - } - for (int i = 0; i < buttons.length; i++) { - if (buttons[i] == null) { - throw new NullPointerException(); - } - } - if (property.equals("") - || buttons.length == 0 - || defaultValue < 0 || defaultValue >= buttons.length) { - throw new IllegalArgumentException(); - } - _property = property; - _buttons = buttons; - _defaultValue = defaultValue; - _validColor = buttons[0].getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - select(_defaultValue); - } - - public void put(IValidatable bean) { - try { - Integer i = (Integer) PropertyUtils.getProperty(bean, _property); - if (i == null) { - throw new BindingException( - Messages.getString("JRadioButtonBinding.property.null")); - } - select(i.intValue()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - for (int i = 0; i < _buttons.length; i++) { - if (_buttons[i].isSelected()) { - PropertyUtils.setProperty(bean, _property, new Integer(i)); - return; - } - } - throw new BindingException( - Messages.getString("JRadioButtonBinding.nothing.selected")); - } catch (Exception e) { - throw new BindingException(e); - } - } - - private void select(int index) { - if (index < 0 || index >= _buttons.length) { - throw new BindingException( - Messages.getString("JRadioButtonBinding.index.out.of.bounds")); - } - _buttons[index].setSelected(true); - } - - public void markValid() { - for (int i = 0; i < _buttons.length; i++) { - if (_buttons[i].isSelected()) { - _buttons[i].setBackground(_validColor); - _buttons[i].requestFocusInWindow(); - return; - } - } - throw new BindingException( - Messages.getString("JRadioButtonBinding.nothing.selected")); - } - - public void markInvalid() { - for (int i = 0; i < _buttons.length; i++) { - if (_buttons[i].isSelected()) { - _buttons[i].setBackground(Binding.INVALID_COLOR); - return; - } - } - throw new BindingException( - Messages.getString("JRadioButtonBinding.nothing.selected")); - } - - public void setEnabled(boolean enabled) { - for (int i = 0; i < _buttons.length; i++) { - _buttons[i].setEnabled(enabled); - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 10, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +import javax.swing.JRadioButton; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class JRadioButtonBinding implements Binding { + private final String _property; + private final JRadioButton[] _buttons; + private final int _defaultValue; + private final Color _validColor; + + public JRadioButtonBinding(String property, JRadioButton[] buttons, int defaultValue) { + if (property == null || buttons == null) { + throw new NullPointerException(); + } + for (int i = 0; i < buttons.length; i++) { + if (buttons[i] == null) { + throw new NullPointerException(); + } + } + if (property.equals("") + || buttons.length == 0 + || defaultValue < 0 || defaultValue >= buttons.length) { + throw new IllegalArgumentException(); + } + _property = property; + _buttons = buttons; + _defaultValue = defaultValue; + _validColor = buttons[0].getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + select(_defaultValue); + } + + public void put(IValidatable bean) { + try { + Integer i = (Integer) PropertyUtils.getProperty(bean, _property); + if (i == null) { + throw new BindingException( + Messages.getString("JRadioButtonBinding.property.null")); + } + select(i.intValue()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + for (int i = 0; i < _buttons.length; i++) { + if (_buttons[i].isSelected()) { + PropertyUtils.setProperty(bean, _property, new Integer(i)); + return; + } + } + throw new BindingException( + Messages.getString("JRadioButtonBinding.nothing.selected")); + } catch (Exception e) { + throw new BindingException(e); + } + } + + private void select(int index) { + if (index < 0 || index >= _buttons.length) { + throw new BindingException( + Messages.getString("JRadioButtonBinding.index.out.of.bounds")); + } + _buttons[index].setSelected(true); + } + + public void markValid() { + for (int i = 0; i < _buttons.length; i++) { + if (_buttons[i].isSelected()) { + _buttons[i].setBackground(_validColor); + _buttons[i].requestFocusInWindow(); + return; + } + } + throw new BindingException( + Messages.getString("JRadioButtonBinding.nothing.selected")); + } + + public void markInvalid() { + for (int i = 0; i < _buttons.length; i++) { + if (_buttons[i].isSelected()) { + _buttons[i].setBackground(Binding.INVALID_COLOR); + return; + } + } + throw new BindingException( + Messages.getString("JRadioButtonBinding.nothing.selected")); + } + + public void setEnabled(boolean enabled) { + for (int i = 0; i < _buttons.length; i++) { + _buttons[i].setEnabled(enabled); + } + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java b/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java index e018797..282afe9 100644 --- a/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java +++ b/launch4j/src/net/sf/launch4j/binding/JTextAreaBinding.java @@ -1,128 +1,128 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jun 14, 2006 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.JTextArea; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class JTextAreaBinding implements Binding { - private final String _property; - private final JTextArea _textArea; - private final Color _validColor; - - public JTextAreaBinding(String property, JTextArea textArea) { - if (property == null || textArea == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _textArea = textArea; - _validColor = _textArea.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - put(bean); - } - - public void put(IValidatable bean) { - try { - List list = (List) PropertyUtils.getProperty(bean, _property); - StringBuffer sb = new StringBuffer(); - - if (list != null) { - for (int i = 0; i < list.size(); i++) { - sb.append(list.get(i)); - if (i < list.size() - 1) { - sb.append("\n"); - } - } - } - - _textArea.setText(sb.toString()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - String text = _textArea.getText(); - - if (!text.equals("")) { - String[] items = text.split("\n"); - List list = new ArrayList(); - - for (int i = 0; i < items.length; i++) { - list.add(items[i]); - } - - PropertyUtils.setProperty(bean, _property, list); - } else { - PropertyUtils.setProperty(bean, _property, null); - } - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _textArea.setBackground(_validColor); - _textArea.requestFocusInWindow(); - } - - public void markInvalid() { - _textArea.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _textArea.setEnabled(enabled); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jun 14, 2006 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextArea; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class JTextAreaBinding implements Binding { + private final String _property; + private final JTextArea _textArea; + private final Color _validColor; + + public JTextAreaBinding(String property, JTextArea textArea) { + if (property == null || textArea == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _textArea = textArea; + _validColor = _textArea.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + put(bean); + } + + public void put(IValidatable bean) { + try { + List list = (List) PropertyUtils.getProperty(bean, _property); + StringBuffer sb = new StringBuffer(); + + if (list != null) { + for (int i = 0; i < list.size(); i++) { + sb.append(list.get(i)); + if (i < list.size() - 1) { + sb.append("\n"); + } + } + } + + _textArea.setText(sb.toString()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + String text = _textArea.getText(); + + if (!text.equals("")) { + String[] items = text.split("\n"); + List list = new ArrayList(); + + for (int i = 0; i < items.length; i++) { + list.add(items[i]); + } + + PropertyUtils.setProperty(bean, _property, list); + } else { + PropertyUtils.setProperty(bean, _property, null); + } + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _textArea.setBackground(_validColor); + _textArea.requestFocusInWindow(); + } + + public void markInvalid() { + _textArea.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _textArea.setEnabled(enabled); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java b/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java index 0232b78..44c3be7 100644 --- a/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java +++ b/launch4j/src/net/sf/launch4j/binding/JTextComponentBinding.java @@ -1,108 +1,108 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -import javax.swing.text.JTextComponent; - -import org.apache.commons.beanutils.BeanUtils; - -/** - * Handles JEditorPane, JTextArea, JTextField - * - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class JTextComponentBinding implements Binding { - private final String _property; - private final JTextComponent _textComponent; - private final String _defaultValue; - private final Color _validColor; - - public JTextComponentBinding(String property, JTextComponent textComponent, - String defaultValue) { - if (property == null || textComponent == null || defaultValue == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _textComponent = textComponent; - _defaultValue = defaultValue; - _validColor = _textComponent.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - _textComponent.setText(_defaultValue); - } - - public void put(IValidatable bean) { - try { - String s = BeanUtils.getProperty(bean, _property); - // XXX displays zeros as blank - _textComponent.setText(s != null && !s.equals("0") ? s : ""); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - BeanUtils.setProperty(bean, _property, _textComponent.getText()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _textComponent.setBackground(_validColor); - _textComponent.requestFocusInWindow(); - } - - public void markInvalid() { - _textComponent.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _textComponent.setEnabled(enabled); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +import javax.swing.text.JTextComponent; + +import org.apache.commons.beanutils.BeanUtils; + +/** + * Handles JEditorPane, JTextArea, JTextField + * + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class JTextComponentBinding implements Binding { + private final String _property; + private final JTextComponent _textComponent; + private final String _defaultValue; + private final Color _validColor; + + public JTextComponentBinding(String property, JTextComponent textComponent, + String defaultValue) { + if (property == null || textComponent == null || defaultValue == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _textComponent = textComponent; + _defaultValue = defaultValue; + _validColor = _textComponent.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + _textComponent.setText(_defaultValue); + } + + public void put(IValidatable bean) { + try { + String s = BeanUtils.getProperty(bean, _property); + // XXX displays zeros as blank + _textComponent.setText(s != null && !s.equals("0") ? s : ""); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + BeanUtils.setProperty(bean, _property, _textComponent.getText()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _textComponent.setBackground(_validColor); + _textComponent.requestFocusInWindow(); + } + + public void markInvalid() { + _textComponent.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _textComponent.setEnabled(enabled); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java b/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java index 9410cfc..242bc40 100644 --- a/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java +++ b/launch4j/src/net/sf/launch4j/binding/JToggleButtonBinding.java @@ -1,108 +1,108 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 30, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; - -import javax.swing.JToggleButton; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * Handles JToggleButton, JCheckBox - * - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class JToggleButtonBinding implements Binding { - private final String _property; - private final JToggleButton _button; - private final boolean _defaultValue; - private final Color _validColor; - - public JToggleButtonBinding(String property, JToggleButton button, - boolean defaultValue) { - if (property == null || button == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _button = button; - _defaultValue = defaultValue; - _validColor = _button.getBackground(); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - _button.setSelected(_defaultValue); - } - - public void put(IValidatable bean) { - try { - Boolean b = (Boolean) PropertyUtils.getProperty(bean, _property); - _button.setSelected(b != null && b.booleanValue()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - PropertyUtils.setProperty(bean, _property, - Boolean.valueOf(_button.isSelected())); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _button.setBackground(_validColor); - _button.requestFocusInWindow(); - } - - public void markInvalid() { - _button.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _button.setEnabled(enabled); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 30, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; + +import javax.swing.JToggleButton; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * Handles JToggleButton, JCheckBox + * + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class JToggleButtonBinding implements Binding { + private final String _property; + private final JToggleButton _button; + private final boolean _defaultValue; + private final Color _validColor; + + public JToggleButtonBinding(String property, JToggleButton button, + boolean defaultValue) { + if (property == null || button == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _button = button; + _defaultValue = defaultValue; + _validColor = _button.getBackground(); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + _button.setSelected(_defaultValue); + } + + public void put(IValidatable bean) { + try { + Boolean b = (Boolean) PropertyUtils.getProperty(bean, _property); + _button.setSelected(b != null && b.booleanValue()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + PropertyUtils.setProperty(bean, _property, + Boolean.valueOf(_button.isSelected())); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _button.setBackground(_validColor); + _button.requestFocusInWindow(); + } + + public void markInvalid() { + _button.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _button.setEnabled(enabled); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/Messages.java b/launch4j/src/net/sf/launch4j/binding/Messages.java index 7bd0aa4..2b6d684 100644 --- a/launch4j/src/net/sf/launch4j/binding/Messages.java +++ b/launch4j/src/net/sf/launch4j/binding/Messages.java @@ -1,78 +1,78 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.binding; - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.binding.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - private static final MessageFormat FORMATTER = new MessageFormat(""); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } - - public static String getString(String key, String arg0) { - return getString(key, new Object[] {arg0}); - } - - public static String getString(String key, String arg0, String arg1) { - return getString(key, new Object[] {arg0, arg1}); - } - - public static String getString(String key, String arg0, String arg1, String arg2) { - return getString(key, new Object[] {arg0, arg1, arg2}); - } - - public static String getString(String key, Object[] args) { - try { - FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); - return FORMATTER.format(args); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.binding; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.binding.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + private static final MessageFormat FORMATTER = new MessageFormat(""); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + public static String getString(String key, String arg0) { + return getString(key, new Object[] {arg0}); + } + + public static String getString(String key, String arg0, String arg1) { + return getString(key, new Object[] {arg0, arg1}); + } + + public static String getString(String key, String arg0, String arg1, String arg2) { + return getString(key, new Object[] {arg0, arg1, arg2}); + } + + public static String getString(String key, Object[] args) { + try { + FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); + return FORMATTER.format(args); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java b/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java index 8fef9a1..0825808 100644 --- a/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java +++ b/launch4j/src/net/sf/launch4j/binding/OptComponentBinding.java @@ -1,122 +1,122 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 11, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Arrays; - -import javax.swing.JToggleButton; - -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class OptComponentBinding implements Binding, ActionListener { - private final Bindings _bindings; - private final String _property; - private final Class _clazz; - private final JToggleButton _button; - private final boolean _enabledByDefault; - - public OptComponentBinding(Bindings bindings, String property, Class clazz, - JToggleButton button, boolean enabledByDefault) { - if (property == null || clazz == null || button == null) { - throw new NullPointerException(); - } - - if (property.equals("")) { - throw new IllegalArgumentException(); - } - - if (!Arrays.asList(clazz.getInterfaces()).contains(IValidatable.class)) { - throw new IllegalArgumentException( - Messages.getString("OptComponentBinding.must.implement") - + IValidatable.class); - } - - _bindings = bindings; - _property = property; - _clazz = clazz; - _button = button; - _button.addActionListener(this); - _enabledByDefault = enabledByDefault; - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - _button.setSelected(_enabledByDefault); - updateComponents(); - } - - public void put(IValidatable bean) { - try { - Object component = PropertyUtils.getProperty(bean, _property); - _button.setSelected(component != null); - updateComponents(); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - PropertyUtils.setProperty(bean, _property, _button.isSelected() - ? _clazz.newInstance() : null); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() {} - - public void markInvalid() {} - - public void setEnabled(boolean enabled) {} // XXX implement? - - public void actionPerformed(ActionEvent e) { - updateComponents(); - } - - private void updateComponents() { - _bindings.setComponentsEnabled(_property, _button.isSelected()); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 11, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Arrays; + +import javax.swing.JToggleButton; + +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class OptComponentBinding implements Binding, ActionListener { + private final Bindings _bindings; + private final String _property; + private final Class _clazz; + private final JToggleButton _button; + private final boolean _enabledByDefault; + + public OptComponentBinding(Bindings bindings, String property, Class clazz, + JToggleButton button, boolean enabledByDefault) { + if (property == null || clazz == null || button == null) { + throw new NullPointerException(); + } + + if (property.equals("")) { + throw new IllegalArgumentException(); + } + + if (!Arrays.asList(clazz.getInterfaces()).contains(IValidatable.class)) { + throw new IllegalArgumentException( + Messages.getString("OptComponentBinding.must.implement") + + IValidatable.class); + } + + _bindings = bindings; + _property = property; + _clazz = clazz; + _button = button; + _button.addActionListener(this); + _enabledByDefault = enabledByDefault; + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + _button.setSelected(_enabledByDefault); + updateComponents(); + } + + public void put(IValidatable bean) { + try { + Object component = PropertyUtils.getProperty(bean, _property); + _button.setSelected(component != null); + updateComponents(); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + PropertyUtils.setProperty(bean, _property, _button.isSelected() + ? _clazz.newInstance() : null); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() {} + + public void markInvalid() {} + + public void setEnabled(boolean enabled) {} // XXX implement? + + public void actionPerformed(ActionEvent e) { + updateComponents(); + } + + private void updateComponents() { + _bindings.setComponentsEnabled(_property, _button.isSelected()); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java b/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java index 1fd2709..2c1bc8d 100644 --- a/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java +++ b/launch4j/src/net/sf/launch4j/binding/OptJTextAreaBinding.java @@ -1,146 +1,146 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Sep 3, 2005 - */ -package net.sf.launch4j.binding; - -import java.awt.Color; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.JTextArea; -import javax.swing.JToggleButton; - -import org.apache.commons.beanutils.BeanUtils; -import org.apache.commons.beanutils.PropertyUtils; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class OptJTextAreaBinding implements Binding, ActionListener { - private final String _property; - private final String _stateProperty; - private final JToggleButton _button; - private final JTextArea _textArea; - private final Color _validColor; - - public OptJTextAreaBinding(String property, String stateProperty, - JToggleButton button, JTextArea textArea) { - if (property == null || button == null || textArea == null) { - throw new NullPointerException(); - } - if (property.equals("")) { - throw new IllegalArgumentException(); - } - _property = property; - _stateProperty = stateProperty; - _button = button; - _textArea = textArea; - _validColor = _textArea.getBackground(); - button.addActionListener(this); - } - - public String getProperty() { - return _property; - } - - public void clear(IValidatable bean) { - put(bean); - } - - public void put(IValidatable bean) { - try { - boolean selected = "true".equals(BeanUtils.getProperty(bean, - _stateProperty)); - _button.setSelected(selected); - _textArea.setEnabled(selected); - List list = (List) PropertyUtils.getProperty(bean, _property); - StringBuffer sb = new StringBuffer(); - - if (list != null) { - for (int i = 0; i < list.size(); i++) { - sb.append(list.get(i)); - if (i < list.size() - 1) { - sb.append("\n"); - } - } - } - - _textArea.setText(sb.toString()); - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void get(IValidatable bean) { - try { - String text = _textArea.getText(); - - if (_button.isSelected() && !text.equals("")) { - String[] items = text.split("\n"); - List list = new ArrayList(); - - for (String s : items) { - list.add(s); - } - - PropertyUtils.setProperty(bean, _property, list); - } else { - PropertyUtils.setProperty(bean, _property, null); - } - } catch (Exception e) { - throw new BindingException(e); - } - } - - public void markValid() { - _textArea.setBackground(_validColor); - _textArea.requestFocusInWindow(); - } - - public void markInvalid() { - _textArea.setBackground(Binding.INVALID_COLOR); - } - - public void setEnabled(boolean enabled) { - _textArea.setEnabled(enabled); - } - - public void actionPerformed(ActionEvent e) { - _textArea.setEnabled(_button.isSelected()); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Sep 3, 2005 + */ +package net.sf.launch4j.binding; + +import java.awt.Color; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JTextArea; +import javax.swing.JToggleButton; + +import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.beanutils.PropertyUtils; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class OptJTextAreaBinding implements Binding, ActionListener { + private final String _property; + private final String _stateProperty; + private final JToggleButton _button; + private final JTextArea _textArea; + private final Color _validColor; + + public OptJTextAreaBinding(String property, String stateProperty, + JToggleButton button, JTextArea textArea) { + if (property == null || button == null || textArea == null) { + throw new NullPointerException(); + } + if (property.equals("")) { + throw new IllegalArgumentException(); + } + _property = property; + _stateProperty = stateProperty; + _button = button; + _textArea = textArea; + _validColor = _textArea.getBackground(); + button.addActionListener(this); + } + + public String getProperty() { + return _property; + } + + public void clear(IValidatable bean) { + put(bean); + } + + public void put(IValidatable bean) { + try { + boolean selected = "true".equals(BeanUtils.getProperty(bean, + _stateProperty)); + _button.setSelected(selected); + _textArea.setEnabled(selected); + List list = (List) PropertyUtils.getProperty(bean, _property); + StringBuffer sb = new StringBuffer(); + + if (list != null) { + for (int i = 0; i < list.size(); i++) { + sb.append(list.get(i)); + if (i < list.size() - 1) { + sb.append("\n"); + } + } + } + + _textArea.setText(sb.toString()); + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void get(IValidatable bean) { + try { + String text = _textArea.getText(); + + if (_button.isSelected() && !text.equals("")) { + String[] items = text.split("\n"); + List list = new ArrayList(); + + for (String s : items) { + list.add(s); + } + + PropertyUtils.setProperty(bean, _property, list); + } else { + PropertyUtils.setProperty(bean, _property, null); + } + } catch (Exception e) { + throw new BindingException(e); + } + } + + public void markValid() { + _textArea.setBackground(_validColor); + _textArea.requestFocusInWindow(); + } + + public void markInvalid() { + _textArea.setBackground(Binding.INVALID_COLOR); + } + + public void setEnabled(boolean enabled) { + _textArea.setEnabled(enabled); + } + + public void actionPerformed(ActionEvent e) { + _textArea.setEnabled(_button.isSelected()); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/Validator.java b/launch4j/src/net/sf/launch4j/binding/Validator.java index fb2484a..b903bee 100644 --- a/launch4j/src/net/sf/launch4j/binding/Validator.java +++ b/launch4j/src/net/sf/launch4j/binding/Validator.java @@ -1,252 +1,252 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2004-01-30 - */ -package net.sf.launch4j.binding; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import net.sf.launch4j.Util; -import net.sf.launch4j.config.ConfigPersister; - -/** - * @author Copyright (C) 2004 Grzegorz Kowal - */ -public class Validator { - public static final String ALPHANUMERIC_PATTERN = "[\\w]*?"; - public static final String ALPHA_PATTERN = "[\\w&&\\D]*?"; - public static final String NUMERIC_PATTERN = "[\\d]*?"; - public static final String PATH_PATTERN = "[\\w|[ .,:\\-/\\\\]]*?"; - - public static final int MAX_STR = 128; - public static final int MAX_PATH = 260; - public static final int MAX_BIG_STR = 8192; // or 16384; - public static final int MAX_ARGS = 32767 - 2048; - - private Validator() {} - - public static boolean isEmpty(String s) { - return s == null || s.equals(""); - } - - public static void checkNotNull(Object o, String property, String name) { - if (o == null) { - signalViolation(property, - Messages.getString("Validator.empty.field", name)); - } - } - - public static void checkString(String s, int maxLength, String property, - String name) { - if (s == null || s.length() == 0) { - signalViolation(property, - Messages.getString("Validator.empty.field", name)); - } - if (s.length() > maxLength) { - signalLengthViolation(property, name, maxLength); - } - } - - public static void checkOptStrings(List strings, int maxLength, int totalMaxLength, - String property, String name) { - if (strings == null) { - return; - } - - int totalLength = 0; - - for (String s : strings) { - checkString(s, maxLength, property, name); - totalLength += s.length(); - - if (totalLength > totalMaxLength) { - signalLengthViolation(property, name, totalMaxLength); - } - } - } - - public static void checkString(String s, int maxLength, String pattern, - String property, String name) { - checkString(s, maxLength, property, name); - - if (!s.matches(pattern)) { - signalViolation(property, - Messages.getString("Validator.invalid.data", name)); - } - } - - public static void checkOptStrings(List strings, int maxLength, int totalMaxLength, - String pattern, String property, String name, String msg) { - if (strings == null) { - return; - } - - int totalLength = 0; - - for (String s : strings) { - checkString(s, maxLength, property, name); - - if (!s.matches(pattern)) { - signalViolation(property, msg != null - ? msg - : Messages.getString("Validator.invalid.data", name)); - } - - totalLength += s.length(); - - if (totalLength > totalMaxLength) { - signalLengthViolation(property, name, totalMaxLength); - } - } - } - - public static void checkOptString(String s, int maxLength, String property, - String name) { - if (s == null || s.length() == 0) { - return; - } - - if (s.length() > maxLength) { - signalLengthViolation(property, name, maxLength); - } - } - - public static void checkOptString(String s, int maxLength, String pattern, - String property, String name) { - if (s == null || s.length() == 0) { - return; - } - - if (s.length() > maxLength) { - signalLengthViolation(property, name, maxLength); - } - - if (!s.matches(pattern)) { - signalViolation(property, - Messages.getString("Validator.invalid.data", name)); - } - } - - public static void checkRange(int value, int min, int max, - String property, String name) { - if (value < min || value > max) { - signalViolation(property, - Messages.getString("Validator.must.be.in.range", name, - String.valueOf(min), String.valueOf(max))); - } - } - - public static void checkRange(char value, char min, char max, - String property, String name) { - if (value < min || value > max) { - signalViolation(property, Messages.getString("Validator.must.be.in.range", - name, String.valueOf(min), String.valueOf(max))); - } - } - - public static void checkMin(int value, int min, String property, String name) { - if (value < min) { - signalViolation(property, - Messages.getString("Validator.must.be.at.least", name, - String.valueOf(min))); - } - } - - public static void checkIn(String s, String[] strings, String property, - String name) { - if (isEmpty(s)) { - signalViolation(property, - Messages.getString("Validator.empty.field", name)); - } - - List list = Arrays.asList(strings); - - if (!list.contains(s)) { - signalViolation(property, - Messages.getString("Validator.invalid.option", name, list.toString())); - } - } - - public static void checkTrue(boolean condition, String property, String msg) { - if (!condition) { - signalViolation(property, msg); - } - } - - public static void checkFalse(boolean condition, String property, String msg) { - if (condition) { - signalViolation(property, msg); - } - } - - public static void checkFile(File f, String property, String fileDescription) { - File cfgPath = ConfigPersister.getInstance().getConfigPath(); - if (f == null - || f.getPath().equals("") - || (!f.exists() && !Util.getAbsoluteFile(cfgPath, f).exists())) { - signalViolation(property, - Messages.getString("Validator.doesnt.exist", fileDescription)); - } - } - - public static void checkOptFile(File f, String property, String fileDescription) { - if (f != null && f.getPath().length() > 0) { - checkFile(f, property, fileDescription); - } - } - - public static void checkRelativeWinPath(String path, String property, String msg) { - if (path == null - || path.equals("") - || path.startsWith("/") - || path.startsWith("\\") - || path.indexOf(':') != -1) { - signalViolation(property, msg); - } - } - - public static void signalLengthViolation(String property, String name, - int maxLength) { - signalViolation(property, - Messages.getString("Validator.exceeds.max.length", name, - String.valueOf(maxLength))); - } - - public static void signalViolation(String property, String msg) { - throw new InvariantViolationException(property, msg); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2004-01-30 + */ +package net.sf.launch4j.binding; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import net.sf.launch4j.Util; +import net.sf.launch4j.config.ConfigPersister; + +/** + * @author Copyright (C) 2004 Grzegorz Kowal + */ +public class Validator { + public static final String ALPHANUMERIC_PATTERN = "[\\w]*?"; + public static final String ALPHA_PATTERN = "[\\w&&\\D]*?"; + public static final String NUMERIC_PATTERN = "[\\d]*?"; + public static final String PATH_PATTERN = "[\\w|[ .,:\\-/\\\\]]*?"; + + public static final int MAX_STR = 128; + public static final int MAX_PATH = 260; + public static final int MAX_BIG_STR = 8192; // or 16384; + public static final int MAX_ARGS = 32767 - 2048; + + private Validator() {} + + public static boolean isEmpty(String s) { + return s == null || s.equals(""); + } + + public static void checkNotNull(Object o, String property, String name) { + if (o == null) { + signalViolation(property, + Messages.getString("Validator.empty.field", name)); + } + } + + public static void checkString(String s, int maxLength, String property, + String name) { + if (s == null || s.length() == 0) { + signalViolation(property, + Messages.getString("Validator.empty.field", name)); + } + if (s.length() > maxLength) { + signalLengthViolation(property, name, maxLength); + } + } + + public static void checkOptStrings(List strings, int maxLength, int totalMaxLength, + String property, String name) { + if (strings == null) { + return; + } + + int totalLength = 0; + + for (String s : strings) { + checkString(s, maxLength, property, name); + totalLength += s.length(); + + if (totalLength > totalMaxLength) { + signalLengthViolation(property, name, totalMaxLength); + } + } + } + + public static void checkString(String s, int maxLength, String pattern, + String property, String name) { + checkString(s, maxLength, property, name); + + if (!s.matches(pattern)) { + signalViolation(property, + Messages.getString("Validator.invalid.data", name)); + } + } + + public static void checkOptStrings(List strings, int maxLength, int totalMaxLength, + String pattern, String property, String name, String msg) { + if (strings == null) { + return; + } + + int totalLength = 0; + + for (String s : strings) { + checkString(s, maxLength, property, name); + + if (!s.matches(pattern)) { + signalViolation(property, msg != null + ? msg + : Messages.getString("Validator.invalid.data", name)); + } + + totalLength += s.length(); + + if (totalLength > totalMaxLength) { + signalLengthViolation(property, name, totalMaxLength); + } + } + } + + public static void checkOptString(String s, int maxLength, String property, + String name) { + if (s == null || s.length() == 0) { + return; + } + + if (s.length() > maxLength) { + signalLengthViolation(property, name, maxLength); + } + } + + public static void checkOptString(String s, int maxLength, String pattern, + String property, String name) { + if (s == null || s.length() == 0) { + return; + } + + if (s.length() > maxLength) { + signalLengthViolation(property, name, maxLength); + } + + if (!s.matches(pattern)) { + signalViolation(property, + Messages.getString("Validator.invalid.data", name)); + } + } + + public static void checkRange(int value, int min, int max, + String property, String name) { + if (value < min || value > max) { + signalViolation(property, + Messages.getString("Validator.must.be.in.range", name, + String.valueOf(min), String.valueOf(max))); + } + } + + public static void checkRange(char value, char min, char max, + String property, String name) { + if (value < min || value > max) { + signalViolation(property, Messages.getString("Validator.must.be.in.range", + name, String.valueOf(min), String.valueOf(max))); + } + } + + public static void checkMin(int value, int min, String property, String name) { + if (value < min) { + signalViolation(property, + Messages.getString("Validator.must.be.at.least", name, + String.valueOf(min))); + } + } + + public static void checkIn(String s, String[] strings, String property, + String name) { + if (isEmpty(s)) { + signalViolation(property, + Messages.getString("Validator.empty.field", name)); + } + + List list = Arrays.asList(strings); + + if (!list.contains(s)) { + signalViolation(property, + Messages.getString("Validator.invalid.option", name, list.toString())); + } + } + + public static void checkTrue(boolean condition, String property, String msg) { + if (!condition) { + signalViolation(property, msg); + } + } + + public static void checkFalse(boolean condition, String property, String msg) { + if (condition) { + signalViolation(property, msg); + } + } + + public static void checkFile(File f, String property, String fileDescription) { + File cfgPath = ConfigPersister.getInstance().getConfigPath(); + if (f == null + || f.getPath().equals("") + || (!f.exists() && !Util.getAbsoluteFile(cfgPath, f).exists())) { + signalViolation(property, + Messages.getString("Validator.doesnt.exist", fileDescription)); + } + } + + public static void checkOptFile(File f, String property, String fileDescription) { + if (f != null && f.getPath().length() > 0) { + checkFile(f, property, fileDescription); + } + } + + public static void checkRelativeWinPath(String path, String property, String msg) { + if (path == null + || path.equals("") + || path.startsWith("/") + || path.startsWith("\\") + || path.indexOf(':') != -1) { + signalViolation(property, msg); + } + } + + public static void signalLengthViolation(String property, String name, + int maxLength) { + signalViolation(property, + Messages.getString("Validator.exceeds.max.length", name, + String.valueOf(maxLength))); + } + + public static void signalViolation(String property, String msg) { + throw new InvariantViolationException(property, msg); + } +} diff --git a/launch4j/src/net/sf/launch4j/binding/messages.properties b/launch4j/src/net/sf/launch4j/binding/messages.properties index e9548cd..da7a74a 100644 --- a/launch4j/src/net/sf/launch4j/binding/messages.properties +++ b/launch4j/src/net/sf/launch4j/binding/messages.properties @@ -1,52 +1,52 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2015 Grzegorz Kowal -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -OptComponentBinding.must.implement=Optional component must implement - -Validator.empty.field=Enter: {0} -Validator.invalid.data=Invalid data: {0} -Validator.must.be.in.range={0} must be in range [{1}-{2}] -Validator.must.be.at.least={0} must be at least -Validator.already.exists={0} already exists. -Validator.doesnt.exist={0} doesn''t exist. -Validator.exceeds.max.length={0} exceeds the maximum length of {1} characters. -Validator.invalid.option={0} must be one of [{1}] - -Bindings.duplicate.binding=Duplicate binding - -JRadioButtonBinding.property.null=Property is null -JRadioButtonBinding.nothing.selected=Nothing selected -JRadioButtonBinding.index.out.of.bounds=Button index out of bounds - -JComboBoxBinding.property.null=Property is null -JComboBoxBinding.index.out.of.bounds=Combo box index out of bounds +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2015 Grzegorz Kowal +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +OptComponentBinding.must.implement=Optional component must implement + +Validator.empty.field=Enter: {0} +Validator.invalid.data=Invalid data: {0} +Validator.must.be.in.range={0} must be in range [{1}-{2}] +Validator.must.be.at.least={0} must be at least +Validator.already.exists={0} already exists. +Validator.doesnt.exist={0} doesn''t exist. +Validator.exceeds.max.length={0} exceeds the maximum length of {1} characters. +Validator.invalid.option={0} must be one of [{1}] + +Bindings.duplicate.binding=Duplicate binding + +JRadioButtonBinding.property.null=Property is null +JRadioButtonBinding.nothing.selected=Nothing selected +JRadioButtonBinding.index.out.of.bounds=Button index out of bounds + +JComboBoxBinding.property.null=Property is null +JComboBoxBinding.index.out.of.bounds=Combo box index out of bounds diff --git a/launch4j/src/net/sf/launch4j/binding/messages_es.properties b/launch4j/src/net/sf/launch4j/binding/messages_es.properties deleted file mode 100644 index 52e44f2..0000000 --- a/launch4j/src/net/sf/launch4j/binding/messages_es.properties +++ /dev/null @@ -1,51 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -OptComponentBinding.must.implement=El componente opcional debe ser implementado - -Validator.empty.field=Introduzca: {0} -Validator.invalid.data=Dato no válido: {0} -Validator.must.be.in.range={0} debe estar en el rango [{1}-{2}] -Validator.must.be.at.least={0} deb ser al menos -Validator.already.exists={0} ya existe. -Validator.doesnt.exist={0} no existe. -Validator.exceeds.max.length={0} excede la longitud máxima de {1} caracteres. -Validator.invalid.option={0} must be one of [{1}] - -Bindings.duplicate.binding=Binding duplicado - -JRadioButtonBinding.property.null=La propiedad es nula -JRadioButtonBinding.nothing.selected=Nada seleccionado -JRadioButtonBinding.index.out.of.bounds=Índice de botón fuera de límite -JComboBoxBinding.property.null=Property is null -JComboBoxBinding.index.out.of.bounds=Combo box index out of bounds diff --git a/launch4j/src/net/sf/launch4j/config/CharsetID.java b/launch4j/src/net/sf/launch4j/config/CharsetID.java index 40bd8d2..3e759ed 100644 --- a/launch4j/src/net/sf/launch4j/config/CharsetID.java +++ b/launch4j/src/net/sf/launch4j/config/CharsetID.java @@ -1,110 +1,110 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2015 Sebastian Bögl - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.config; - -import java.util.Arrays; -/** - * @see VERSIONINFO resource - * @see VarFileInfo BLOCK - */ -public enum CharsetID implements Describable { - /** 0x0000 */ - ASCII(0, Messages.getString("Charset.ascii")), - /** 0x04E8 */ - ARABIC(1256, Messages.getString("Language.arabic")), - /** 0x04E3 */ - CYRILLIC(1251, Messages.getString("Charset.cyrillic")), - /** 0x04E5 */ - GREEK(1253, Messages.getString("Language.greek")), - /** 0x04E7 */ - HEBREW(1255, Messages.getString("Language.hebrew")), - /** 0x03A4 */ - SHIFT_JIS(932, Messages.getString("Charset.shift.jis")), - /** 0x03B5 */ - SHIFT_KSC(949, Messages.getString("Charset.shift.ksc")), - /** 0x04E2 */ - LATIN2(1250, Messages.getString("Charset.latin2")), - /** 0x04E4 */ - MULTILINGUAL(1252, Messages.getString("Charset.multilingual")), - /** 0x0B63 */ - BIG5(950, Messages.getString("Charset.big5")), - /** 0x04E6 */ - TURKISH(1254, Messages.getString("Language.turkish")), - /** 0x04B0 */ - UNICODE(1200, Messages.getString("Charset.unicode")), - ; - - private static final CharsetID[] VALUES = CharsetID.values(); - - static { - Arrays.sort(VALUES, new DescribableComparator()); - } - - private final int id; - private final String description; - - CharsetID(int id, String description) { - this.id = id; - this.description = description; - } - - public int getId() { - return id; - } - - @Override - public String toString() { - return description; - } - - @Override - public String getDescription() { - return description; - } - - @Override - public int getIndex() { - for (int i = 0; i < VALUES.length; i++) { - if (VALUES[i] == this) { - return i; - } - } - // should never happen - return -1; - } - - public static CharsetID[] sortedValues() { - return VALUES; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2015 Sebastian Bögl + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.config; + +import java.util.Arrays; +/** + * @see VERSIONINFO resource + * @see VarFileInfo BLOCK + */ +public enum CharsetID implements Describable { + /** 0x0000 */ + ASCII(0, Messages.getString("Charset.ascii")), + /** 0x04E8 */ + ARABIC(1256, Messages.getString("Language.arabic")), + /** 0x04E3 */ + CYRILLIC(1251, Messages.getString("Charset.cyrillic")), + /** 0x04E5 */ + GREEK(1253, Messages.getString("Language.greek")), + /** 0x04E7 */ + HEBREW(1255, Messages.getString("Language.hebrew")), + /** 0x03A4 */ + SHIFT_JIS(932, Messages.getString("Charset.shift.jis")), + /** 0x03B5 */ + SHIFT_KSC(949, Messages.getString("Charset.shift.ksc")), + /** 0x04E2 */ + LATIN2(1250, Messages.getString("Charset.latin2")), + /** 0x04E4 */ + MULTILINGUAL(1252, Messages.getString("Charset.multilingual")), + /** 0x0B63 */ + BIG5(950, Messages.getString("Charset.big5")), + /** 0x04E6 */ + TURKISH(1254, Messages.getString("Language.turkish")), + /** 0x04B0 */ + UNICODE(1200, Messages.getString("Charset.unicode")), + ; + + private static final CharsetID[] VALUES = CharsetID.values(); + + static { + Arrays.sort(VALUES, new DescribableComparator()); + } + + private final int id; + private final String description; + + CharsetID(int id, String description) { + this.id = id; + this.description = description; + } + + public int getId() { + return id; + } + + @Override + public String toString() { + return description; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public int getIndex() { + for (int i = 0; i < VALUES.length; i++) { + if (VALUES[i] == this) { + return i; + } + } + // should never happen + return -1; + } + + public static CharsetID[] sortedValues() { + return VALUES; + } +} diff --git a/launch4j/src/net/sf/launch4j/config/ClassPath.java b/launch4j/src/net/sf/launch4j/config/ClassPath.java index 885d07f..14f624c 100644 --- a/launch4j/src/net/sf/launch4j/config/ClassPath.java +++ b/launch4j/src/net/sf/launch4j/config/ClassPath.java @@ -1,92 +1,92 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.config; - -import java.util.List; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class ClassPath implements IValidatable { - private String mainClass; - private List paths; - - public void checkInvariants() { - Validator.checkString(mainClass, Validator.MAX_PATH, "mainClass", - Messages.getString("ClassPath.mainClass")); - Validator.checkOptStrings(paths, - Validator.MAX_PATH, - Validator.MAX_ARGS, - "paths", - Messages.getString("ClassPath.path")); - } - - public String getMainClass() { - return mainClass; - } - - public void setMainClass(String mainClass) { - this.mainClass = mainClass; - } - - public List getPaths() { - return paths; - } - - public void setPaths(List paths) { - this.paths = paths; - } - - public String getPathsString() { - StringBuffer sb = new StringBuffer(); - - if (paths != null) { - for (int i = 0; i < paths.size(); i++) { - sb.append(paths.get(i)); - - if (i < paths.size() - 1) { - sb.append(';'); - } - } - } - - return sb.toString(); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.config; + +import java.util.List; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class ClassPath implements IValidatable { + private String mainClass; + private List paths; + + public void checkInvariants() { + Validator.checkString(mainClass, Validator.MAX_PATH, "mainClass", + Messages.getString("ClassPath.mainClass")); + Validator.checkOptStrings(paths, + Validator.MAX_PATH, + Validator.MAX_ARGS, + "paths", + Messages.getString("ClassPath.path")); + } + + public String getMainClass() { + return mainClass; + } + + public void setMainClass(String mainClass) { + this.mainClass = mainClass; + } + + public List getPaths() { + return paths; + } + + public void setPaths(List paths) { + this.paths = paths; + } + + public String getPathsString() { + StringBuffer sb = new StringBuffer(); + + if (paths != null) { + for (int i = 0; i < paths.size(); i++) { + sb.append(paths.get(i)); + + if (i < paths.size() - 1) { + sb.append(';'); + } + } + } + + return sb.toString(); + } +} diff --git a/launch4j/src/net/sf/launch4j/config/Config.java b/launch4j/src/net/sf/launch4j/config/Config.java index a9671c2..aaad10f 100644 --- a/launch4j/src/net/sf/launch4j/config/Config.java +++ b/launch4j/src/net/sf/launch4j/config/Config.java @@ -1,428 +1,424 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 21, 2005 - */ -package net.sf.launch4j.config; - -import java.io.File; -import java.util.Arrays; -import java.util.List; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Config implements IValidatable { - - // 1.x config properties_____________________________________________________________ - public static final String HEADER = "header"; - public static final String JAR = "jar"; - public static final String OUTFILE = "outfile"; - public static final String ERR_TITLE = "errTitle"; - public static final String JAR_ARGS = "jarArgs"; - public static final String CHDIR = "chdir"; - public static final String STAY_ALIVE = "stayAlive"; - public static final String ICON = "icon"; - - // __________________________________________________________________________________ - public static final String DOWNLOAD_URL = "http://java.com/download"; - - public static final String GUI_HEADER = "gui"; - public static final String CONSOLE_HEADER = "console"; - public static final String JNI_GUI_HEADER_32 = "jniGui32"; - public static final String JNI_CONSOLE_HEADER_32 = "jniConsole32"; - - private static final String[] HEADER_TYPES = new String[] { GUI_HEADER, - CONSOLE_HEADER, - JNI_GUI_HEADER_32, - JNI_CONSOLE_HEADER_32 }; - - private static final String[] PRIORITY_CLASS_NAMES = new String[] { "normal", - "idle", - "high" }; - - private static final int[] PRIORITY_CLASSES = new int[] { 0x00000020, - 0x00000040, - 0x00000080 }; - - private boolean dontWrapJar; - private String headerType = GUI_HEADER; - private List headerObjects; - private List libs; - private File jar; - private File outfile; - - // Runtime header configuration - private String errTitle; - private String cmdLine; - private String chdir; - private String priority; - private String downloadUrl; - private String supportUrl; - private boolean stayAlive; - private boolean restartOnCrash; - private File manifest; - private File icon; - private List variables; - private SingleInstance singleInstance; - private ClassPath classPath; - private Jre jre; - private Splash splash; - private VersionInfo versionInfo; - private Msg messages; - - public void checkInvariants() { - Validator.checkTrue(outfile != null && outfile.getPath().endsWith(".exe"), - "outfile", Messages.getString("Config.specify.output.exe")); - if (dontWrapJar) { - if (jar != null && !jar.getPath().equals("")) { - Validator.checkRelativeWinPath(jar.getPath(), "jar", - Messages.getString("Config.application.jar.path")); - } else { - Validator.checkTrue(classPath != null, "classPath", - Messages.getString("ClassPath.or.jar")); - } - } else { - Validator.checkFile(jar, "jar", - Messages.getString("Config.application.jar")); - } - if (!Validator.isEmpty(chdir)) { - Validator.checkRelativeWinPath(chdir, "chdir", - Messages.getString("Config.chdir.relative")); - Validator.checkFalse(chdir.toLowerCase().equals("true") - || chdir.toLowerCase().equals("false"), - "chdir", Messages.getString("Config.chdir.path")); - } - Validator.checkOptFile(manifest, "manifest", Messages.getString("Config.manifest")); - Validator.checkOptFile(icon, "icon", Messages.getString("Config.icon")); - Validator.checkOptString(cmdLine, Validator.MAX_BIG_STR, "jarArgs", - Messages.getString("Config.jar.arguments")); - Validator.checkOptString(errTitle, Validator.MAX_STR, "errTitle", - Messages.getString("Config.error.title")); - Validator.checkOptString(downloadUrl, 256, - "downloadUrl", Messages.getString("Config.download.url")); - Validator.checkOptString(supportUrl, 256, - "supportUrl", Messages.getString("Config.support.url")); - Validator.checkIn(getHeaderType(), HEADER_TYPES, "headerType", - Messages.getString("Config.header.type")); - Validator.checkFalse(!isGuiApplication() && splash != null, - "headerType", - Messages.getString("Config.splash.not.impl.by.console.hdr")); - Validator.checkOptStrings(variables, - Validator.MAX_ARGS, - Validator.MAX_ARGS, - "[^=%\t]+=[^=\t]+", - "variables", - Messages.getString("Config.variables"), - Messages.getString("Config.variables.err")); - Validator.checkIn(getPriority(), PRIORITY_CLASS_NAMES, "priority", - Messages.getString("Config.priority")); - checkJniInvariants(); - jre.checkInvariants(); - } - - private void checkJniInvariants() { - // TODO: Remove once JNI is fully implemented. - if (isJniApplication()) { - Validator.checkTrue(".".equals(chdir), "chdir", - "Only '.' is allowed in change directory."); - Validator.checkTrue(Validator.isEmpty(cmdLine), "cmdLine", - "Constant command line arguments not supported."); - Validator.checkFalse(stayAlive, "stayAlive", - "Stay alive option is not used in JNI, this is the default behavior."); - Validator.checkFalse(restartOnCrash, "restartOnCrash", - "Restart on crash not supported."); - Validator.checkIn(getPriority(), new String[] { "normal" }, "priority", - "Process priority is not supported,"); - Validator.checkNotNull(classPath, "classpath", "classpath"); - Validator.checkFalse(jre.getBundledJre64Bit(), "jre.bundledJre64Bit", - "64-bit bundled JRE not supported."); - Validator.checkTrue(Jre.RUNTIME_BITS_32.equals(jre.getRuntimeBits()), "jre.runtimeBits", - "64-bit JRE not supported."); - } - } - - public void validate() { - checkInvariants(); - if (classPath != null) { - classPath.checkInvariants(); - } - if (splash != null) { - splash.checkInvariants(); - } - if (versionInfo != null) { - versionInfo.checkInvariants(); - } - } - - /** Change current directory to EXE location. */ - public String getChdir() { - return chdir; - } - - public void setChdir(String chdir) { - this.chdir = chdir; - } - - /** Constant command line arguments passed to the application. */ - public String getCmdLine() { - return cmdLine; - } - - public void setCmdLine(String cmdLine) { - this.cmdLine = cmdLine; - } - - /** Optional, error message box title. */ - public String getErrTitle() { - return errTitle; - } - - public void setErrTitle(String errTitle) { - this.errTitle = errTitle; - } - - public boolean isGuiApplication() { - return GUI_HEADER.equals(headerType) || JNI_GUI_HEADER_32.equals(headerType); - } - - public boolean isJniApplication() { - return JNI_GUI_HEADER_32.equals(headerType) - || JNI_CONSOLE_HEADER_32.equals(headerType); - } - - /** launch4j header file. */ - public String getHeaderType() { - return headerType; - } - - public void setHeaderType(String headerType) { - this.headerType = headerType; - } - - /** launch4j header file index - used by GUI. */ - public int getHeaderTypeIndex() { - int x = Arrays.asList(HEADER_TYPES).indexOf(getHeaderType()); - return x != -1 ? x : 0; - } - - public void setHeaderTypeIndex(int headerTypeIndex) { - headerType = HEADER_TYPES[headerTypeIndex]; - } - - public boolean isCustomHeaderObjects() { - return headerObjects != null && !headerObjects.isEmpty(); - } - - public List getHeaderObjects() { - return isCustomHeaderObjects() ? headerObjects - : LdDefaults.getHeaderObjects(getHeaderTypeIndex()); - } - - public void setHeaderObjects(List headerObjects) { - this.headerObjects = headerObjects; - } - - public boolean isCustomLibs() { - return libs != null && !libs.isEmpty(); - } - - public List getLibs() { - return isCustomLibs() ? libs : LdDefaults.getLibs(headerType); - } - - public void setLibs(List libs) { - this.libs = libs; - } - - /** Wrapper's manifest for User Account Control. */ - public File getManifest() { - return manifest; - } - - public void setManifest(File manifest) { - this.manifest = manifest; - } - - /** ICO file. */ - public File getIcon() { - return icon; - } - - public void setIcon(File icon) { - this.icon = icon; - } - - /** Jar to wrap. */ - public File getJar() { - return jar; - } - - public void setJar(File jar) { - this.jar = jar; - } - - public List getVariables() { - return variables; - } - - public void setVariables(List variables) { - this.variables = variables; - } - - public ClassPath getClassPath() { - return classPath; - } - - public void setClassPath(ClassPath classpath) { - this.classPath = classpath; - } - - /** JRE configuration */ - public Jre getJre() { - return jre; - } - - public void setJre(Jre jre) { - this.jre = jre; - } - - /** Output EXE file. */ - public File getOutfile() { - return outfile; - } - - public void setOutfile(File outfile) { - this.outfile = outfile; - } - - /** Splash screen configuration. */ - public Splash getSplash() { - return splash; - } - - public void setSplash(Splash splash) { - this.splash = splash; - } - - /** Stay alive after launching the application. */ - public boolean isStayAlive() { - return stayAlive; - } - - public void setStayAlive(boolean stayAlive) { - this.stayAlive = stayAlive; - } - - /** Restart the application after a crash (i.e. exit code other than 0) */ - public boolean isRestartOnCrash() { - return restartOnCrash; - } - - public void setRestartOnCrash(boolean restartOnCrash) { - this.restartOnCrash = restartOnCrash; - } - - public VersionInfo getVersionInfo() { - return versionInfo; - } - - public void setVersionInfo(VersionInfo versionInfo) { - this.versionInfo = versionInfo; - } - - public boolean isDontWrapJar() { - return dontWrapJar; - } - - public void setDontWrapJar(boolean dontWrapJar) { - this.dontWrapJar = dontWrapJar; - } - - public int getPriorityIndex() { - int x = Arrays.asList(PRIORITY_CLASS_NAMES).indexOf(getPriority()); - return x != -1 ? x : 0; - } - - public void setPriorityIndex(int x) { - priority = PRIORITY_CLASS_NAMES[x]; - } - - public String getPriority() { - return Validator.isEmpty(priority) ? PRIORITY_CLASS_NAMES[0] : priority; - } - - public void setPriority(String priority) { - this.priority = priority; - } - - public int getPriorityClass() { - return PRIORITY_CLASSES[getPriorityIndex()]; - } - - public String getDownloadUrl() { - return downloadUrl == null ? DOWNLOAD_URL : downloadUrl; - } - - public void setDownloadUrl(String downloadUrl) { - this.downloadUrl = downloadUrl; - } - - public String getSupportUrl() { - return supportUrl; - } - - public void setSupportUrl(String supportUrl) { - this.supportUrl = supportUrl; - } - - public Msg getMessages() { - return messages; - } - - public void setMessages(Msg messages) { - this.messages = messages; - } - - public SingleInstance getSingleInstance() { - return singleInstance; - } - - public void setSingleInstance(SingleInstance singleInstance) { - this.singleInstance = singleInstance; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 21, 2005 + */ +package net.sf.launch4j.config; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Config implements IValidatable { + + // 1.x config properties_____________________________________________________________ + public static final String HEADER = "header"; + public static final String JAR = "jar"; + public static final String OUTFILE = "outfile"; + public static final String ERR_TITLE = "errTitle"; + public static final String JAR_ARGS = "jarArgs"; + public static final String CHDIR = "chdir"; + public static final String STAY_ALIVE = "stayAlive"; + public static final String ICON = "icon"; + + // __________________________________________________________________________________ + public static final String GUI_HEADER = "gui"; + public static final String CONSOLE_HEADER = "console"; + public static final String JNI_GUI_HEADER_32 = "jniGui32"; + public static final String JNI_CONSOLE_HEADER_32 = "jniConsole32"; + + private static final String[] HEADER_TYPES = new String[] { GUI_HEADER, + CONSOLE_HEADER, + JNI_GUI_HEADER_32, + JNI_CONSOLE_HEADER_32 }; + + private static final String[] PRIORITY_CLASS_NAMES = new String[] { "normal", + "idle", + "high" }; + + private static final int[] PRIORITY_CLASSES = new int[] { 0x00000020, + 0x00000040, + 0x00000080 }; + + private boolean dontWrapJar; + private String headerType = GUI_HEADER; + private List headerObjects; + private List libs; + private File jar; + private File outfile; + + // Runtime header configuration + private String errTitle; + private String cmdLine; + private String chdir; + private String priority; + private String downloadUrl; + private String supportUrl; + private boolean stayAlive; + private boolean restartOnCrash; + private File manifest; + private File icon; + private List variables; + private SingleInstance singleInstance; + private ClassPath classPath; + private Jre jre; + private Splash splash; + private VersionInfo versionInfo; + private Msg messages; + + public void checkInvariants() { + Validator.checkTrue(outfile != null && outfile.getPath().endsWith(".exe"), + "outfile", Messages.getString("Config.specify.output.exe")); + if (dontWrapJar) { + if (jar != null && !jar.getPath().equals("")) { + Validator.checkRelativeWinPath(jar.getPath(), "jar", + Messages.getString("Config.application.jar.path")); + } else { + Validator.checkTrue(classPath != null, "classPath", + Messages.getString("ClassPath.or.jar")); + } + } else { + Validator.checkFile(jar, "jar", + Messages.getString("Config.application.jar")); + } + if (!Validator.isEmpty(chdir)) { + Validator.checkRelativeWinPath(chdir, "chdir", + Messages.getString("Config.chdir.relative")); + Validator.checkFalse(chdir.toLowerCase().equals("true") + || chdir.toLowerCase().equals("false"), + "chdir", Messages.getString("Config.chdir.path")); + } + Validator.checkOptFile(manifest, "manifest", Messages.getString("Config.manifest")); + Validator.checkOptFile(icon, "icon", Messages.getString("Config.icon")); + Validator.checkOptString(cmdLine, Validator.MAX_BIG_STR, "jarArgs", + Messages.getString("Config.jar.arguments")); + Validator.checkOptString(errTitle, Validator.MAX_STR, "errTitle", + Messages.getString("Config.error.title")); + Validator.checkOptString(downloadUrl, 256, + "downloadUrl", Messages.getString("Config.download.url")); + Validator.checkOptString(supportUrl, 256, + "supportUrl", Messages.getString("Config.support.url")); + Validator.checkIn(getHeaderType(), HEADER_TYPES, "headerType", + Messages.getString("Config.header.type")); + Validator.checkFalse(!isGuiApplication() && splash != null, + "headerType", + Messages.getString("Config.splash.not.impl.by.console.hdr")); + Validator.checkOptStrings(variables, + Validator.MAX_ARGS, + Validator.MAX_ARGS, + "[^=%\t]+=[^\t]+", + "variables", + Messages.getString("Config.variables"), + Messages.getString("Config.variables.err")); + Validator.checkIn(getPriority(), PRIORITY_CLASS_NAMES, "priority", + Messages.getString("Config.priority")); + checkJniInvariants(); + jre.checkInvariants(); + } + + private void checkJniInvariants() { + // TODO: Remove once JNI is fully implemented. + if (isJniApplication()) { + Validator.checkTrue(".".equals(chdir), "chdir", + "Only '.' is allowed in change directory."); + Validator.checkTrue(Validator.isEmpty(cmdLine), "cmdLine", + "Constant command line arguments not supported."); + Validator.checkFalse(stayAlive, "stayAlive", + "Stay alive option is not used in JNI, this is the default behavior."); + Validator.checkFalse(restartOnCrash, "restartOnCrash", + "Restart on crash not supported."); + Validator.checkIn(getPriority(), new String[] { "normal" }, "priority", + "Process priority is not supported,"); + Validator.checkNotNull(classPath, "classpath", "classpath"); + Validator.checkFalse(jre.getRequires64Bit(), "jre.requires64Bit", + "64-bit JRE not supported."); + } + } + + public void validate() { + checkInvariants(); + if (classPath != null) { + classPath.checkInvariants(); + } + if (splash != null) { + splash.checkInvariants(); + } + if (versionInfo != null) { + versionInfo.checkInvariants(); + } + } + + /** Change current directory to EXE location. */ + public String getChdir() { + return chdir; + } + + public void setChdir(String chdir) { + this.chdir = chdir; + } + + /** Constant command line arguments passed to the application. */ + public String getCmdLine() { + return cmdLine; + } + + public void setCmdLine(String cmdLine) { + this.cmdLine = cmdLine; + } + + /** Optional, error message box title. */ + public String getErrTitle() { + return errTitle; + } + + public void setErrTitle(String errTitle) { + this.errTitle = errTitle; + } + + public boolean isGuiApplication() { + return GUI_HEADER.equals(headerType) || JNI_GUI_HEADER_32.equals(headerType); + } + + public boolean isJniApplication() { + return JNI_GUI_HEADER_32.equals(headerType) + || JNI_CONSOLE_HEADER_32.equals(headerType); + } + + /** launch4j header file. */ + public String getHeaderType() { + return headerType; + } + + public void setHeaderType(String headerType) { + this.headerType = headerType; + } + + /** launch4j header file index - used by GUI. */ + public int getHeaderTypeIndex() { + int x = Arrays.asList(HEADER_TYPES).indexOf(getHeaderType()); + return x != -1 ? x : 0; + } + + public void setHeaderTypeIndex(int headerTypeIndex) { + headerType = HEADER_TYPES[headerTypeIndex]; + } + + public boolean isCustomHeaderObjects() { + return headerObjects != null && !headerObjects.isEmpty(); + } + + public List getHeaderObjects() { + return isCustomHeaderObjects() ? headerObjects + : LdDefaults.getHeaderObjects(getHeaderTypeIndex()); + } + + public void setHeaderObjects(List headerObjects) { + this.headerObjects = headerObjects; + } + + public boolean isCustomLibs() { + return libs != null && !libs.isEmpty(); + } + + public List getLibs() { + return isCustomLibs() ? libs : LdDefaults.getLibs(headerType); + } + + public void setLibs(List libs) { + this.libs = libs; + } + + /** Wrapper's manifest for User Account Control. */ + public File getManifest() { + return manifest; + } + + public void setManifest(File manifest) { + this.manifest = manifest; + } + + /** ICO file. */ + public File getIcon() { + return icon; + } + + public void setIcon(File icon) { + this.icon = icon; + } + + /** Jar to wrap. */ + public File getJar() { + return jar; + } + + public void setJar(File jar) { + this.jar = jar; + } + + public List getVariables() { + return variables; + } + + public void setVariables(List variables) { + this.variables = variables; + } + + public ClassPath getClassPath() { + return classPath; + } + + public void setClassPath(ClassPath classpath) { + this.classPath = classpath; + } + + /** JRE configuration */ + public Jre getJre() { + return jre; + } + + public void setJre(Jre jre) { + this.jre = jre; + } + + /** Output EXE file. */ + public File getOutfile() { + return outfile; + } + + public void setOutfile(File outfile) { + this.outfile = outfile; + } + + /** Splash screen configuration. */ + public Splash getSplash() { + return splash; + } + + public void setSplash(Splash splash) { + this.splash = splash; + } + + /** Stay alive after launching the application. */ + public boolean isStayAlive() { + return stayAlive; + } + + public void setStayAlive(boolean stayAlive) { + this.stayAlive = stayAlive; + } + + /** Restart the application after a crash (i.e. exit code other than 0) */ + public boolean isRestartOnCrash() { + return restartOnCrash; + } + + public void setRestartOnCrash(boolean restartOnCrash) { + this.restartOnCrash = restartOnCrash; + } + + public VersionInfo getVersionInfo() { + return versionInfo; + } + + public void setVersionInfo(VersionInfo versionInfo) { + this.versionInfo = versionInfo; + } + + public boolean isDontWrapJar() { + return dontWrapJar; + } + + public void setDontWrapJar(boolean dontWrapJar) { + this.dontWrapJar = dontWrapJar; + } + + public int getPriorityIndex() { + int x = Arrays.asList(PRIORITY_CLASS_NAMES).indexOf(getPriority()); + return x != -1 ? x : 0; + } + + public void setPriorityIndex(int x) { + priority = PRIORITY_CLASS_NAMES[x]; + } + + public String getPriority() { + return Validator.isEmpty(priority) ? PRIORITY_CLASS_NAMES[0] : priority; + } + + public void setPriority(String priority) { + this.priority = priority; + } + + public int getPriorityClass() { + return PRIORITY_CLASSES[getPriorityIndex()]; + } + + public String getDownloadUrl() { + return downloadUrl; + } + + public void setDownloadUrl(String downloadUrl) { + this.downloadUrl = downloadUrl; + } + + public String getSupportUrl() { + return supportUrl; + } + + public void setSupportUrl(String supportUrl) { + this.supportUrl = supportUrl; + } + + public Msg getMessages() { + return messages; + } + + public void setMessages(Msg messages) { + this.messages = messages; + } + + public SingleInstance getSingleInstance() { + return singleInstance; + } + + public void setSingleInstance(SingleInstance singleInstance) { + this.singleInstance = singleInstance; + } +} diff --git a/launch4j/src/net/sf/launch4j/config/ConfigPersister.java b/launch4j/src/net/sf/launch4j/config/ConfigPersister.java index cca274a..5f0434c 100644 --- a/launch4j/src/net/sf/launch4j/config/ConfigPersister.java +++ b/launch4j/src/net/sf/launch4j/config/ConfigPersister.java @@ -1,276 +1,200 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 22, 2005 - */ -package net.sf.launch4j.config; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSSerializer; - -import net.sf.launch4j.Util; - -import com.thoughtworks.xstream.XStream; -import com.thoughtworks.xstream.io.xml.DomDriver; - -/** - * @author Copyright (C) 2014 Grzegorz Kowal - */ -public class ConfigPersister { - - private static final ConfigPersister _instance = new ConfigPersister(); - - private final XStream _xstream; - private Config _config; - private File _configPath; - - private ConfigPersister() { - _xstream = new XStream(new DomDriver()); - _xstream.alias("launch4jConfig", Config.class); - _xstream.alias("classPath", ClassPath.class); - _xstream.alias("jre", Jre.class); - _xstream.alias("splash", Splash.class); - _xstream.alias("versionInfo", VersionInfo.class); - - _xstream.addImplicitCollection(Config.class, "headerObjects", "obj", - String.class); - _xstream.addImplicitCollection(Config.class, "libs", "lib", String.class); - _xstream.addImplicitCollection(Config.class, "variables", "var", String.class); - _xstream.addImplicitCollection(ClassPath.class, "paths", "cp", String.class); - _xstream.addImplicitCollection(Jre.class, "options", "opt", String.class); - } - - public static ConfigPersister getInstance() { - return _instance; - } - - public Config getConfig() { - return _config; - } - - public File getConfigPath() { - return _configPath; - } - - public File getOutputPath() throws IOException { - if (_config.getOutfile().isAbsolute()) { - return _config.getOutfile().getParentFile(); - } - File parent = _config.getOutfile().getParentFile(); - return (parent != null) ? new File(_configPath, parent.getPath()) : _configPath; - } - - public File getOutputFile() throws IOException { - return _config.getOutfile().isAbsolute() - ? _config.getOutfile() - : new File(getOutputPath(), _config.getOutfile().getName()); - } - - public void createBlank() { - _config = new Config(); - _config.setJre(new Jre()); - _configPath = null; - } - - public void setAntConfig(Config c, File basedir) { - _config = c; - _configPath = basedir; - } - - public void load(File f) throws ConfigPersisterException { - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - Document doc = builder.parse(f); - - DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation(); - LSSerializer lsSerializer = domImplementation.createLSSerializer(); - String configString = lsSerializer.writeToString(doc); - - _config = (Config) _xstream.fromXML(convertToCurrent(configString)); - setConfigPath(f); - } catch (Exception e) { - throw new ConfigPersisterException(e); - } - } - - /** - * Imports launch4j 1.x.x config file. - */ - public void loadVersion1(File f) throws ConfigPersisterException { - try { - Props props = new Props(f); - _config = new Config(); - String header = props.getProperty(Config.HEADER); - _config.setHeaderType(header == null - || header.toLowerCase().equals("guihead.bin") ? Config.GUI_HEADER - : Config.CONSOLE_HEADER); - _config.setJar(props.getFile(Config.JAR)); - _config.setOutfile(props.getFile(Config.OUTFILE)); - _config.setJre(new Jre()); - _config.getJre().setPath(props.getProperty(Jre.PATH)); - _config.getJre().setMinVersion(props.getProperty(Jre.MIN_VERSION)); - _config.getJre().setMaxVersion(props.getProperty(Jre.MAX_VERSION)); - - String args = props.getProperty(Jre.ARGS); - - if (args != null) { - List jreOptions = new ArrayList(); - jreOptions.add(args); - _config.getJre().setOptions(jreOptions); - } - - _config.setCmdLine(props.getProperty(Config.JAR_ARGS)); - _config.setChdir("true".equals(props.getProperty(Config.CHDIR)) - ? "." : null); - _config.setStayAlive("true".equals(props.getProperty(Config.STAY_ALIVE))); - _config.setErrTitle(props.getProperty(Config.ERR_TITLE)); - _config.setIcon(props.getFile(Config.ICON)); - - File splashFile = props.getFile(Splash.SPLASH_FILE); - - if (splashFile != null) { - _config.setSplash(new Splash()); - _config.getSplash().setFile(splashFile); - String waitfor = props.getProperty("waitfor"); // 1.x - _config.getSplash().setWaitForWindow(waitfor != null - && !waitfor.equals("")); - String splashTimeout = props.getProperty(Splash.TIMEOUT); - if (splashTimeout != null) { - _config.getSplash().setTimeout(Integer.parseInt(splashTimeout)); - } - _config.getSplash().setTimeoutErr("true".equals( - props.getProperty(Splash.TIMEOUT_ERR))); - } else { - _config.setSplash(null); - } - setConfigPath(f); - } catch (IOException e) { - throw new ConfigPersisterException(e); - } - } - - public void save(File f) throws ConfigPersisterException { - try { - BufferedWriter w = new BufferedWriter( - new OutputStreamWriter(new FileOutputStream(f), "UTF-8")); - w.write("\n"); - _xstream.toXML(_config, w); - w.close(); - setConfigPath(f); - } catch (Exception e) { - throw new ConfigPersisterException(e); - } - } - - /** - * Converts 2.x config to current format. - */ - private String convertToCurrent(String configString) { - return configString - .replaceAll("0<", "gui<") - .replaceAll("1<", "console<") - .replaceAll("jarArgs>", "cmdLine>") - .replaceAll("", "") - .replaceAll("args>", "opt>") - .replaceAll("", "") - .replaceAll("false", - "" + Jre.JDK_PREFERENCE_PREFER_JRE + "") - .replaceAll("true", - "" + Jre.JDK_PREFERENCE_JRE_ONLY + "") - .replaceAll("0", "") - .replaceAll("0", "") - .replaceAll(".*", ""); - } - - private void setConfigPath(File configFile) { - _configPath = configFile.getAbsoluteFile().getParentFile(); - } - - private class Props { - final Properties _properties = new Properties(); - - public Props(File f) throws IOException { - FileInputStream is = null; - try { - is = new FileInputStream(f); - _properties.load(is); - } finally { - Util.close(is); - } - } - - /** - * Get property and remove trailing # comments. - */ - public String getProperty(String key) { - String p = _properties.getProperty(key); - - if (p == null) { - return null; - } - - int x = p.indexOf('#'); - - if (x == -1) { - return p; - } - - do { - x--; - } while (x > 0 && (p.charAt(x) == ' ' || p.charAt(x) == '\t')); - - return (x == 0) ? "" : p.substring(0, x + 1); - } - - public File getFile(String key) { - String value = getProperty(key); - return value != null ? new File(value) : null; - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 22, 2005 + */ +package net.sf.launch4j.config; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.Collection; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.w3c.dom.Document; +import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSSerializer; + +import com.thoughtworks.xstream.XStream; +import com.thoughtworks.xstream.io.xml.DomDriver; +import com.thoughtworks.xstream.security.*; + +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2014 Grzegorz Kowal + */ +public class ConfigPersister { + + private static final ConfigPersister _instance = new ConfigPersister(); + + private final XStream _xstream; + private Config _config; + private File _configPath; + + private ConfigPersister() { + _xstream = new XStream(new DomDriver()); + + _xstream.addPermission(NoTypePermission.NONE); + _xstream.addPermission(NullPermission.NULL); + _xstream.addPermission(PrimitiveTypePermission.PRIMITIVES); + _xstream.allowTypeHierarchy(Collection.class); + _xstream.allowTypesByWildcard(new String[] { "net.sf.launch4j.config.*" }); + + _xstream.alias("launch4jConfig", Config.class); + _xstream.alias("classPath", ClassPath.class); + _xstream.alias("jre", Jre.class); + _xstream.alias("splash", Splash.class); + _xstream.alias("versionInfo", VersionInfo.class); + + _xstream.addImplicitCollection(Config.class, "headerObjects", "obj", + String.class); + _xstream.addImplicitCollection(Config.class, "libs", "lib", String.class); + _xstream.addImplicitCollection(Config.class, "variables", "var", String.class); + _xstream.addImplicitCollection(ClassPath.class, "paths", "cp", String.class); + _xstream.addImplicitCollection(Jre.class, "options", "opt", String.class); + } + + public static ConfigPersister getInstance() { + return _instance; + } + + public Config getConfig() { + return _config; + } + + public File getConfigPath() { + return _configPath; + } + + public File getOutputPath() throws IOException { + if (_config.getOutfile().isAbsolute()) { + return _config.getOutfile().getParentFile(); + } + File parent = _config.getOutfile().getParentFile(); + return (parent != null) ? new File(_configPath, parent.getPath()) : _configPath; + } + + public File getOutputFile() throws IOException { + return _config.getOutfile().isAbsolute() + ? _config.getOutfile() + : new File(getOutputPath(), _config.getOutfile().getName()); + } + + public void createBlank() { + _config = new Config(); + _config.setJre(new Jre()); + _configPath = null; + } + + public void setAntConfig(Config c, File basedir) { + _config = c; + _configPath = basedir; + } + + public void load(File f) throws ConfigPersisterException { + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document doc = builder.parse(f); + + DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation(); + LSSerializer lsSerializer = domImplementation.createLSSerializer(); + String configString = lsSerializer.writeToString(doc); + + _config = convertToCurrent(configString); + setConfigPath(f); + } catch (Exception e) { + throw new ConfigPersisterException(e); + } + } + + + public void save(File f) throws ConfigPersisterException { + try { + BufferedWriter w = new BufferedWriter( + new OutputStreamWriter(new FileOutputStream(f), "UTF-8")); + w.write("\n"); + _xstream.toXML(_config, w); + w.close(); + setConfigPath(f); + } catch (Exception e) { + throw new ConfigPersisterException(e); + } + } + + /** + * Converts 2.x config to current format. + */ + private Config convertToCurrent(String configString) { + boolean requires64Bit = configString.contains("true") + || configString.contains("64"); + + String updatedConfigString = configString + .replaceAll("0<", "gui<") + .replaceAll("1<", "console<") + .replaceAll("jarArgs>", "cmdLine>") + .replaceAll("", "") + .replaceAll("args>", "opt>") + .replaceAll("", "") + .replaceAll("jdkOnly", "true") + .replaceAll("0", "") + .replaceAll("0", "") + .replaceAll(".*", "") + .replaceAll(".*", "") + .replaceAll(".*", "") + .replaceAll(".*", "") + .replaceAll(".*", ""); + + Config config = (Config) _xstream.fromXML(updatedConfigString); + + if (Validator.isEmpty(config.getJre().getPath())) { + config.getJre().setPath(Jre.DEFAULT_PATH); + } + + if (requires64Bit) { + config.getJre().setRequires64Bit(true); + } + + return config; + } + + private void setConfigPath(File configFile) { + _configPath = configFile.getAbsoluteFile().getParentFile(); + } +} diff --git a/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java b/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java index 8a055b2..729d4e5 100644 --- a/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java +++ b/launch4j/src/net/sf/launch4j/config/ConfigPersisterException.java @@ -1,51 +1,51 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 22, 2005 - */ -package net.sf.launch4j.config; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class ConfigPersisterException extends Exception { - - public ConfigPersisterException(String msg, Throwable t) { - super(msg, t); - } - - public ConfigPersisterException(Throwable t) { - super(t); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 22, 2005 + */ +package net.sf.launch4j.config; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class ConfigPersisterException extends Exception { + + public ConfigPersisterException(String msg, Throwable t) { + super(msg, t); + } + + public ConfigPersisterException(Throwable t) { + super(t); + } +} diff --git a/launch4j/src/net/sf/launch4j/config/Describable.java b/launch4j/src/net/sf/launch4j/config/Describable.java index f98a7a5..c9f9c6b 100644 --- a/launch4j/src/net/sf/launch4j/config/Describable.java +++ b/launch4j/src/net/sf/launch4j/config/Describable.java @@ -1,18 +1,18 @@ -package net.sf.launch4j.config; - -import java.util.Comparator; - -public interface Describable { - - String getDescription(); - - int getIndex(); - - class DescribableComparator implements Comparator { - - @Override - public int compare(Describable o1, Describable o2) { - return o1.getDescription().compareTo(o2.getDescription()); - } - } -} +package net.sf.launch4j.config; + +import java.util.Comparator; + +public interface Describable { + + String getDescription(); + + int getIndex(); + + class DescribableComparator implements Comparator { + + @Override + public int compare(Describable o1, Describable o2) { + return o1.getDescription().compareTo(o2.getDescription()); + } + } +} diff --git a/launch4j/src/net/sf/launch4j/config/Jre.java b/launch4j/src/net/sf/launch4j/config/Jre.java index cd91661..5586236 100644 --- a/launch4j/src/net/sf/launch4j/config/Jre.java +++ b/launch4j/src/net/sf/launch4j/config/Jre.java @@ -1,292 +1,194 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 21, 2005 - */ -package net.sf.launch4j.config; - -import java.util.Arrays; -import java.util.List; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Jre implements IValidatable { - - // 1.x config properties_____________________________________________________________ - public static final String PATH = "jrepath"; - public static final String MIN_VERSION = "javamin"; - public static final String MAX_VERSION = "javamax"; - public static final String ARGS = "jvmArgs"; - - // __________________________________________________________________________________ - public static final String VERSION_PATTERN = "(1\\.\\d\\.\\d(_\\d{1,3})?)|[1-9][0-9]{0,2}(\\.\\d{1,3}){0,2}"; - - public static final String JDK_PREFERENCE_JRE_ONLY = "jreOnly"; - public static final String JDK_PREFERENCE_PREFER_JRE = "preferJre"; - public static final String JDK_PREFERENCE_PREFER_JDK = "preferJdk"; - public static final String JDK_PREFERENCE_JDK_ONLY = "jdkOnly"; - - public static final String RUNTIME_BITS_64 = "64"; - public static final String RUNTIME_BITS_64_AND_32 = "64/32"; - public static final String RUNTIME_BITS_32_AND_64 = "32/64"; - public static final String RUNTIME_BITS_32 = "32"; - - private static final String[] JDK_PREFERENCE_NAMES = new String[] { - JDK_PREFERENCE_JRE_ONLY, - JDK_PREFERENCE_PREFER_JRE, - JDK_PREFERENCE_PREFER_JDK, - JDK_PREFERENCE_JDK_ONLY }; - - private static final String[] RUNTIME_BITS_OPTIONS = new String[] { - RUNTIME_BITS_64, - RUNTIME_BITS_64_AND_32, - RUNTIME_BITS_32_AND_64, - RUNTIME_BITS_32 }; - - public static final int DEFAULT_JDK_PREFERENCE_INDEX - = Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(JDK_PREFERENCE_PREFER_JRE); - - public static final int DEFAULT_RUNTIME_BITS_INDEX - = Arrays.asList(RUNTIME_BITS_OPTIONS).indexOf(RUNTIME_BITS_64_AND_32); - - private String path; - private boolean bundledJre64Bit; - private boolean bundledJreAsFallback; - private String minVersion; - private String maxVersion; - private String jdkPreference; - private String runtimeBits; - private Integer initialHeapSize; - private Integer initialHeapPercent; - private Integer maxHeapSize; - private Integer maxHeapPercent; - private List options; - - public void checkInvariants() { - Validator.checkOptString(minVersion, 20, VERSION_PATTERN, - "jre.minVersion", Messages.getString("Jre.min.version")); - Validator.checkOptString(maxVersion, 20, VERSION_PATTERN, - "jre.maxVersion", Messages.getString("Jre.max.version")); - if (Validator.isEmpty(path)) { - Validator.checkFalse(bundledJre64Bit, "jre.bundledJre64Bit", - Messages.getString("Jre.bundled.64bit.invalid")); - Validator.checkFalse(bundledJreAsFallback, "jre.bundledJreAsFallback", - Messages.getString("Jre.bundled.fallback.invalid")); - Validator.checkFalse(Validator.isEmpty(minVersion), - "jre.minVersion", Messages.getString("Jre.specify.jre.min.version.or.path")); - } else { - Validator.checkString(path, Validator.MAX_PATH, - "jre.path", Messages.getString("Jre.bundled.path")); - } - if (!Validator.isEmpty(maxVersion)) { - Validator.checkFalse(Validator.isEmpty(minVersion), - "jre.minVersion", Messages.getString("Jre.specify.min.version")); - Validator.checkTrue(JreVersion.parseString(minVersion).compareTo(JreVersion.parseString(maxVersion)) < 0, - "jre.maxVersion", Messages.getString("Jre.max.greater.than.min")); - } - Validator.checkTrue(initialHeapSize == null || maxHeapSize != null, - "jre.maxHeapSize", Messages.getString("Jre.initial.and.max.heap")); - Validator.checkTrue(initialHeapSize == null || initialHeapSize.intValue() > 0, - "jre.initialHeapSize", Messages.getString("Jre.initial.heap")); - Validator.checkTrue(maxHeapSize == null || (maxHeapSize.intValue() - >= ((initialHeapSize != null) ? initialHeapSize.intValue() : 1)), - "jre.maxHeapSize", Messages.getString("Jre.max.heap")); - Validator.checkTrue(initialHeapPercent == null || maxHeapPercent != null, - "jre.maxHeapPercent", Messages.getString("Jre.initial.and.max.heap")); - if (initialHeapPercent != null) { - Validator.checkRange(initialHeapPercent.intValue(), 1, 100, - "jre.initialHeapPercent", - Messages.getString("Jre.initial.heap.percent")); - } - if (maxHeapPercent != null) { - Validator.checkRange(maxHeapPercent.intValue(), - initialHeapPercent != null ? initialHeapPercent.intValue() : 1, 100, - "jre.maxHeapPercent", - Messages.getString("Jre.max.heap.percent")); - } - Validator.checkIn(getJdkPreference(), JDK_PREFERENCE_NAMES, - "jre.jdkPreference", Messages.getString("Jre.jdkPreference")); - Validator.checkIn(getRuntimeBits(), RUNTIME_BITS_OPTIONS, - "jre.runtimeBits", Messages.getString("Jre.runtimeBits")); - Validator.checkOptStrings(options, - Validator.MAX_ARGS, - Validator.MAX_ARGS, - "[^\"]*|([^\"]*\"[^\"]*\"[^\"]*)*", - "jre.options", - Messages.getString("Jre.jvm.options"), - Messages.getString("Jre.jvm.options.unclosed.quotation")); - - // Quoted variable references: "[^%]*|([^%]*\"([^%]*%[^%]+%[^%]*)+\"[^%]*)*" - Validator.checkOptStrings(options, - Validator.MAX_ARGS, - Validator.MAX_ARGS, - "[^%]*|([^%]*([^%]*%[^%]*%[^%]*)+[^%]*)*", - "jre.options", - Messages.getString("Jre.jvm.options"), - Messages.getString("Jre.jvm.options.variable")); - } - - /** JVM options */ - public List getOptions() { - return options; - } - - public void setOptions(List options) { - this.options = options; - } - - /** Max Java version (x.x.x) */ - public String getMaxVersion() { - return maxVersion; - } - - public void setMaxVersion(String maxVersion) { - this.maxVersion = maxVersion; - } - - /** Min Java version (x.x.x) */ - public String getMinVersion() { - return minVersion; - } - - public void setMinVersion(String minVersion) { - this.minVersion = minVersion; - } - - /** Preference for standalone JRE or JDK-private JRE */ - public String getJdkPreference() { - return Validator.isEmpty(jdkPreference) ? JDK_PREFERENCE_PREFER_JRE - : jdkPreference; - } - - public void setJdkPreference(String jdkPreference) { - this.jdkPreference = jdkPreference; - } - - /** Preference for standalone JRE or JDK-private JRE */ - public int getJdkPreferenceIndex() { - int x = Arrays.asList(JDK_PREFERENCE_NAMES).indexOf(getJdkPreference()); - return x != -1 ? x : DEFAULT_JDK_PREFERENCE_INDEX; - } - - public void setJdkPreferenceIndex(int x) { - this.jdkPreference = JDK_PREFERENCE_NAMES[x]; - } - - public String getRuntimeBits() { - return Validator.isEmpty(runtimeBits) ? RUNTIME_BITS_64_AND_32 - : runtimeBits; - } - - public void setRuntimeBits(String runtimeBits) { - this.runtimeBits = runtimeBits; - } - - public int getRuntimeBitsIndex() { - int x = Arrays.asList(RUNTIME_BITS_OPTIONS).indexOf(getRuntimeBits()); - return x != -1 ? x : DEFAULT_RUNTIME_BITS_INDEX; - } - - public void setRuntimeBitsIndex(int x) { - this.runtimeBits = RUNTIME_BITS_OPTIONS[x]; - } - - /** JRE path */ - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public boolean getBundledJre64Bit() { - return bundledJre64Bit; - } - - public void setBundledJre64Bit(boolean bundledJre64Bit) { - this.bundledJre64Bit = bundledJre64Bit; - } - - public boolean getBundledJreAsFallback() { - return bundledJreAsFallback; - } - - public void setBundledJreAsFallback(boolean bundledJreAsFallback) { - this.bundledJreAsFallback = bundledJreAsFallback; - } - - /** Initial heap size in MB */ - public Integer getInitialHeapSize() { - return initialHeapSize; - } - - public void setInitialHeapSize(Integer initialHeapSize) { - this.initialHeapSize = getInteger(initialHeapSize); - } - - /** Max heap size in MB */ - public Integer getMaxHeapSize() { - return maxHeapSize; - } - - public void setMaxHeapSize(Integer maxHeapSize) { - this.maxHeapSize = getInteger(maxHeapSize); - } - - public Integer getInitialHeapPercent() { - return initialHeapPercent; - } - - public void setInitialHeapPercent(Integer initialHeapPercent) { - this.initialHeapPercent = getInteger(initialHeapPercent); - } - - public Integer getMaxHeapPercent() { - return maxHeapPercent; - } - - public void setMaxHeapPercent(Integer maxHeapPercent) { - this.maxHeapPercent = getInteger(maxHeapPercent); - } - - /** Convert 0 to null */ - private Integer getInteger(Integer i) { - return i != null && i.intValue() == 0 ? null : i; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 21, 2005 + */ +package net.sf.launch4j.config; + +import java.util.List; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Jre implements IValidatable { + + public static final String VERSION_PATTERN = "(1\\.\\d\\.\\d(_\\d{1,3})?)|[1-9][0-9]{0,2}(\\.\\d{1,3}){0,2}"; + public static final String DEFAULT_PATH = "%JAVA_HOME%;%PATH%"; + + private String path; + private boolean requiresJdk; + private boolean requires64Bit; + private String minVersion; + private String maxVersion; + private Integer initialHeapSize; + private Integer initialHeapPercent; + private Integer maxHeapSize; + private Integer maxHeapPercent; + private List options; + + public void checkInvariants() { + Validator.checkOptString(minVersion, 20, VERSION_PATTERN, "jre.minVersion", + Messages.getString("Jre.min.version")); + Validator.checkOptString(maxVersion, 20, VERSION_PATTERN, "jre.maxVersion", + Messages.getString("Jre.max.version")); + Validator.checkString(path, Validator.MAX_PATH, "jre.path", Messages.getString("Jre.path")); + if (!Validator.isEmpty(maxVersion)) { + Validator.checkFalse(Validator.isEmpty(minVersion), "jre.minVersion", + Messages.getString("Jre.specify.min.version")); + Validator.checkTrue(JreVersion.parseString(minVersion).compareTo(JreVersion.parseString(maxVersion)) < 0, + "jre.maxVersion", Messages.getString("Jre.max.greater.than.min")); + } + Validator.checkTrue(initialHeapSize == null || maxHeapSize != null, "jre.maxHeapSize", + Messages.getString("Jre.initial.and.max.heap")); + Validator.checkTrue(initialHeapSize == null || initialHeapSize.intValue() > 0, "jre.initialHeapSize", + Messages.getString("Jre.initial.heap")); + Validator.checkTrue( + maxHeapSize == null + || (maxHeapSize.intValue() >= ((initialHeapSize != null) ? initialHeapSize.intValue() : 1)), + "jre.maxHeapSize", Messages.getString("Jre.max.heap")); + Validator.checkTrue(initialHeapPercent == null || maxHeapPercent != null, "jre.maxHeapPercent", + Messages.getString("Jre.initial.and.max.heap")); + if (initialHeapPercent != null) { + Validator.checkRange(initialHeapPercent.intValue(), 1, 100, "jre.initialHeapPercent", + Messages.getString("Jre.initial.heap.percent")); + } + if (maxHeapPercent != null) { + Validator.checkRange(maxHeapPercent.intValue(), + initialHeapPercent != null ? initialHeapPercent.intValue() : 1, 100, "jre.maxHeapPercent", + Messages.getString("Jre.max.heap.percent")); + } + Validator.checkOptStrings(options, Validator.MAX_ARGS, Validator.MAX_ARGS, "[^\"]*|([^\"]*\"[^\"]*\"[^\"]*)*", + "jre.options", Messages.getString("Jre.jvm.options"), + Messages.getString("Jre.jvm.options.unclosed.quotation")); + + // Quoted variable references: "[^%]*|([^%]*\"([^%]*%[^%]+%[^%]*)+\"[^%]*)*" + Validator.checkOptStrings(options, Validator.MAX_ARGS, Validator.MAX_ARGS, + "[^%]*|([^%]*([^%]*%[^%]*%[^%]*)+[^%]*)*", "jre.options", Messages.getString("Jre.jvm.options"), + Messages.getString("Jre.jvm.options.variable")); + } + + /** JVM options */ + public List getOptions() { + return options; + } + + public void setOptions(List options) { + this.options = options; + } + + /** Max Java version (x.x.x) */ + public String getMaxVersion() { + return maxVersion; + } + + public void setMaxVersion(String maxVersion) { + this.maxVersion = maxVersion; + } + + /** Min Java version (x.x.x) */ + public String getMinVersion() { + return minVersion; + } + + public void setMinVersion(String minVersion) { + this.minVersion = minVersion; + } + + public boolean getRequiresJdk() { + return this.requiresJdk; + } + + public void setRequiresJdk(boolean requiresJdk) { + this.requiresJdk = requiresJdk; + } + + /** JRE path */ + public String getPath() { + return this.path; + } + + public void setPath(String path) { + this.path = path; + } + + public boolean getRequires64Bit() { + return requires64Bit; + } + + public void setRequires64Bit(boolean requires64Bit) { + this.requires64Bit= requires64Bit; + } + + /** Initial heap size in MB */ + public Integer getInitialHeapSize() { + return initialHeapSize; + } + + public void setInitialHeapSize(Integer initialHeapSize) { + this.initialHeapSize = getInteger(initialHeapSize); + } + + /** Max heap size in MB */ + public Integer getMaxHeapSize() { + return maxHeapSize; + } + + public void setMaxHeapSize(Integer maxHeapSize) { + this.maxHeapSize = getInteger(maxHeapSize); + } + + public Integer getInitialHeapPercent() { + return initialHeapPercent; + } + + public void setInitialHeapPercent(Integer initialHeapPercent) { + this.initialHeapPercent = getInteger(initialHeapPercent); + } + + public Integer getMaxHeapPercent() { + return maxHeapPercent; + } + + public void setMaxHeapPercent(Integer maxHeapPercent) { + this.maxHeapPercent = getInteger(maxHeapPercent); + } + + /** Convert 0 to null */ + private Integer getInteger(Integer i) { + return i != null && i.intValue() == 0 ? null : i; + } +} diff --git a/launch4j/src/net/sf/launch4j/config/JreVersion.java b/launch4j/src/net/sf/launch4j/config/JreVersion.java index 185257e..83b90f5 100644 --- a/launch4j/src/net/sf/launch4j/config/JreVersion.java +++ b/launch4j/src/net/sf/launch4j/config/JreVersion.java @@ -1,124 +1,124 @@ -package net.sf.launch4j.config; - -/** - * This class will abstract application from JRE versioning schema and provide - * comparing capabilities - * - * @author sergeyk - * - */ -public class JreVersion implements Comparable { - private int x1; - private int x2; - private int x3; - private int x4; - - public static JreVersion parseString(String versionStr) { - JreVersion ret = new JreVersion(); - if (versionStr == null || versionStr.trim().length() == 0) { - return ret; - } - if (!versionStr.matches(Jre.VERSION_PATTERN)) { - // NOTE: This is actually shouldn't happen because version format had to be - // checked by Jre#checkInvariants BEFORE calling this method - throw new IllegalArgumentException("JRE version is not in a right format."); - } - - String[] parts = versionStr.split("[\\._]"); - int first = Integer.parseInt(parts[0]); - if (first > 1) { - // java 9+ version schema - ret.x1 = 1; - ret.x2 = first; - if (parts.length >= 2) { - ret.x3 = Integer.parseInt(parts[1]); - if (parts.length >= 3) { - ret.x4 = Integer.parseInt(parts[2]); - } - } - } else { - // java <= 1.8 version schema - ret.x1 = first; - if (parts.length >= 2) { - ret.x2 = Integer.parseInt(parts[1]); - if (parts.length >= 3) { - ret.x3 = Integer.parseInt(parts[2]); - if (parts.length == 4) { - ret.x4 = Integer.parseInt(parts[3]); - } - } - } - } - - return ret; - } - - @Override - public String toString() { - if (x2 >= 9) { - return x2 + "." + x3 + "." + x4; - } - - return x1 + "." + x2 + "." + x3 + (x4 > 0 ? "_" + x4 : ""); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + x1; - result = prime * result + x2; - result = prime * result + x3; - result = prime * result + x4; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - JreVersion other = (JreVersion) obj; - if (x1 != other.x1) { - return false; - } - if (x2 != other.x2) { - return false; - } - if (x3 != other.x3) { - return false; - } - if (x4 != other.x4) { - return false; - } - return true; - } - - @Override - public int compareTo(JreVersion o) { - if (this.equals(o)) { - return 0; - } - - if (x1 != o.x1) { - return x1 - o.x1; - } - if (x2 != o.x2) { - return x2 - o.x2; - } - if (x3 != o.x3) { - return x3 - o.x3; - } - if (x4 != o.x4) { - return x4 - o.x4; - } - - throw new IllegalStateException("If you see this exception it means JreVersion::equals() method is buggy"); - } -} +package net.sf.launch4j.config; + +/** + * This class will abstract application from JRE versioning schema and provide + * comparing capabilities + * + * @author sergeyk + * + */ +public class JreVersion implements Comparable { + private int x1; + private int x2; + private int x3; + private int x4; + + public static JreVersion parseString(String versionStr) { + JreVersion ret = new JreVersion(); + if (versionStr == null || versionStr.trim().length() == 0) { + return ret; + } + if (!versionStr.matches(Jre.VERSION_PATTERN)) { + // NOTE: This is actually shouldn't happen because version format had to be + // checked by Jre#checkInvariants BEFORE calling this method + throw new IllegalArgumentException("JRE version is not in a right format."); + } + + String[] parts = versionStr.split("[\\._]"); + int first = Integer.parseInt(parts[0]); + if (first > 1) { + // java 9+ version schema + ret.x1 = 1; + ret.x2 = first; + if (parts.length >= 2) { + ret.x3 = Integer.parseInt(parts[1]); + if (parts.length >= 3) { + ret.x4 = Integer.parseInt(parts[2]); + } + } + } else { + // java <= 1.8 version schema + ret.x1 = first; + if (parts.length >= 2) { + ret.x2 = Integer.parseInt(parts[1]); + if (parts.length >= 3) { + ret.x3 = Integer.parseInt(parts[2]); + if (parts.length == 4) { + ret.x4 = Integer.parseInt(parts[3]); + } + } + } + } + + return ret; + } + + @Override + public String toString() { + if (x2 >= 9) { + return x2 + "." + x3 + "." + x4; + } + + return x1 + "." + x2 + "." + x3 + (x4 > 0 ? "_" + x4 : ""); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + x1; + result = prime * result + x2; + result = prime * result + x3; + result = prime * result + x4; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + JreVersion other = (JreVersion) obj; + if (x1 != other.x1) { + return false; + } + if (x2 != other.x2) { + return false; + } + if (x3 != other.x3) { + return false; + } + if (x4 != other.x4) { + return false; + } + return true; + } + + @Override + public int compareTo(JreVersion o) { + if (this.equals(o)) { + return 0; + } + + if (x1 != o.x1) { + return x1 - o.x1; + } + if (x2 != o.x2) { + return x2 - o.x2; + } + if (x3 != o.x3) { + return x3 - o.x3; + } + if (x4 != o.x4) { + return x4 - o.x4; + } + + throw new IllegalStateException("If you see this exception it means JreVersion::equals() method is buggy"); + } +} diff --git a/launch4j/src/net/sf/launch4j/config/LanguageID.java b/launch4j/src/net/sf/launch4j/config/LanguageID.java index 9648a48..b19fe36 100644 --- a/launch4j/src/net/sf/launch4j/config/LanguageID.java +++ b/launch4j/src/net/sf/launch4j/config/LanguageID.java @@ -1,132 +1,132 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2015 Sebastian Bögl - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.config; - -import java.util.Arrays; - -/** - * @see VERSIONINFO resource - * @see VarFileInfo BLOCK - */ -public enum LanguageID implements Describable { - ALBANIAN(0x041C, Messages.getString("Language.albanian")), - ARABIC(0x0401, Messages.getString("Language.arabic")), - BAHASA(0x0421, Messages.getString("Language.bahasa")), - DUTCH_BELGIAN(0x0813, Messages.getString("Language.belgian.dutch")), - FRENCH_BELGIAN(0x080C, Messages.getString("Language.belgian.french")), - BULGARIAN(0x0402, Messages.getString("Language.bulgarian")), - FRENCH_CANADIAN(0x0C0C, Messages.getString("Language.canadian.french")), - CASTILIAN_SPANISH(0x040A, Messages.getString("Language.spanish.castilian")), - CATALAN(0x0403, Messages.getString("Language.catalan")), - CROATO_SERBIAN_LATIN(0x041A, Messages.getString("Language.croato.serbian.latin")), - CZECH(0x0405, Messages.getString("Language.czech")), - DANISH(0x0406, Messages.getString("Language.danish")), - DUTCH(0x0413, Messages.getString("Language.dutch")), - ENGLISH_UK(0x0809, Messages.getString("Language.english.uk")), - ENGLISH_US(0x0409, Messages.getString("Language.english.us")), - FINNISH(0x040B, Messages.getString("Language.finnish")), - FRENCH(0x040C, Messages.getString("Language.french")), - GERMAN(0x0407, Messages.getString("Language.german")), - GREEK(0x0408, Messages.getString("Language.greek")), - HEBREW(0x040D, Messages.getString("Language.hebrew")), - HUNGARIAN(0x040E, Messages.getString("Language.hungarian")), - ICELANDIC(0x040F, Messages.getString("Language.icelandic")), - ITALIAN(0x0410, Messages.getString("Language.italian")), - JAPANESE(0x0411, Messages.getString("Language.japanese")), - KOREAN(0x0412, Messages.getString("Language.korean")), - NORWEGIAN_BOKMAL(0x0414, Messages.getString("Language.norwegian.bokmal")), - NORWEGIAN_NYNORSK(0x0814, Messages.getString("Language.norwegian.nynorsk")), - POLISH(0x0415, Messages.getString("Language.polish")), - PORTUGUESE_BRAZIL(0x0416, Messages.getString("Language.portuguese.brazil")), - PORTUGUESE_PORTUGAL(0x0816, Messages.getString("Language.portuguese.portugal")), - RHAETO_ROMANIC(0x0417, Messages.getString("Language.rhaeto.romanic")), - ROMANIAN(0x0418, Messages.getString("Language.romanian")), - RUSSIAN(0x0419, Messages.getString("Language.russian")), - SERBO_CROATIAN_CYRILLIC(0x081A, Messages.getString("Language.serbo.croatian.cyrillic")), - SIMPLIFIED_CHINESE(0x0804, Messages.getString("Language.chinese.simplified")), - SLOVAK(0x041B, Messages.getString("Language.slovak")), - SPANISH_MEXICO(0x080A, Messages.getString("Language.spanish.mexico")), - SWEDISH(0x041D, Messages.getString("Language.swedish")), - FRENCH_SWISS(0x100C, Messages.getString("Language.swiss.french")), - GERMAN_SWISS(0x0807, Messages.getString("Language.swiss.german")), - ITALIAN_SWISS(0x0810, Messages.getString("Language.swiss.italian")), - THAI(0x041E, Messages.getString("Language.thai")), - TRADITIONAL_CHINESE(0x0404, Messages.getString("Language.chinese.traditional")), - TURKISH(0x041F, Messages.getString("Language.turkish")), - URDU(0x0420, Messages.getString("Language.urdu")), - ; - - private static final LanguageID[] VALUES = LanguageID.values(); - - static { - Arrays.sort(VALUES, new DescribableComparator()); - } - - private final int id; - private final String description; - - LanguageID(int id, String description) { - this.id = id; - this.description = description; - } - - public int getId() { - return id; - } - - @Override - public String getDescription() { - return description; - } - - @Override - public String toString() { - return description; - } - - @Override - public int getIndex() { - for (int i = 0; i < VALUES.length; i++) { - if (VALUES[i] == this) { - return i; - } - } - // should never happen - return -1; - } - - public static LanguageID[] sortedValues() { - return VALUES; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2015 Sebastian Bögl + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.config; + +import java.util.Arrays; + +/** + * @see VERSIONINFO resource + * @see VarFileInfo BLOCK + */ +public enum LanguageID implements Describable { + ALBANIAN(0x041C, Messages.getString("Language.albanian")), + ARABIC(0x0401, Messages.getString("Language.arabic")), + BAHASA(0x0421, Messages.getString("Language.bahasa")), + DUTCH_BELGIAN(0x0813, Messages.getString("Language.belgian.dutch")), + FRENCH_BELGIAN(0x080C, Messages.getString("Language.belgian.french")), + BULGARIAN(0x0402, Messages.getString("Language.bulgarian")), + FRENCH_CANADIAN(0x0C0C, Messages.getString("Language.canadian.french")), + CASTILIAN_SPANISH(0x040A, Messages.getString("Language.spanish.castilian")), + CATALAN(0x0403, Messages.getString("Language.catalan")), + CROATO_SERBIAN_LATIN(0x041A, Messages.getString("Language.croato.serbian.latin")), + CZECH(0x0405, Messages.getString("Language.czech")), + DANISH(0x0406, Messages.getString("Language.danish")), + DUTCH(0x0413, Messages.getString("Language.dutch")), + ENGLISH_UK(0x0809, Messages.getString("Language.english.uk")), + ENGLISH_US(0x0409, Messages.getString("Language.english.us")), + FINNISH(0x040B, Messages.getString("Language.finnish")), + FRENCH(0x040C, Messages.getString("Language.french")), + GERMAN(0x0407, Messages.getString("Language.german")), + GREEK(0x0408, Messages.getString("Language.greek")), + HEBREW(0x040D, Messages.getString("Language.hebrew")), + HUNGARIAN(0x040E, Messages.getString("Language.hungarian")), + ICELANDIC(0x040F, Messages.getString("Language.icelandic")), + ITALIAN(0x0410, Messages.getString("Language.italian")), + JAPANESE(0x0411, Messages.getString("Language.japanese")), + KOREAN(0x0412, Messages.getString("Language.korean")), + NORWEGIAN_BOKMAL(0x0414, Messages.getString("Language.norwegian.bokmal")), + NORWEGIAN_NYNORSK(0x0814, Messages.getString("Language.norwegian.nynorsk")), + POLISH(0x0415, Messages.getString("Language.polish")), + PORTUGUESE_BRAZIL(0x0416, Messages.getString("Language.portuguese.brazil")), + PORTUGUESE_PORTUGAL(0x0816, Messages.getString("Language.portuguese.portugal")), + RHAETO_ROMANIC(0x0417, Messages.getString("Language.rhaeto.romanic")), + ROMANIAN(0x0418, Messages.getString("Language.romanian")), + RUSSIAN(0x0419, Messages.getString("Language.russian")), + SERBO_CROATIAN_CYRILLIC(0x081A, Messages.getString("Language.serbo.croatian.cyrillic")), + SIMPLIFIED_CHINESE(0x0804, Messages.getString("Language.chinese.simplified")), + SLOVAK(0x041B, Messages.getString("Language.slovak")), + SPANISH_MEXICO(0x080A, Messages.getString("Language.spanish.mexico")), + SWEDISH(0x041D, Messages.getString("Language.swedish")), + FRENCH_SWISS(0x100C, Messages.getString("Language.swiss.french")), + GERMAN_SWISS(0x0807, Messages.getString("Language.swiss.german")), + ITALIAN_SWISS(0x0810, Messages.getString("Language.swiss.italian")), + THAI(0x041E, Messages.getString("Language.thai")), + TRADITIONAL_CHINESE(0x0404, Messages.getString("Language.chinese.traditional")), + TURKISH(0x041F, Messages.getString("Language.turkish")), + URDU(0x0420, Messages.getString("Language.urdu")), + ; + + private static final LanguageID[] VALUES = LanguageID.values(); + + static { + Arrays.sort(VALUES, new DescribableComparator()); + } + + private final int id; + private final String description; + + LanguageID(int id, String description) { + this.id = id; + this.description = description; + } + + public int getId() { + return id; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public String toString() { + return description; + } + + @Override + public int getIndex() { + for (int i = 0; i < VALUES.length; i++) { + if (VALUES[i] == this) { + return i; + } + } + // should never happen + return -1; + } + + public static LanguageID[] sortedValues() { + return VALUES; + } +} diff --git a/launch4j/src/net/sf/launch4j/config/LdDefaults.java b/launch4j/src/net/sf/launch4j/config/LdDefaults.java index 4cb1387..183a78f 100644 --- a/launch4j/src/net/sf/launch4j/config/LdDefaults.java +++ b/launch4j/src/net/sf/launch4j/config/LdDefaults.java @@ -1,117 +1,108 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Sep 3, 2005 - */ -package net.sf.launch4j.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class LdDefaults { - private static final List GUI_OBJECTS = Arrays.asList(new String[] { - "w32api/crt2.o", - "head/guihead.o", - "head/head.o" }); - - private static final List CONSOLE_OBJECTS = Arrays.asList(new String[] { - "w32api/crt2.o", - "head/consolehead.o", - "head/head.o" }); - - private static final List JNI_GUI_32_OBJECTS = Arrays.asList(new String[] { - "w32api_jni/crt2.o", - "head_jni_BETA/jniguihead.o", - "head_jni_BETA/head.o", - "head_jni_BETA/jnihead.o" }); - - private static final List JNI_CONSOLE_32_OBJECTS = Arrays.asList(new String[] { - "w32api_jni/crt2.o", - "head_jni_BETA/jniconsolehead.o", - "head_jni_BETA/head.o", - "head_jni_BETA/jnihead.o" }); - - private static final List> HEADER_OBJECTS; - - private static final List LIBS = Arrays.asList(new String[] { - "w32api/libmingw32.a", - "w32api/libgcc.a", - "w32api/libmsvcrt.a", - "w32api/libkernel32.a", - "w32api/libuser32.a", - "w32api/libadvapi32.a", - "w32api/libshell32.a" }); - - private static final List JNI_LIBS = Arrays.asList(new String[] { - "w32api_jni/libmingw32.a", - "w32api_jni/libmingwex.a", - "w32api_jni/libgcc.a", - "w32api_jni/libmsvcrt.a", - "w32api_jni/libmoldname.a", - "w32api_jni/libkernel32.a", - "w32api_jni/libuser32.a", - "w32api_jni/libadvapi32.a", - "w32api_jni/libshell32.a" }); - - static { - HEADER_OBJECTS = new ArrayList>(); - HEADER_OBJECTS.add(GUI_OBJECTS); - HEADER_OBJECTS.add(CONSOLE_OBJECTS); - HEADER_OBJECTS.add(JNI_GUI_32_OBJECTS); - HEADER_OBJECTS.add(JNI_CONSOLE_32_OBJECTS); - } - - public static List getHeaderObjects(int headerTypeIndex) { - if (headerTypeIndex < 0 || headerTypeIndex > 3) { - throw new IllegalArgumentException("headerTypeIndex is out of range: " + headerTypeIndex); - } - - return HEADER_OBJECTS.get(headerTypeIndex); - } - - public static List getLibs(String headerType) { - if (Config.GUI_HEADER.equals(headerType) - || Config.CONSOLE_HEADER.equals(headerType)) { - return LIBS; - } - - if (Config.JNI_GUI_HEADER_32.equals(headerType) - || Config.JNI_CONSOLE_HEADER_32.equals(headerType)) { - return JNI_LIBS; - } - - throw new IllegalArgumentException("Unknown headerType: " + headerType); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Sep 3, 2005 + */ +package net.sf.launch4j.config; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class LdDefaults { + private static final List GUI_OBJECTS = Arrays.asList(new String[] { + "w32api/crt2.o", + "head/guihead.o", + "head/head.o" }); + + private static final List CONSOLE_OBJECTS = Arrays.asList(new String[] { + "w32api/crt2.o", + "head/consolehead.o", + "head/head.o" }); + + private static final List JNI_GUI_32_OBJECTS = Arrays.asList(new String[] { + "w32api/crt2.o", + "head_jni_BETA/jniguihead.o", + "head_jni_BETA/head.o", + "head_jni_BETA/jnihead.o" }); + + private static final List JNI_CONSOLE_32_OBJECTS = Arrays.asList(new String[] { + "w32api/crt2.o", + "head_jni_BETA/jniconsolehead.o", + "head_jni_BETA/head.o", + "head_jni_BETA/jnihead.o" }); + + private static final List> HEADER_OBJECTS; + + private static final List LIBS = Arrays.asList(new String[] { + "w32api/libmingw32.a", + "w32api/libmingwex.a", + "w32api/libgcc.a", + "w32api/libmsvcrt.a", + "w32api/libmoldname.a", + "w32api/libkernel32.a", + "w32api/libuser32.a", + "w32api/libadvapi32.a", + "w32api/libshell32.a" }); + + static { + HEADER_OBJECTS = new ArrayList>(); + HEADER_OBJECTS.add(GUI_OBJECTS); + HEADER_OBJECTS.add(CONSOLE_OBJECTS); + HEADER_OBJECTS.add(JNI_GUI_32_OBJECTS); + HEADER_OBJECTS.add(JNI_CONSOLE_32_OBJECTS); + } + + public static List getHeaderObjects(int headerTypeIndex) { + if (headerTypeIndex < 0 || headerTypeIndex > 3) { + throw new IllegalArgumentException("headerTypeIndex is out of range: " + headerTypeIndex); + } + + return HEADER_OBJECTS.get(headerTypeIndex); + } + + public static List getLibs(String headerType) { + if (Config.GUI_HEADER.equals(headerType) + || Config.CONSOLE_HEADER.equals(headerType)) { + return LIBS; + } + + if (Config.JNI_GUI_HEADER_32.equals(headerType) + || Config.JNI_CONSOLE_HEADER_32.equals(headerType)) { + return LIBS; + } + + throw new IllegalArgumentException("Unknown headerType: " + headerType); + } +} diff --git a/launch4j/src/net/sf/launch4j/config/Messages.java b/launch4j/src/net/sf/launch4j/config/Messages.java index c0f0b9d..2d3f0a7 100644 --- a/launch4j/src/net/sf/launch4j/config/Messages.java +++ b/launch4j/src/net/sf/launch4j/config/Messages.java @@ -1,78 +1,78 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.config; - -import java.text.MessageFormat; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.config.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - private static final MessageFormat FORMATTER = new MessageFormat(""); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } - - public static String getString(String key, String arg0) { - return getString(key, new Object[] {arg0}); - } - - public static String getString(String key, String arg0, String arg1) { - return getString(key, new Object[] {arg0, arg1}); - } - - public static String getString(String key, String arg0, String arg1, String arg2) { - return getString(key, new Object[] {arg0, arg1, arg2}); - } - - public static String getString(String key, Object[] args) { - try { - FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); - return FORMATTER.format(args); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.config; + +import java.text.MessageFormat; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.config.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + private static final MessageFormat FORMATTER = new MessageFormat(""); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + public static String getString(String key, String arg0) { + return getString(key, new Object[] {arg0}); + } + + public static String getString(String key, String arg0, String arg1) { + return getString(key, new Object[] {arg0, arg1}); + } + + public static String getString(String key, String arg0, String arg1, String arg2) { + return getString(key, new Object[] {arg0, arg1, arg2}); + } + + public static String getString(String key, Object[] args) { + try { + FORMATTER.applyPattern(RESOURCE_BUNDLE.getString(key)); + return FORMATTER.format(args); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/launch4j/src/net/sf/launch4j/config/Msg.java b/launch4j/src/net/sf/launch4j/config/Msg.java index a5d5fe5..1dc91cb 100644 --- a/launch4j/src/net/sf/launch4j/config/Msg.java +++ b/launch4j/src/net/sf/launch4j/config/Msg.java @@ -1,111 +1,110 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Oct 8, 2006 - */ -package net.sf.launch4j.config; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class Msg implements IValidatable { - private String startupErr; - private String bundledJreErr; - private String jreVersionErr; - private String launcherErr; - private String instanceAlreadyExistsMsg; - - public void checkInvariants() { - Validator.checkOptString(startupErr, 1024, "startupErr", - Messages.getString("Msg.startupErr")); - Validator.checkOptString(bundledJreErr, 1024, "bundledJreErr", - Messages.getString("Msg.bundledJreErr")); - Validator.checkOptString(jreVersionErr, 1024, "jreVersionErr", - Messages.getString("Msg.jreVersionErr")); - Validator.checkOptString(launcherErr, 1024, "launcherErr", - Messages.getString("Msg.launcherErr")); - Validator.checkOptString(instanceAlreadyExistsMsg, 1024, "instanceAlreadyExistsMsg", - Messages.getString("Msg.instanceAlreadyExistsMsg")); - } - - public String getStartupErr() { - return !Validator.isEmpty(startupErr) ? startupErr - : "An error occurred while starting the application."; - } - - public void setStartupErr(String startupErr) { - this.startupErr = startupErr; - } - - public String getBundledJreErr() { - return !Validator.isEmpty(bundledJreErr) ? bundledJreErr - : "This application was configured to use a bundled Java Runtime" + - " Environment but the runtime is missing or corrupted."; - } - - public void setBundledJreErr(String bundledJreErr) { - this.bundledJreErr = bundledJreErr; - } - - public String getJreVersionErr() { - return !Validator.isEmpty(jreVersionErr) ? jreVersionErr - : "This application requires a Java Runtime Environment"; - } - - public void setJreVersionErr(String jreVersionErr) { - this.jreVersionErr = jreVersionErr; - } - - public String getLauncherErr() { - return !Validator.isEmpty(launcherErr) ? launcherErr - : "The registry refers to a nonexistent Java Runtime Environment" + - " installation or the runtime is corrupted."; - } - - public void setLauncherErr(String launcherErr) { - this.launcherErr = launcherErr; - } - - public String getInstanceAlreadyExistsMsg() { - return !Validator.isEmpty(instanceAlreadyExistsMsg) ? instanceAlreadyExistsMsg - : "An application instance is already running."; - } - - public void setInstanceAlreadyExistsMsg(String instanceAlreadyExistsMsg) { - this.instanceAlreadyExistsMsg = instanceAlreadyExistsMsg; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Oct 8, 2006 + */ +package net.sf.launch4j.config; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class Msg implements IValidatable { + private String startupErr; + private String jreNotFoundErr; + private String jreVersionErr; + private String launcherErr; + private String instanceAlreadyExistsMsg; + + public void checkInvariants() { + Validator.checkOptString(startupErr, 1024, "startupErr", + Messages.getString("Msg.startupErr")); + Validator.checkOptString(jreNotFoundErr, 1024, "jreNotFoundErr", + Messages.getString("Msg.jreNotFoundErr")); + Validator.checkOptString(jreVersionErr, 1024, "jreVersionErr", + Messages.getString("Msg.jreVersionErr")); + Validator.checkOptString(launcherErr, 1024, "launcherErr", + Messages.getString("Msg.launcherErr")); + Validator.checkOptString(instanceAlreadyExistsMsg, 1024, "instanceAlreadyExistsMsg", + Messages.getString("Msg.instanceAlreadyExistsMsg")); + } + + public String getStartupErr() { + return !Validator.isEmpty(startupErr) ? startupErr + : "An error occurred while starting the application."; + } + + public void setStartupErr(String startupErr) { + this.startupErr = startupErr; + } + + public String getJreNotFoundErr() { + return !Validator.isEmpty(jreNotFoundErr) ? jreNotFoundErr + : "This application requires a Java Runtime Environment."; + } + + public void setJreNotFoundErr(String jreNotFoundErr) { + this.jreNotFoundErr = jreNotFoundErr; + } + + public String getJreVersionErr() { + return !Validator.isEmpty(jreVersionErr) ? jreVersionErr + : "This application requires a Java Runtime Environment"; + } + + public void setJreVersionErr(String jreVersionErr) { + this.jreVersionErr = jreVersionErr; + } + + public String getLauncherErr() { + return !Validator.isEmpty(launcherErr) ? launcherErr + : "The registry refers to a nonexistent Java Runtime Environment" + + " installation or the runtime is corrupted."; + } + + public void setLauncherErr(String launcherErr) { + this.launcherErr = launcherErr; + } + + public String getInstanceAlreadyExistsMsg() { + return !Validator.isEmpty(instanceAlreadyExistsMsg) ? instanceAlreadyExistsMsg + : "An application instance is already running."; + } + + public void setInstanceAlreadyExistsMsg(String instanceAlreadyExistsMsg) { + this.instanceAlreadyExistsMsg = instanceAlreadyExistsMsg; + } +} diff --git a/launch4j/src/net/sf/launch4j/config/SingleInstance.java b/launch4j/src/net/sf/launch4j/config/SingleInstance.java index d8fdd7a..b6abf9a 100644 --- a/launch4j/src/net/sf/launch4j/config/SingleInstance.java +++ b/launch4j/src/net/sf/launch4j/config/SingleInstance.java @@ -1,74 +1,74 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - * Created on 2007-09-16 - */ -package net.sf.launch4j.config; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2007 Grzegorz Kowal - */ -public class SingleInstance implements IValidatable { - - private String mutexName; - private String windowTitle; - - public void checkInvariants() { - Validator.checkString(mutexName, Validator.MAX_STR, - "singleInstance.mutexName", - Messages.getString("SingleInstance.mutexName")); - Validator.checkOptString(windowTitle, Validator.MAX_STR, - "singleInstance.windowTitle", - Messages.getString("SingleInstance.windowTitle")); - } - - public String getWindowTitle() { - return windowTitle; - } - - public void setWindowTitle(String appWindowName) { - this.windowTitle = appWindowName; - } - - public String getMutexName() { - return mutexName; - } - - public void setMutexName(String mutexName) { - this.mutexName = mutexName; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Created on 2007-09-16 + */ +package net.sf.launch4j.config; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2007 Grzegorz Kowal + */ +public class SingleInstance implements IValidatable { + + private String mutexName; + private String windowTitle; + + public void checkInvariants() { + Validator.checkString(mutexName, Validator.MAX_STR, + "singleInstance.mutexName", + Messages.getString("SingleInstance.mutexName")); + Validator.checkOptString(windowTitle, Validator.MAX_STR, + "singleInstance.windowTitle", + Messages.getString("SingleInstance.windowTitle")); + } + + public String getWindowTitle() { + return windowTitle; + } + + public void setWindowTitle(String appWindowName) { + this.windowTitle = appWindowName; + } + + public String getMutexName() { + return mutexName; + } + + public void setMutexName(String mutexName) { + this.mutexName = mutexName; + } +} diff --git a/launch4j/src/net/sf/launch4j/config/Splash.java b/launch4j/src/net/sf/launch4j/config/Splash.java index 47f76d8..75cf3d3 100644 --- a/launch4j/src/net/sf/launch4j/config/Splash.java +++ b/launch4j/src/net/sf/launch4j/config/Splash.java @@ -1,103 +1,103 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Apr 21, 2005 - */ -package net.sf.launch4j.config; - -import java.io.File; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class Splash implements IValidatable { - - // 1.x config properties_____________________________________________________________ - public static final String SPLASH_FILE = "splash"; - public static final String WAIT_FOR_TITLE = "waitForTitle"; - public static final String TIMEOUT = "splashTimeout"; - public static final String TIMEOUT_ERR = "splashTimeoutErr"; - - // __________________________________________________________________________________ - private File file; - private boolean waitForWindow = true; - private int timeout = 60; - private boolean timeoutErr = true; - - public void checkInvariants() { - Validator.checkFile(file, "splash.file", - Messages.getString("Splash.splash.file")); - Validator.checkRange(timeout, 1, 60 * 15, "splash.timeout", - Messages.getString("Splash.splash.timeout")); - } - - /** Splash screen in BMP format. */ - public File getFile() { - return file; - } - - public void setFile(File file) { - this.file = file; - } - - /** Splash timeout in seconds. */ - public int getTimeout() { - return timeout; - } - - public void setTimeout(int timeout) { - this.timeout = timeout; - } - - /** Signal error on splash timeout. */ - public boolean isTimeoutErr() { - return timeoutErr; - } - - public void setTimeoutErr(boolean timeoutErr) { - this.timeoutErr = timeoutErr; - } - - /** Hide splash screen when the child process displayes the first window. */ - public boolean getWaitForWindow() { - return waitForWindow; - } - - public void setWaitForWindow(boolean waitForWindow) { - this.waitForWindow = waitForWindow; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Apr 21, 2005 + */ +package net.sf.launch4j.config; + +import java.io.File; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class Splash implements IValidatable { + + // 1.x config properties_____________________________________________________________ + public static final String SPLASH_FILE = "splash"; + public static final String WAIT_FOR_TITLE = "waitForTitle"; + public static final String TIMEOUT = "splashTimeout"; + public static final String TIMEOUT_ERR = "splashTimeoutErr"; + + // __________________________________________________________________________________ + private File file; + private boolean waitForWindow = true; + private int timeout = 60; + private boolean timeoutErr = true; + + public void checkInvariants() { + Validator.checkFile(file, "splash.file", + Messages.getString("Splash.splash.file")); + Validator.checkRange(timeout, 1, 60 * 15, "splash.timeout", + Messages.getString("Splash.splash.timeout")); + } + + /** Splash screen in BMP format. */ + public File getFile() { + return file; + } + + public void setFile(File file) { + this.file = file; + } + + /** Splash timeout in seconds. */ + public int getTimeout() { + return timeout; + } + + public void setTimeout(int timeout) { + this.timeout = timeout; + } + + /** Signal error on splash timeout. */ + public boolean isTimeoutErr() { + return timeoutErr; + } + + public void setTimeoutErr(boolean timeoutErr) { + this.timeoutErr = timeoutErr; + } + + /** Hide splash screen when the child process displayes the first window. */ + public boolean getWaitForWindow() { + return waitForWindow; + } + + public void setWaitForWindow(boolean waitForWindow) { + this.waitForWindow = waitForWindow; + } +} diff --git a/launch4j/src/net/sf/launch4j/config/VersionInfo.java b/launch4j/src/net/sf/launch4j/config/VersionInfo.java index da7a2ca..367712c 100644 --- a/launch4j/src/net/sf/launch4j/config/VersionInfo.java +++ b/launch4j/src/net/sf/launch4j/config/VersionInfo.java @@ -1,197 +1,197 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 21, 2005 - */ -package net.sf.launch4j.config; - -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.binding.Validator; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class VersionInfo implements IValidatable { - public static final String VERSION_PATTERN = "(\\d+\\.){3}\\d+"; - public static final int DEFAULT_LANGUAGE_INDEX = LanguageID.ENGLISH_US.getIndex(); - - private String fileVersion; - private String txtFileVersion; - private String fileDescription; - private String copyright; - private String productVersion; - private String txtProductVersion; - private String productName; - private String companyName; - private String internalName; - private String originalFilename; - private String trademarks; - private LanguageID language; - - public void checkInvariants() { - Validator.checkString(fileVersion, 20, VERSION_PATTERN, - "versionInfo.fileVersion", - Messages.getString("VersionInfo.file.version")); - Validator.checkString(txtFileVersion, 50, "versionInfo.txtFileVersion", - Messages.getString("VersionInfo.txt.file.version")); - Validator.checkString(fileDescription, 150, "versionInfo.fileDescription", - Messages.getString("VersionInfo.file.description")); - Validator.checkString(copyright, 150, "versionInfo.copyright", - Messages.getString("VersionInfo.copyright")); - Validator.checkString(productVersion, 20, VERSION_PATTERN, - "versionInfo.productVersion", - Messages.getString("VersionInfo.product.version")); - Validator.checkString(txtProductVersion, 50, "versionInfo.txtProductVersion", - Messages.getString("VersionInfo.txt.product.version")); - Validator.checkString(productName, 150, "versionInfo.productName", - Messages.getString("VersionInfo.product.name")); - Validator.checkOptString(companyName, 150, "versionInfo.companyName", - Messages.getString("VersionInfo.company.name")); - Validator.checkString(internalName, 50, "versionInfo.internalName", - Messages.getString("VersionInfo.internal.name")); - Validator.checkOptString(trademarks, 150, "versionInfo.trademarks", - Messages.getString("VersionInfo.trademarks")); - Validator.checkTrue(!internalName.endsWith(".exe"), "versionInfo.internalName", - Messages.getString("VersionInfo.internal.name.not.exe")); - Validator.checkString(originalFilename, 50, "versionInfo.originalFilename", - Messages.getString("VersionInfo.original.filename")); - Validator.checkTrue(originalFilename.endsWith(".exe"), - "versionInfo.originalFilename", - Messages.getString("VersionInfo.original.filename.exe")); - } - - public String getCompanyName() { - return companyName; - } - - public void setCompanyName(String companyName) { - this.companyName = companyName; - } - - public String getCopyright() { - return copyright; - } - - public void setCopyright(String copyright) { - this.copyright = copyright; - } - - public String getFileDescription() { - return fileDescription; - } - - public void setFileDescription(String fileDescription) { - this.fileDescription = fileDescription; - } - - public String getFileVersion() { - return fileVersion; - } - - public void setFileVersion(String fileVersion) { - this.fileVersion = fileVersion; - } - - public String getInternalName() { - return internalName; - } - - public void setInternalName(String internalName) { - this.internalName = internalName; - } - - public String getOriginalFilename() { - return originalFilename; - } - - public void setOriginalFilename(String originalFilename) { - this.originalFilename = originalFilename; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public String getProductVersion() { - return productVersion; - } - - public void setProductVersion(String productVersion) { - this.productVersion = productVersion; - } - - public String getTxtFileVersion() { - return txtFileVersion; - } - - public void setTxtFileVersion(String txtFileVersion) { - this.txtFileVersion = txtFileVersion; - } - - public String getTxtProductVersion() { - return txtProductVersion; - } - - public void setTxtProductVersion(String txtProductVersion) { - this.txtProductVersion = txtProductVersion; - } - - public String getTrademarks() { - return trademarks; - } - - public void setTrademarks(String trademarks) { - this.trademarks = trademarks; - } - - public LanguageID getLanguage() { - return (language == null) ? LanguageID.sortedValues()[DEFAULT_LANGUAGE_INDEX] : language; - } - - public void setLanguage(LanguageID language) { - this.language = language; - } - - public int getLanguageIndex() { - return (language == null) ? DEFAULT_LANGUAGE_INDEX : language.getIndex(); - } - - public void setLanguageIndex(int index) { - language = LanguageID.sortedValues()[index]; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 21, 2005 + */ +package net.sf.launch4j.config; + +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.binding.Validator; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class VersionInfo implements IValidatable { + public static final String VERSION_PATTERN = "(\\d+\\.){3}\\d+"; + public static final int DEFAULT_LANGUAGE_INDEX = LanguageID.ENGLISH_US.getIndex(); + + private String fileVersion; + private String txtFileVersion; + private String fileDescription; + private String copyright; + private String productVersion; + private String txtProductVersion; + private String productName; + private String companyName; + private String internalName; + private String originalFilename; + private String trademarks; + private LanguageID language; + + public void checkInvariants() { + Validator.checkString(fileVersion, 20, VERSION_PATTERN, + "versionInfo.fileVersion", + Messages.getString("VersionInfo.file.version")); + Validator.checkString(txtFileVersion, 50, "versionInfo.txtFileVersion", + Messages.getString("VersionInfo.txt.file.version")); + Validator.checkString(fileDescription, 150, "versionInfo.fileDescription", + Messages.getString("VersionInfo.file.description")); + Validator.checkString(copyright, 150, "versionInfo.copyright", + Messages.getString("VersionInfo.copyright")); + Validator.checkString(productVersion, 20, VERSION_PATTERN, + "versionInfo.productVersion", + Messages.getString("VersionInfo.product.version")); + Validator.checkString(txtProductVersion, 50, "versionInfo.txtProductVersion", + Messages.getString("VersionInfo.txt.product.version")); + Validator.checkString(productName, 150, "versionInfo.productName", + Messages.getString("VersionInfo.product.name")); + Validator.checkOptString(companyName, 150, "versionInfo.companyName", + Messages.getString("VersionInfo.company.name")); + Validator.checkString(internalName, 50, "versionInfo.internalName", + Messages.getString("VersionInfo.internal.name")); + Validator.checkOptString(trademarks, 150, "versionInfo.trademarks", + Messages.getString("VersionInfo.trademarks")); + Validator.checkTrue(!internalName.endsWith(".exe"), "versionInfo.internalName", + Messages.getString("VersionInfo.internal.name.not.exe")); + Validator.checkString(originalFilename, 50, "versionInfo.originalFilename", + Messages.getString("VersionInfo.original.filename")); + Validator.checkTrue(originalFilename.endsWith(".exe"), + "versionInfo.originalFilename", + Messages.getString("VersionInfo.original.filename.exe")); + } + + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + public String getCopyright() { + return copyright; + } + + public void setCopyright(String copyright) { + this.copyright = copyright; + } + + public String getFileDescription() { + return fileDescription; + } + + public void setFileDescription(String fileDescription) { + this.fileDescription = fileDescription; + } + + public String getFileVersion() { + return fileVersion; + } + + public void setFileVersion(String fileVersion) { + this.fileVersion = fileVersion; + } + + public String getInternalName() { + return internalName; + } + + public void setInternalName(String internalName) { + this.internalName = internalName; + } + + public String getOriginalFilename() { + return originalFilename; + } + + public void setOriginalFilename(String originalFilename) { + this.originalFilename = originalFilename; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getProductVersion() { + return productVersion; + } + + public void setProductVersion(String productVersion) { + this.productVersion = productVersion; + } + + public String getTxtFileVersion() { + return txtFileVersion; + } + + public void setTxtFileVersion(String txtFileVersion) { + this.txtFileVersion = txtFileVersion; + } + + public String getTxtProductVersion() { + return txtProductVersion; + } + + public void setTxtProductVersion(String txtProductVersion) { + this.txtProductVersion = txtProductVersion; + } + + public String getTrademarks() { + return trademarks; + } + + public void setTrademarks(String trademarks) { + this.trademarks = trademarks; + } + + public LanguageID getLanguage() { + return (language == null) ? LanguageID.sortedValues()[DEFAULT_LANGUAGE_INDEX] : language; + } + + public void setLanguage(LanguageID language) { + this.language = language; + } + + public int getLanguageIndex() { + return (language == null) ? DEFAULT_LANGUAGE_INDEX : language.getIndex(); + } + + public void setLanguageIndex(int index) { + language = LanguageID.sortedValues()[index]; + } +} diff --git a/launch4j/src/net/sf/launch4j/config/messages.properties b/launch4j/src/net/sf/launch4j/config/messages.properties index b2eecc4..912944f 100644 --- a/launch4j/src/net/sf/launch4j/config/messages.properties +++ b/launch4j/src/net/sf/launch4j/config/messages.properties @@ -1,151 +1,147 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2015 Grzegorz Kowal -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Splash.splash.file=Splash file -Splash.splash.timeout=Splash timeout - -Config.specify.output.exe=Specify output file with .exe extension. -Config.application.jar=Application jar -Config.application.jar.path=Specify runtime path of the jar relative to the executable. -Config.chdir.relative='chdir' must be a path relative to the executable. -Config.chdir.path='chdir' is now a path instead of a boolean, please check the docs. -Config.manifest=Manifest -Config.icon=Icon -Config.jar.arguments=Jar arguments -Config.error.title=Error title -Config.download.url=Download URL -Config.support.url=Support URL -Config.header.type=Header type -Config.splash.not.impl.by.console.hdr=Splash screen is not implemented by console header. -Config.variables=Environment variables -Config.variables.err=Environment variable assignment should have the form varname=[value][%varref%]... -Config.priority=Process priority - -ClassPath.mainClass=Main class -ClassPath.or.jar=Specify runtime path of a jar or the classpath. -ClassPath.path=Classpath - -VersionInfo.file.version=File version, should be 'x.x.x.x' -VersionInfo.txt.file.version=Free form file version -VersionInfo.file.description=File description -VersionInfo.copyright=Copyright -VersionInfo.product.version=Product version, should be 'x.x.x.x' -VersionInfo.txt.product.version=Free from product version -VersionInfo.product.name=Product name -VersionInfo.company.name=Company name -VersionInfo.trademarks=Trademarks -VersionInfo.internal.name=Internal name -VersionInfo.internal.name.not.exe=Internal name shouldn't have the .exe extension. -VersionInfo.original.filename=Original filename -VersionInfo.original.filename.exe=Original filename should end with the .exe extension. - -Jre.min.version=Minimum JRE version should be 1.x.x[_xxx] or the Java 9 new version scheme xxx[.xxx[.xxx]], e.g., 1.5, 1.8.0_121, 10.0.1 -Jre.max.version=Maximum JRE version should be 1.x.x[_xxx] or the Java 9 new version scheme xxx[.xxx[.xxx]], e.g., 1.5, 1.8.0_121, 10.0.1 -Jre.specify.jre.min.version.or.path=Specify minimum JRE version and/or bundled JRE path. -Jre.bundled.path=Bundled JRE path -Jre.bundled.64bit.invalid=The bundled JRE 64-bit option can only be used if the JRE path is specified. -Jre.bundled.fallback.invalid=The bundled JRE as fallback option can only be used if the JRE path is specified. -Jre.specify.min.version=Specify minimum JRE version. -Jre.max.greater.than.min=Maximum JRE version must be greater than the minimum.\nTo use a certain JRE version, you may set the min/max range to [1.4.2 - 1.4.2_10] for example. -Jre.initial.and.max.heap=If you change the initial heap size please also specify the maximum size. -Jre.initial.heap=Initial heap size must be greater than 0, leave the field blank to use the JVM default. -Jre.max.heap=Maximum heap size cannot be less than the initial size, leave the field blank to use the JVM default. -Jre.initial.heap.percent=Initial heap % -Jre.max.heap.percent=Maximum heap % -Jre.jdkPreference=JDK preference -Jre.runtimeBits=Runtime bits -Jre.jvm.options=JVM arguments -Jre.jvm.options.unclosed.quotation=JVM arguments contain an unclosed quotation. -Jre.jvm.options.variable=Invalid environment variable reference. - -Msg.startupErr=Startup error message -Msg.bundledJreErr=Bundled JRE error message -Msg.jreVersionErr=JRE version error message -Msg.launcherErr=Launcher error message - -SingleInstance.mutexName=Mutex name -SingleInstance.windowTitle=Window title - -Charset.ascii=7-bit ASCII -Charset.unicode=Unicode -Charset.multilingual=Multilingual -Charset.shift.jis=Japan (Shift JIS X-0208) -Charset.shift.ksc=Korea (Shift KSC 5601) -Charset.big5=Taiwan (Big5) -Charset.latin2=Latin-2 (Eastern European) -Charset.cyrillic=Cyrillic -Language.arabic=Arabic -Language.bulgarian=Bulgarian -Language.catalan=Catalan -Language.chinese.traditional=Chinese (Traditional) -Language.czech=Czech -Language.danish=Danish -Language.german=German -Language.english.us=English U.S. -Language.greek=Greek -Language.hebrew=Hebrew -Language.polish=Polish -Language.portuguese.brazil=Portuguese (Brazil) -Language.rhaeto.romanic=Rhaeto Romanic -Language.romanian=Romanian -Language.russian=Russian -Language.spanish.castilian=Spanish (Castilian) -Language.finnish=Finnish -Language.french=French -Language.hungarian=Hungarian -Language.icelandic=Icelandic -Language.italian=Italian -Language.japanese=Japanese -Language.korean=Korean -Language.dutch=Dutch -Language.norwegian.bokmal=Norwegian Bokm\u00E5l -Language.croato.serbian.latin=Croato-Serbian (Latin) -Language.slovak=Slovak -Language.albanian=Albanian -Language.swedish=Swedish -Language.thai=Thai -Language.turkish=Turkish -Language.urdu=Urdu -Language.bahasa=Bahasa -Language.chinese.simplified=Chinese (Simplified) -Language.swiss.german=Swiss German -Language.english.uk=English U.K. -Language.spanish.mexico=Spanish (Mexico) -Language.belgian.french=Belgian French -Language.canadian.french=Canadian French -Language.swiss.italian=Swiss Italian -Language.belgian.dutch=Belgian Dutch -Language.norwegian.nynorsk=Norwegian Nynorsk -Language.portuguese.portugal=Portuguese (Portugal) -Language.serbo.croatian.cyrillic=Serbo-Croatian (Cyrillic) -Language.swiss.french=Swiss French +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2015 Grzegorz Kowal +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +Splash.splash.file=Splash file +Splash.splash.timeout=Splash timeout + +Config.specify.output.exe=Specify output file with .exe extension. +Config.application.jar=Application jar +Config.application.jar.path=Specify runtime path of the jar relative to the executable. +Config.chdir.relative='chdir' must be a path relative to the executable. +Config.chdir.path='chdir' is now a path instead of a boolean, please check the docs. +Config.manifest=Manifest +Config.icon=Icon +Config.jar.arguments=Jar arguments +Config.error.title=Error title +Config.download.url=Download URL +Config.support.url=Support URL +Config.header.type=Header type +Config.splash.not.impl.by.console.hdr=Splash screen is not implemented by console header. +Config.variables=Environment variables +Config.variables.err=Environment variable assignment should have the form varname=[value][%varref%]... +Config.priority=Process priority + +ClassPath.mainClass=Main class +ClassPath.or.jar=Specify runtime path of a jar or the classpath. +ClassPath.path=Classpath + +VersionInfo.file.version=File version, should be 'x.x.x.x' +VersionInfo.txt.file.version=Free form file version +VersionInfo.file.description=File description +VersionInfo.copyright=Copyright +VersionInfo.product.version=Product version, should be 'x.x.x.x' +VersionInfo.txt.product.version=Free from product version +VersionInfo.product.name=Product name +VersionInfo.company.name=Company name +VersionInfo.trademarks=Trademarks +VersionInfo.internal.name=Internal name +VersionInfo.internal.name.not.exe=Internal name shouldn't have the .exe extension. +VersionInfo.original.filename=Original filename +VersionInfo.original.filename.exe=Original filename should end with the .exe extension. + +Jre.min.version=Minimum JRE version should be 1.x.x[_xxx] or the Java 9 new version scheme xxx[.xxx[.xxx]], e.g., 1.5, 1.8.0_121, 10.0.1 +Jre.max.version=Maximum JRE version should be 1.x.x[_xxx] or the Java 9 new version scheme xxx[.xxx[.xxx]], e.g., 1.5, 1.8.0_121, 10.0.1 +Jre.path=JRE path +Jre.specify.min.version=Specify minimum JRE version. +Jre.max.greater.than.min=Maximum JRE version must be greater than the minimum.\nTo use a certain JRE version, you may set the min/max range to [1.4.2 - 1.4.2_10] for example. +Jre.initial.and.max.heap=If you change the initial heap size please also specify the maximum size. +Jre.initial.heap=Initial heap size must be greater than 0, leave the field blank to use the JVM default. +Jre.max.heap=Maximum heap size cannot be less than the initial size, leave the field blank to use the JVM default. +Jre.initial.heap.percent=Initial heap % +Jre.max.heap.percent=Maximum heap % +Jre.requiresJdk=Requires JDK +Jre.jvm.options=JVM arguments +Jre.jvm.options.unclosed.quotation=JVM arguments contain an unclosed quotation. +Jre.jvm.options.variable=Invalid environment variable reference. + +Msg.startupErr=Startup error message +Msg.jreNotFoundErr=JRE not found error message +Msg.jreVersionErr=JRE version error message +Msg.launcherErr=Launcher error message + +SingleInstance.mutexName=Mutex name +SingleInstance.windowTitle=Window title + +Charset.ascii=7-bit ASCII +Charset.unicode=Unicode +Charset.multilingual=Multilingual +Charset.shift.jis=Japan (Shift JIS X-0208) +Charset.shift.ksc=Korea (Shift KSC 5601) +Charset.big5=Taiwan (Big5) +Charset.latin2=Latin-2 (Eastern European) +Charset.cyrillic=Cyrillic +Language.arabic=Arabic +Language.bulgarian=Bulgarian +Language.catalan=Catalan +Language.chinese.traditional=Chinese (Traditional) +Language.czech=Czech +Language.danish=Danish +Language.german=German +Language.english.us=English U.S. +Language.greek=Greek +Language.hebrew=Hebrew +Language.polish=Polish +Language.portuguese.brazil=Portuguese (Brazil) +Language.rhaeto.romanic=Rhaeto Romanic +Language.romanian=Romanian +Language.russian=Russian +Language.spanish.castilian=Spanish (Castilian) +Language.finnish=Finnish +Language.french=French +Language.hungarian=Hungarian +Language.icelandic=Icelandic +Language.italian=Italian +Language.japanese=Japanese +Language.korean=Korean +Language.dutch=Dutch +Language.norwegian.bokmal=Norwegian Bokm\u00E5l +Language.croato.serbian.latin=Croato-Serbian (Latin) +Language.slovak=Slovak +Language.albanian=Albanian +Language.swedish=Swedish +Language.thai=Thai +Language.turkish=Turkish +Language.urdu=Urdu +Language.bahasa=Bahasa +Language.chinese.simplified=Chinese (Simplified) +Language.swiss.german=Swiss German +Language.english.uk=English U.K. +Language.spanish.mexico=Spanish (Mexico) +Language.belgian.french=Belgian French +Language.canadian.french=Canadian French +Language.swiss.italian=Swiss Italian +Language.belgian.dutch=Belgian Dutch +Language.norwegian.nynorsk=Norwegian Nynorsk +Language.portuguese.portugal=Portuguese (Portugal) +Language.serbo.croatian.cyrillic=Serbo-Croatian (Cyrillic) +Language.swiss.french=Swiss French diff --git a/launch4j/src/net/sf/launch4j/config/messages_es.properties b/launch4j/src/net/sf/launch4j/config/messages_es.properties deleted file mode 100644 index 5b897d0..0000000 --- a/launch4j/src/net/sf/launch4j/config/messages_es.properties +++ /dev/null @@ -1,75 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Splash.splash.file = Fichero de la pantalla de bienvenida -Splash.splash.timeout = Tiempo de espera de la pantalla de bienvenida - -Config.specify.output.exe = Especifique el fichero de salida con extensi\u00F3n .exe. -Config.application.jar = Aplicaci\u00F3n jar -Config.application.jar.path = Especifique la ruta del jar relativa al ejecutable. -Config.chdir.relative = 'Cambiar al directorio' debe ser una ruta relativa al ejecutable. -Config.chdir.path = 'Cambiar al directorio' ahora es una ruta en lugar de un booleano, por favor consulte la documentaci\u00F3n. -Config.icon = Icono -Config.jar.arguments = Argumentos del jar -Config.error.title = T\u00EDtulo de error -Config.header.type = Tipo de cabecera -Config.splash.not.impl.by.console.hdr = La pantalla de bienvenida no est\u00E1 implementada para la cabecera de tipo consola. - -VersionInfo.file.version = La versi\u00F3n del fichero, deber\u00EDa ser 'x.x.x.x' -VersionInfo.txt.file.version = Forma libre de versi\u00F3n del fichero -VersionInfo.file.description = Descripci\u00F3n del fichero -VersionInfo.copyright = Copyright -VersionInfo.product.version = Versi\u00F3n del producto, deber\u00EDa ser 'x.x.x.x' -VersionInfo.txt.product.version = Forma libre de versi\u00F3n del producto -VersionInfo.product.name = Nombre del producto -VersionInfo.company.name = Nombre de la organizaci\u00F3n -VersionInfo.internal.name = Nombre interno -VersionInfo.internal.name.not.exe = El nombre interno no deber\u00EDa tener extensi\u00F3n .exe. -VersionInfo.original.filename = Nombre original del fichero -VersionInfo.original.filename.exe = El nombre original del fichero debe acabar con extensi\u00F3n .exe. -Jre.min.version = La versi\u00F3n m\u00EDnima del JRE deber\u00EDa ser x.x.x[_xx] -Jre.max.version = La versi\u00F3n m\u00E1xima del JRE deber\u00EDa ser x.x.x[_xx] -Jre.specify.jre.min.version.or.path=Specify minimum JRE version and/or bundled JRE path. -Jre.bundled.path.rel = La ruta del JRE debe ser relativa al ejecutable. -Jre.specify.min.version = Especifique la versi\u00F3n m\u00EDnima del JRE. -Jre.max.greater.than.min = La versi\u00F3n m\u00E1xima del JRE debe ser mayor que la m\u00EDnima.\nPara usar cierta versi\u00F3n del JRE, puede esyablecer el rango m\u00EDnimo/m\u00E1ximo a [1.4.2 - 1.4.2_10], por ejemplo. -Jre.jvm.options = Argumentos de la JVM - -Msg.startupErr=Startup error message -Msg.bundledJreErr=Bundled JRE error message -Msg.jreVersionErr=JRE version error message -Msg.launcherErr=Launcher error message - -SingleInstance.mutexName=Mutex name -SingleInstance.windowTitle=Window title - diff --git a/launch4j/src/net/sf/launch4j/form/BasicForm.java b/launch4j/src/net/sf/launch4j/form/BasicForm.java index 72f477e..ddaae32 100644 --- a/launch4j/src/net/sf/launch4j/form/BasicForm.java +++ b/launch4j/src/net/sf/launch4j/form/BasicForm.java @@ -1,283 +1,284 @@ -package net.sf.launch4j.form; - -import com.jeta.forms.components.separator.TitledSeparator; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JTextField; - -public abstract class BasicForm extends JPanel -{ - protected final JButton _outfileButton = new JButton(); - protected final JLabel _outfileLabel = new JLabel(); - protected final JLabel _iconLabel = new JLabel(); - protected final JLabel _jarLabel = new JLabel(); - protected final JButton _jarButton = new JButton(); - protected final JButton _iconButton = new JButton(); - protected final JLabel _cmdLineLabel = new JLabel(); - protected final JLabel _optionsLabel = new JLabel(); - protected final JLabel _chdirLabel = new JLabel(); - protected final JLabel _processPriorityLabel = new JLabel(); - protected final JRadioButton _normalPriorityRadio = new JRadioButton(); - protected final ButtonGroup _buttongroup1 = new ButtonGroup(); - protected final JRadioButton _idlePriorityRadio = new JRadioButton(); - protected final JRadioButton _highPriorityRadio = new JRadioButton(); - protected final JTextField _cmdLineField = new JTextField(); - protected final JTextField _chdirField = new JTextField(); - protected final JTextField _iconField = new JTextField(); - protected final JCheckBox _dontWrapJarCheck = new JCheckBox(); - protected final JTextField _jarField = new JTextField(); - protected final JTextField _outfileField = new JTextField(); - protected final JLabel _errorTitleLabel = new JLabel(); - protected final JTextField _errorTitleField = new JTextField(); - protected final JLabel _downloadUrlLabel = new JLabel(); - protected final JTextField _downloadUrlField = new JTextField(); - protected final JLabel _supportUrlLabel = new JLabel(); - protected final JTextField _supportUrlField = new JTextField(); - protected final JTextField _manifestField = new JTextField(); - protected final JButton _manifestButton = new JButton(); - protected final JCheckBox _stayAliveCheck = new JCheckBox(); - protected final JCheckBox _restartOnCrashCheck = new JCheckBox(); - - /** - * Default constructor - */ - public BasicForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _outfileButton.setIcon(loadImage("images/open16.png")); - _outfileButton.setName("outfileButton"); - jpanel1.add(_outfileButton,cc.xy(12,2)); - - _outfileLabel.setIcon(loadImage("images/asterix.gif")); - _outfileLabel.setName("outfileLabel"); - _outfileLabel.setText(Messages.getString("outfile")); - jpanel1.add(_outfileLabel,cc.xy(2,2)); - - _iconLabel.setName("iconLabel"); - _iconLabel.setText(Messages.getString("icon")); - jpanel1.add(_iconLabel,cc.xy(2,10)); - - _jarLabel.setIcon(loadImage("images/asterix.gif")); - _jarLabel.setName("jarLabel"); - _jarLabel.setText(Messages.getString("jar")); - jpanel1.add(_jarLabel,cc.xy(2,4)); - - _jarButton.setIcon(loadImage("images/open16.png")); - _jarButton.setName("jarButton"); - jpanel1.add(_jarButton,cc.xy(12,4)); - - _iconButton.setIcon(loadImage("images/open16.png")); - _iconButton.setName("iconButton"); - jpanel1.add(_iconButton,cc.xy(12,10)); - - _cmdLineLabel.setName("cmdLineLabel"); - _cmdLineLabel.setText(Messages.getString("cmdLine")); - _cmdLineLabel.setToolTipText(""); - jpanel1.add(_cmdLineLabel,cc.xy(2,14)); - - _optionsLabel.setName("optionsLabel"); - _optionsLabel.setText(Messages.getString("options")); - jpanel1.add(_optionsLabel,cc.xy(2,18)); - - _chdirLabel.setName("chdirLabel"); - _chdirLabel.setText(Messages.getString("chdir")); - jpanel1.add(_chdirLabel,cc.xy(2,12)); - - _processPriorityLabel.setName("processPriorityLabel"); - _processPriorityLabel.setText(Messages.getString("priority")); - jpanel1.add(_processPriorityLabel,cc.xy(2,16)); - - _normalPriorityRadio.setActionCommand(Messages.getString("normalPriority")); - _normalPriorityRadio.setName("normalPriorityRadio"); - _normalPriorityRadio.setText(Messages.getString("normalPriority")); - _buttongroup1.add(_normalPriorityRadio); - jpanel1.add(_normalPriorityRadio,cc.xy(4,16)); - - _idlePriorityRadio.setActionCommand(Messages.getString("idlePriority")); - _idlePriorityRadio.setName("idlePriorityRadio"); - _idlePriorityRadio.setText(Messages.getString("idlePriority")); - _buttongroup1.add(_idlePriorityRadio); - jpanel1.add(_idlePriorityRadio,cc.xy(6,16)); - - _highPriorityRadio.setActionCommand(Messages.getString("highPriority")); - _highPriorityRadio.setName("highPriorityRadio"); - _highPriorityRadio.setText(Messages.getString("highPriority")); - _buttongroup1.add(_highPriorityRadio); - jpanel1.add(_highPriorityRadio,cc.xy(8,16)); - - _cmdLineField.setName("cmdLineField"); - _cmdLineField.setToolTipText(Messages.getString("cmdLineTip")); - jpanel1.add(_cmdLineField,cc.xywh(4,14,7,1)); - - _chdirField.setName("chdirField"); - _chdirField.setToolTipText(Messages.getString("chdirTip")); - jpanel1.add(_chdirField,cc.xywh(4,12,7,1)); - - _iconField.setName("iconField"); - _iconField.setToolTipText(Messages.getString("iconTip")); - jpanel1.add(_iconField,cc.xywh(4,10,7,1)); - - _dontWrapJarCheck.setActionCommand("Don't wrap the jar, launch it only"); - _dontWrapJarCheck.setName("dontWrapJarCheck"); - _dontWrapJarCheck.setText(Messages.getString("dontWrapJar")); - jpanel1.add(_dontWrapJarCheck,cc.xywh(4,6,7,1)); - - _jarField.setName("jarField"); - _jarField.setToolTipText(Messages.getString("jarTip")); - jpanel1.add(_jarField,cc.xywh(4,4,7,1)); - - _outfileField.setName("outfileField"); - _outfileField.setToolTipText(Messages.getString("outfileTip")); - jpanel1.add(_outfileField,cc.xywh(4,2,7,1)); - - TitledSeparator titledseparator1 = new TitledSeparator(); - titledseparator1.setText(Messages.getString("downloadAndSupport")); - jpanel1.add(titledseparator1,cc.xywh(2,22,11,1)); - - _errorTitleLabel.setName("errorTitleLabel"); - _errorTitleLabel.setText(Messages.getString("errorTitle")); - jpanel1.add(_errorTitleLabel,cc.xy(2,24)); - - _errorTitleField.setName("errorTitleField"); - _errorTitleField.setToolTipText(Messages.getString("errorTitleTip")); - jpanel1.add(_errorTitleField,cc.xywh(4,24,7,1)); - - _downloadUrlLabel.setName("downloadUrlLabel"); - _downloadUrlLabel.setText(Messages.getString("downloadUrl")); - jpanel1.add(_downloadUrlLabel,cc.xy(2,26)); - - _downloadUrlField.setName("downloadUrlField"); - jpanel1.add(_downloadUrlField,cc.xywh(4,26,7,1)); - - _supportUrlLabel.setName("supportUrlLabel"); - _supportUrlLabel.setText(Messages.getString("supportUrl")); - jpanel1.add(_supportUrlLabel,cc.xy(2,28)); - - _supportUrlField.setName("supportUrlField"); - jpanel1.add(_supportUrlField,cc.xywh(4,28,7,1)); - - JLabel jlabel1 = new JLabel(); - jlabel1.setText(Messages.getString("manifest")); - jpanel1.add(jlabel1,cc.xy(2,8)); - - _manifestField.setName("manifestField"); - _manifestField.setToolTipText(Messages.getString("manifestTip")); - jpanel1.add(_manifestField,cc.xywh(4,8,7,1)); - - _manifestButton.setIcon(loadImage("images/open16.png")); - _manifestButton.setName("manifestButton"); - jpanel1.add(_manifestButton,cc.xy(12,8)); - - _stayAliveCheck.setActionCommand("Stay alive after launching a GUI application"); - _stayAliveCheck.setName("stayAliveCheck"); - _stayAliveCheck.setText(Messages.getString("stayAlive")); - jpanel1.add(_stayAliveCheck,cc.xywh(4,18,7,1)); - - _restartOnCrashCheck.setActionCommand("Restart the application after a crash"); - _restartOnCrashCheck.setName("restartOnCrashCheck"); - _restartOnCrashCheck.setText(Messages.getString("restartOnCrash")); - _restartOnCrashCheck.setToolTipText(Messages.getString("restartOnCrashToolTip")); - jpanel1.add(_restartOnCrashCheck,cc.xywh(4,20,7,1)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jeta.forms.components.separator.TitledSeparator; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextField; +import javax.swing.UIManager; + +public abstract class BasicForm extends JPanel +{ + protected final JButton _outfileButton = new JButton(); + protected final JLabel _outfileLabel = new JLabel(); + protected final JLabel _iconLabel = new JLabel(); + protected final JLabel _jarLabel = new JLabel(); + protected final JButton _jarButton = new JButton(); + protected final JButton _iconButton = new JButton(); + protected final JLabel _cmdLineLabel = new JLabel(); + protected final JLabel _optionsLabel = new JLabel(); + protected final JLabel _chdirLabel = new JLabel(); + protected final JLabel _processPriorityLabel = new JLabel(); + protected final JRadioButton _normalPriorityRadio = new JRadioButton(); + protected final ButtonGroup _buttongroup1 = new ButtonGroup(); + protected final JRadioButton _idlePriorityRadio = new JRadioButton(); + protected final JRadioButton _highPriorityRadio = new JRadioButton(); + protected final JTextField _cmdLineField = new JTextField(); + protected final JTextField _chdirField = new JTextField(); + protected final JTextField _iconField = new JTextField(); + protected final JCheckBox _dontWrapJarCheck = new JCheckBox(); + protected final JTextField _jarField = new JTextField(); + protected final JTextField _outfileField = new JTextField(); + protected final JLabel _errorTitleLabel = new JLabel(); + protected final JTextField _errorTitleField = new JTextField(); + protected final JLabel _downloadUrlLabel = new JLabel(); + protected final JTextField _downloadUrlField = new JTextField(); + protected final JLabel _supportUrlLabel = new JLabel(); + protected final JTextField _supportUrlField = new JTextField(); + protected final JTextField _manifestField = new JTextField(); + protected final JButton _manifestButton = new JButton(); + protected final JCheckBox _stayAliveCheck = new JCheckBox(); + protected final JCheckBox _restartOnCrashCheck = new JCheckBox(); + + /** + * Default constructor + */ + public BasicForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _outfileButton.setIcon(UIManager.getIcon("Tree.closedIcon")); + _outfileButton.setName("outfileButton"); + jpanel1.add(_outfileButton,cc.xy(12,2)); + + _outfileLabel.setIcon(loadImage("images/asterix.gif")); + _outfileLabel.setName("outfileLabel"); + _outfileLabel.setText(Messages.getString("outfile")); + jpanel1.add(_outfileLabel,cc.xy(2,2)); + + _iconLabel.setName("iconLabel"); + _iconLabel.setText(Messages.getString("icon")); + jpanel1.add(_iconLabel,cc.xy(2,10)); + + _jarLabel.setIcon(loadImage("images/asterix.gif")); + _jarLabel.setName("jarLabel"); + _jarLabel.setText(Messages.getString("jar")); + jpanel1.add(_jarLabel,cc.xy(2,4)); + + _jarButton.setIcon(UIManager.getIcon("Tree.closedIcon")); + _jarButton.setName("jarButton"); + jpanel1.add(_jarButton,cc.xy(12,4)); + + _iconButton.setIcon(UIManager.getIcon("Tree.closedIcon")); + _iconButton.setName("iconButton"); + jpanel1.add(_iconButton,cc.xy(12,10)); + + _cmdLineLabel.setName("cmdLineLabel"); + _cmdLineLabel.setText(Messages.getString("cmdLine")); + _cmdLineLabel.setToolTipText(""); + jpanel1.add(_cmdLineLabel,cc.xy(2,14)); + + _optionsLabel.setName("optionsLabel"); + _optionsLabel.setText(Messages.getString("options")); + jpanel1.add(_optionsLabel,cc.xy(2,18)); + + _chdirLabel.setName("chdirLabel"); + _chdirLabel.setText(Messages.getString("chdir")); + jpanel1.add(_chdirLabel,cc.xy(2,12)); + + _processPriorityLabel.setName("processPriorityLabel"); + _processPriorityLabel.setText(Messages.getString("priority")); + jpanel1.add(_processPriorityLabel,cc.xy(2,16)); + + _normalPriorityRadio.setActionCommand(Messages.getString("normalPriority")); + _normalPriorityRadio.setName("normalPriorityRadio"); + _normalPriorityRadio.setText(Messages.getString("normalPriority")); + _buttongroup1.add(_normalPriorityRadio); + jpanel1.add(_normalPriorityRadio,cc.xy(4,16)); + + _idlePriorityRadio.setActionCommand(Messages.getString("idlePriority")); + _idlePriorityRadio.setName("idlePriorityRadio"); + _idlePriorityRadio.setText(Messages.getString("idlePriority")); + _buttongroup1.add(_idlePriorityRadio); + jpanel1.add(_idlePriorityRadio,cc.xy(6,16)); + + _highPriorityRadio.setActionCommand(Messages.getString("highPriority")); + _highPriorityRadio.setName("highPriorityRadio"); + _highPriorityRadio.setText(Messages.getString("highPriority")); + _buttongroup1.add(_highPriorityRadio); + jpanel1.add(_highPriorityRadio,cc.xy(8,16)); + + _cmdLineField.setName("cmdLineField"); + _cmdLineField.setToolTipText(Messages.getString("cmdLineTip")); + jpanel1.add(_cmdLineField,cc.xywh(4,14,7,1)); + + _chdirField.setName("chdirField"); + _chdirField.setToolTipText(Messages.getString("chdirTip")); + jpanel1.add(_chdirField,cc.xywh(4,12,7,1)); + + _iconField.setName("iconField"); + _iconField.setToolTipText(Messages.getString("iconTip")); + jpanel1.add(_iconField,cc.xywh(4,10,7,1)); + + _dontWrapJarCheck.setActionCommand("Don't wrap the jar, launch it only"); + _dontWrapJarCheck.setName("dontWrapJarCheck"); + _dontWrapJarCheck.setText(Messages.getString("dontWrapJar")); + jpanel1.add(_dontWrapJarCheck,cc.xywh(4,6,7,1)); + + _jarField.setName("jarField"); + _jarField.setToolTipText(Messages.getString("jarTip")); + jpanel1.add(_jarField,cc.xywh(4,4,7,1)); + + _outfileField.setName("outfileField"); + _outfileField.setToolTipText(Messages.getString("outfileTip")); + jpanel1.add(_outfileField,cc.xywh(4,2,7,1)); + + TitledSeparator titledseparator1 = new TitledSeparator(); + titledseparator1.setText(Messages.getString("downloadAndSupport")); + jpanel1.add(titledseparator1,cc.xywh(2,22,11,1)); + + _errorTitleLabel.setName("errorTitleLabel"); + _errorTitleLabel.setText(Messages.getString("errorTitle")); + jpanel1.add(_errorTitleLabel,cc.xy(2,24)); + + _errorTitleField.setName("errorTitleField"); + _errorTitleField.setToolTipText(Messages.getString("errorTitleTip")); + jpanel1.add(_errorTitleField,cc.xywh(4,24,7,1)); + + _downloadUrlLabel.setName("downloadUrlLabel"); + _downloadUrlLabel.setText(Messages.getString("downloadUrl")); + jpanel1.add(_downloadUrlLabel,cc.xy(2,26)); + + _downloadUrlField.setName("downloadUrlField"); + jpanel1.add(_downloadUrlField,cc.xywh(4,26,7,1)); + + _supportUrlLabel.setName("supportUrlLabel"); + _supportUrlLabel.setText(Messages.getString("supportUrl")); + jpanel1.add(_supportUrlLabel,cc.xy(2,28)); + + _supportUrlField.setName("supportUrlField"); + jpanel1.add(_supportUrlField,cc.xywh(4,28,7,1)); + + JLabel jlabel1 = new JLabel(); + jlabel1.setText(Messages.getString("manifest")); + jpanel1.add(jlabel1,cc.xy(2,8)); + + _manifestField.setName("manifestField"); + _manifestField.setToolTipText(Messages.getString("manifestTip")); + jpanel1.add(_manifestField,cc.xywh(4,8,7,1)); + + _manifestButton.setIcon(UIManager.getIcon("Tree.closedIcon")); + _manifestButton.setName("manifestButton"); + jpanel1.add(_manifestButton,cc.xy(12,8)); + + _stayAliveCheck.setActionCommand("Stay alive after launching a GUI application"); + _stayAliveCheck.setName("stayAliveCheck"); + _stayAliveCheck.setText(Messages.getString("stayAlive")); + jpanel1.add(_stayAliveCheck,cc.xywh(4,18,7,1)); + + _restartOnCrashCheck.setActionCommand("Restart the application after a crash"); + _restartOnCrashCheck.setName("restartOnCrashCheck"); + _restartOnCrashCheck.setText(Messages.getString("restartOnCrash")); + _restartOnCrashCheck.setToolTipText(Messages.getString("restartOnCrashToolTip")); + jpanel1.add(_restartOnCrashCheck,cc.xywh(4,20,7,1)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/ClassPathForm.java b/launch4j/src/net/sf/launch4j/form/ClassPathForm.java index f19d08e..4cbf8e6 100644 --- a/launch4j/src/net/sf/launch4j/form/ClassPathForm.java +++ b/launch4j/src/net/sf/launch4j/form/ClassPathForm.java @@ -1,193 +1,194 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; - -public abstract class ClassPathForm extends JPanel -{ - protected final JTextField _classpathField = new JTextField(); - protected final JLabel _classpathFieldLabel = new JLabel(); - protected final JLabel _classpathListLabel = new JLabel(); - protected final JList _classpathList = new JList(); - protected final JLabel _mainclassLabel = new JLabel(); - protected final JTextField _mainclassField = new JTextField(); - protected final JButton _acceptClasspathButton = new JButton(); - protected final JButton _removeClasspathButton = new JButton(); - protected final JButton _importClasspathButton = new JButton(); - protected final JButton _classpathUpButton = new JButton(); - protected final JButton _classpathDownButton = new JButton(); - protected final JCheckBox _classpathCheck = new JCheckBox(); - protected final JButton _newClasspathButton = new JButton(); - - /** - * Default constructor - */ - public ClassPathForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _classpathField.setName("classpathField"); - jpanel1.add(_classpathField,cc.xywh(4,11,7,1)); - - _classpathFieldLabel.setIcon(loadImage("images/asterix.gif")); - _classpathFieldLabel.setName("classpathFieldLabel"); - _classpathFieldLabel.setText(Messages.getString("editClassPath")); - jpanel1.add(_classpathFieldLabel,cc.xy(2,11)); - - _classpathListLabel.setName("classpathListLabel"); - _classpathListLabel.setText(Messages.getString("classPath")); - jpanel1.add(_classpathListLabel,cc.xy(2,6)); - - _classpathList.setName("classpathList"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_classpathList); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xywh(4,6,7,4)); - - _mainclassLabel.setIcon(loadImage("images/asterix.gif")); - _mainclassLabel.setName("mainclassLabel"); - _mainclassLabel.setText(Messages.getString("mainClass")); - jpanel1.add(_mainclassLabel,cc.xy(2,4)); - - _mainclassField.setName("mainclassField"); - jpanel1.add(_mainclassField,cc.xywh(4,4,7,1)); - - _acceptClasspathButton.setActionCommand("Add"); - _acceptClasspathButton.setIcon(loadImage("images/ok16.png")); - _acceptClasspathButton.setName("acceptClasspathButton"); - _acceptClasspathButton.setText(Messages.getString("accept")); - jpanel1.add(_acceptClasspathButton,cc.xy(8,13)); - - _removeClasspathButton.setActionCommand("Remove"); - _removeClasspathButton.setIcon(loadImage("images/cancel16.png")); - _removeClasspathButton.setName("removeClasspathButton"); - _removeClasspathButton.setText(Messages.getString("remove")); - jpanel1.add(_removeClasspathButton,cc.xy(10,13)); - - _importClasspathButton.setIcon(loadImage("images/open16.png")); - _importClasspathButton.setName("importClasspathButton"); - _importClasspathButton.setToolTipText(Messages.getString("importClassPath")); - jpanel1.add(_importClasspathButton,cc.xy(12,4)); - - _classpathUpButton.setIcon(loadImage("images/up16.png")); - _classpathUpButton.setName("classpathUpButton"); - jpanel1.add(_classpathUpButton,cc.xy(12,6)); - - _classpathDownButton.setIcon(loadImage("images/down16.png")); - _classpathDownButton.setName("classpathDownButton"); - jpanel1.add(_classpathDownButton,cc.xy(12,8)); - - _classpathCheck.setActionCommand("Custom classpath"); - _classpathCheck.setName("classpathCheck"); - _classpathCheck.setText(Messages.getString("customClassPath")); - jpanel1.add(_classpathCheck,cc.xy(4,2)); - - _newClasspathButton.setActionCommand("New"); - _newClasspathButton.setIcon(loadImage("images/new16.png")); - _newClasspathButton.setName("newClasspathButton"); - _newClasspathButton.setText(Messages.getString("new")); - jpanel1.add(_newClasspathButton,cc.xy(6,13)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.UIManager; + +public abstract class ClassPathForm extends JPanel +{ + protected final JTextField _classpathField = new JTextField(); + protected final JLabel _classpathFieldLabel = new JLabel(); + protected final JLabel _classpathListLabel = new JLabel(); + protected final JList _classpathList = new JList(); + protected final JLabel _mainclassLabel = new JLabel(); + protected final JTextField _mainclassField = new JTextField(); + protected final JButton _acceptClasspathButton = new JButton(); + protected final JButton _removeClasspathButton = new JButton(); + protected final JButton _importClasspathButton = new JButton(); + protected final JButton _classpathUpButton = new JButton(); + protected final JButton _classpathDownButton = new JButton(); + protected final JCheckBox _classpathCheck = new JCheckBox(); + protected final JButton _newClasspathButton = new JButton(); + + /** + * Default constructor + */ + public ClassPathForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _classpathField.setName("classpathField"); + jpanel1.add(_classpathField,cc.xywh(4,11,7,1)); + + _classpathFieldLabel.setIcon(loadImage("images/asterix.gif")); + _classpathFieldLabel.setName("classpathFieldLabel"); + _classpathFieldLabel.setText(Messages.getString("editClassPath")); + jpanel1.add(_classpathFieldLabel,cc.xy(2,11)); + + _classpathListLabel.setName("classpathListLabel"); + _classpathListLabel.setText(Messages.getString("classPath")); + jpanel1.add(_classpathListLabel,cc.xy(2,6)); + + _classpathList.setName("classpathList"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_classpathList); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xywh(4,6,7,4)); + + _mainclassLabel.setIcon(loadImage("images/asterix.gif")); + _mainclassLabel.setName("mainclassLabel"); + _mainclassLabel.setText(Messages.getString("mainClass")); + jpanel1.add(_mainclassLabel,cc.xy(2,4)); + + _mainclassField.setName("mainclassField"); + jpanel1.add(_mainclassField,cc.xywh(4,4,7,1)); + + _acceptClasspathButton.setActionCommand("Add"); + _acceptClasspathButton.setIcon(loadImage("images/ok16.png")); + _acceptClasspathButton.setName("acceptClasspathButton"); + _acceptClasspathButton.setText(Messages.getString("accept")); + jpanel1.add(_acceptClasspathButton,cc.xy(8,13)); + + _removeClasspathButton.setActionCommand("Remove"); + _removeClasspathButton.setIcon(loadImage("images/cancel16.png")); + _removeClasspathButton.setName("removeClasspathButton"); + _removeClasspathButton.setText(Messages.getString("remove")); + jpanel1.add(_removeClasspathButton,cc.xy(10,13)); + + _importClasspathButton.setIcon(UIManager.getIcon("Tree.closedIcon")); + _importClasspathButton.setName("importClasspathButton"); + _importClasspathButton.setToolTipText(Messages.getString("importClassPath")); + jpanel1.add(_importClasspathButton,cc.xy(12,4)); + + _classpathUpButton.setIcon(loadImage("images/up16.png")); + _classpathUpButton.setName("classpathUpButton"); + jpanel1.add(_classpathUpButton,cc.xy(12,6)); + + _classpathDownButton.setIcon(loadImage("images/down16.png")); + _classpathDownButton.setName("classpathDownButton"); + jpanel1.add(_classpathDownButton,cc.xy(12,8)); + + _classpathCheck.setActionCommand("Custom classpath"); + _classpathCheck.setName("classpathCheck"); + _classpathCheck.setText(Messages.getString("customClassPath")); + jpanel1.add(_classpathCheck,cc.xy(4,2)); + + _newClasspathButton.setActionCommand("New"); + _newClasspathButton.setIcon(loadImage("images/new16.png")); + _newClasspathButton.setName("newClasspathButton"); + _newClasspathButton.setText(Messages.getString("new")); + jpanel1.add(_newClasspathButton,cc.xy(6,13)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/ConfigForm.java b/launch4j/src/net/sf/launch4j/form/ConfigForm.java index dcb6c85..b3c6fff 100644 --- a/launch4j/src/net/sf/launch4j/form/ConfigForm.java +++ b/launch4j/src/net/sf/launch4j/form/ConfigForm.java @@ -1,132 +1,132 @@ -package net.sf.launch4j.form; - -import com.jeta.forms.components.separator.TitledSeparator; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; - -public abstract class ConfigForm extends JPanel -{ - protected final JTextArea _logTextArea = new JTextArea(); - protected final TitledSeparator _logSeparator = new TitledSeparator(); - protected final JTabbedPane _tab = new JTabbedPane(); - - /** - * Default constructor - */ - public ConfigForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:3DLU:NONE,FILL:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _logTextArea.setName("logTextArea"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_logTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xy(2,6)); - - _logSeparator.setName("logSeparator"); - _logSeparator.setText(Messages.getString("log")); - jpanel1.add(_logSeparator,cc.xy(2,4)); - - _tab.setName("tab"); - jpanel1.add(_tab,cc.xywh(1,2,3,1)); - - addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,3,4,5,6,7 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jeta.forms.components.separator.TitledSeparator; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTextArea; + +public abstract class ConfigForm extends JPanel +{ + protected final JTextArea _logTextArea = new JTextArea(); + protected final TitledSeparator _logSeparator = new TitledSeparator(); + protected final JTabbedPane _tab = new JTabbedPane(); + + /** + * Default constructor + */ + public ConfigForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:3DLU:NONE,FILL:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _logTextArea.setName("logTextArea"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_logTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xy(2,6)); + + _logSeparator.setName("logSeparator"); + _logSeparator.setText(Messages.getString("log")); + jpanel1.add(_logSeparator,cc.xy(2,4)); + + _tab.setName("tab"); + jpanel1.add(_tab,cc.xywh(1,2,3,1)); + + addFillComponents(jpanel1,new int[]{ 1,2,3 },new int[]{ 1,3,4,5,6,7 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java b/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java index 17e99fb..f2b79e6 100644 --- a/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java +++ b/launch4j/src/net/sf/launch4j/form/EnvironmentVarsForm.java @@ -1,127 +1,127 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; - -public abstract class EnvironmentVarsForm extends JPanel -{ - protected final JTextArea _envVarsTextArea = new JTextArea(); - protected final JLabel _envVarsLabel = new JLabel(); - - /** - * Default constructor - */ - public EnvironmentVarsForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _envVarsTextArea.setName("envVarsTextArea"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_envVarsTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xy(4,2)); - - _envVarsLabel.setName("envVarsLabel"); - _envVarsLabel.setText(Messages.getString("setVariables")); - jpanel1.add(_envVarsLabel,new CellConstraints(2,2,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +public abstract class EnvironmentVarsForm extends JPanel +{ + protected final JTextArea _envVarsTextArea = new JTextArea(); + protected final JLabel _envVarsLabel = new JLabel(); + + /** + * Default constructor + */ + public EnvironmentVarsForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _envVarsTextArea.setName("envVarsTextArea"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_envVarsTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xy(4,2)); + + _envVarsLabel.setName("envVarsLabel"); + _envVarsLabel.setText(Messages.getString("setVariables")); + jpanel1.add(_envVarsLabel,new CellConstraints(2,2,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/HeaderForm.java b/launch4j/src/net/sf/launch4j/form/HeaderForm.java index 9465b24..599ac6b 100644 --- a/launch4j/src/net/sf/launch4j/form/HeaderForm.java +++ b/launch4j/src/net/sf/launch4j/form/HeaderForm.java @@ -1,192 +1,192 @@ -package net.sf.launch4j.form; - -import com.jeta.forms.components.separator.TitledSeparator; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; - -public abstract class HeaderForm extends JPanel -{ - protected final JLabel _headerTypeLabel = new JLabel(); - protected final JRadioButton _guiHeaderRadio = new JRadioButton(); - protected final ButtonGroup _headerButtonGroup = new ButtonGroup(); - protected final JRadioButton _consoleHeaderRadio = new JRadioButton(); - protected final JTextArea _headerObjectsTextArea = new JTextArea(); - protected final JTextArea _libsTextArea = new JTextArea(); - protected final JCheckBox _headerObjectsCheck = new JCheckBox(); - protected final JCheckBox _libsCheck = new JCheckBox(); - protected final TitledSeparator _linkerOptionsSeparator = new TitledSeparator(); - protected final JRadioButton _jniGuiHeaderRadio = new JRadioButton(); - protected final JRadioButton _jniConsoleHeaderRadio = new JRadioButton(); - - /** - * Default constructor - */ - public HeaderForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(0.2),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _headerTypeLabel.setName("headerTypeLabel"); - _headerTypeLabel.setText(Messages.getString("headerType")); - jpanel1.add(_headerTypeLabel,cc.xy(2,2)); - - _guiHeaderRadio.setActionCommand("GUI"); - _guiHeaderRadio.setName("guiHeaderRadio"); - _guiHeaderRadio.setText(Messages.getString("gui")); - _guiHeaderRadio.setToolTipText(Messages.getString("guiTooltip")); - _headerButtonGroup.add(_guiHeaderRadio); - jpanel1.add(_guiHeaderRadio,cc.xy(4,2)); - - _consoleHeaderRadio.setActionCommand("Console"); - _consoleHeaderRadio.setName("consoleHeaderRadio"); - _consoleHeaderRadio.setText(Messages.getString("console")); - _consoleHeaderRadio.setToolTipText(Messages.getString("consoleTooltip")); - _headerButtonGroup.add(_consoleHeaderRadio); - jpanel1.add(_consoleHeaderRadio,cc.xy(6,2)); - - _headerObjectsTextArea.setName("headerObjectsTextArea"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_headerObjectsTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xywh(4,6,8,1)); - - _libsTextArea.setName("libsTextArea"); - JScrollPane jscrollpane2 = new JScrollPane(); - jscrollpane2.setViewportView(_libsTextArea); - jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane2,cc.xywh(4,8,8,1)); - - _headerObjectsCheck.setActionCommand("Object files"); - _headerObjectsCheck.setName("headerObjectsCheck"); - _headerObjectsCheck.setText(Messages.getString("objectFiles")); - jpanel1.add(_headerObjectsCheck,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _libsCheck.setActionCommand("w32api"); - _libsCheck.setName("libsCheck"); - _libsCheck.setText(Messages.getString("libs")); - jpanel1.add(_libsCheck,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _linkerOptionsSeparator.setName("linkerOptionsSeparator"); - _linkerOptionsSeparator.setText(Messages.getString("linkerOptions")); - jpanel1.add(_linkerOptionsSeparator,cc.xywh(2,4,10,1)); - - _jniGuiHeaderRadio.setActionCommand(Messages.getString("jniGui")); - _jniGuiHeaderRadio.setForeground(new Color(255,102,0)); - _jniGuiHeaderRadio.setName("jniGuiHeaderRadio"); - _jniGuiHeaderRadio.setText(Messages.getString("jniGui")); - _jniGuiHeaderRadio.setToolTipText(Messages.getString("jniGuiTooltip")); - _headerButtonGroup.add(_jniGuiHeaderRadio); - jpanel1.add(_jniGuiHeaderRadio,cc.xy(8,2)); - - _jniConsoleHeaderRadio.setActionCommand(Messages.getString("jniConsole")); - _jniConsoleHeaderRadio.setForeground(new Color(255,102,0)); - _jniConsoleHeaderRadio.setName("jniConsoleHeaderRadio"); - _jniConsoleHeaderRadio.setText(Messages.getString("jniConsole")); - _jniConsoleHeaderRadio.setToolTipText(Messages.getString("jniConsoleTooltip")); - _headerButtonGroup.add(_jniConsoleHeaderRadio); - jpanel1.add(_jniConsoleHeaderRadio,cc.xy(10,2)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12 },new int[]{ 1,2,3,4,5,6,7,8,9 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jeta.forms.components.separator.TitledSeparator; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ButtonGroup; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +public abstract class HeaderForm extends JPanel +{ + protected final JLabel _headerTypeLabel = new JLabel(); + protected final JRadioButton _guiHeaderRadio = new JRadioButton(); + protected final ButtonGroup _headerButtonGroup = new ButtonGroup(); + protected final JRadioButton _consoleHeaderRadio = new JRadioButton(); + protected final JTextArea _headerObjectsTextArea = new JTextArea(); + protected final JTextArea _libsTextArea = new JTextArea(); + protected final JCheckBox _headerObjectsCheck = new JCheckBox(); + protected final JCheckBox _libsCheck = new JCheckBox(); + protected final TitledSeparator _linkerOptionsSeparator = new TitledSeparator(); + protected final JRadioButton _jniGuiHeaderRadio = new JRadioButton(); + protected final JRadioButton _jniConsoleHeaderRadio = new JRadioButton(); + + /** + * Default constructor + */ + public HeaderForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:DEFAULT:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(0.2),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _headerTypeLabel.setName("headerTypeLabel"); + _headerTypeLabel.setText(Messages.getString("headerType")); + jpanel1.add(_headerTypeLabel,cc.xy(2,2)); + + _guiHeaderRadio.setActionCommand("GUI"); + _guiHeaderRadio.setName("guiHeaderRadio"); + _guiHeaderRadio.setText(Messages.getString("gui")); + _guiHeaderRadio.setToolTipText(Messages.getString("guiTooltip")); + _headerButtonGroup.add(_guiHeaderRadio); + jpanel1.add(_guiHeaderRadio,cc.xy(4,2)); + + _consoleHeaderRadio.setActionCommand("Console"); + _consoleHeaderRadio.setName("consoleHeaderRadio"); + _consoleHeaderRadio.setText(Messages.getString("console")); + _consoleHeaderRadio.setToolTipText(Messages.getString("consoleTooltip")); + _headerButtonGroup.add(_consoleHeaderRadio); + jpanel1.add(_consoleHeaderRadio,cc.xy(6,2)); + + _headerObjectsTextArea.setName("headerObjectsTextArea"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_headerObjectsTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xywh(4,6,8,1)); + + _libsTextArea.setName("libsTextArea"); + JScrollPane jscrollpane2 = new JScrollPane(); + jscrollpane2.setViewportView(_libsTextArea); + jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane2,cc.xywh(4,8,8,1)); + + _headerObjectsCheck.setActionCommand("Object files"); + _headerObjectsCheck.setName("headerObjectsCheck"); + _headerObjectsCheck.setText(Messages.getString("objectFiles")); + jpanel1.add(_headerObjectsCheck,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _libsCheck.setActionCommand("w32api"); + _libsCheck.setName("libsCheck"); + _libsCheck.setText(Messages.getString("libs")); + jpanel1.add(_libsCheck,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _linkerOptionsSeparator.setName("linkerOptionsSeparator"); + _linkerOptionsSeparator.setText(Messages.getString("linkerOptions")); + jpanel1.add(_linkerOptionsSeparator,cc.xywh(2,4,10,1)); + + _jniGuiHeaderRadio.setActionCommand(Messages.getString("jniGui")); + _jniGuiHeaderRadio.setForeground(new Color(255,102,0)); + _jniGuiHeaderRadio.setName("jniGuiHeaderRadio"); + _jniGuiHeaderRadio.setText(Messages.getString("jniGui")); + _jniGuiHeaderRadio.setToolTipText(Messages.getString("jniGuiTooltip")); + _headerButtonGroup.add(_jniGuiHeaderRadio); + jpanel1.add(_jniGuiHeaderRadio,cc.xy(8,2)); + + _jniConsoleHeaderRadio.setActionCommand(Messages.getString("jniConsole")); + _jniConsoleHeaderRadio.setForeground(new Color(255,102,0)); + _jniConsoleHeaderRadio.setName("jniConsoleHeaderRadio"); + _jniConsoleHeaderRadio.setText(Messages.getString("jniConsole")); + _jniConsoleHeaderRadio.setToolTipText(Messages.getString("jniConsoleTooltip")); + _headerButtonGroup.add(_jniConsoleHeaderRadio); + jpanel1.add(_jniConsoleHeaderRadio,cc.xy(10,2)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12 },new int[]{ 1,2,3,4,5,6,7,8,9 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/JreForm.java b/launch4j/src/net/sf/launch4j/form/JreForm.java index 979b81c..b3db722 100644 --- a/launch4j/src/net/sf/launch4j/form/JreForm.java +++ b/launch4j/src/net/sf/launch4j/form/JreForm.java @@ -1,307 +1,297 @@ -package net.sf.launch4j.form; - -import com.jeta.forms.components.separator.TitledSeparator; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; - -public abstract class JreForm extends JPanel -{ - protected final JLabel _jrePathLabel = new JLabel(); - protected final JLabel _jreMinLabel = new JLabel(); - protected final JLabel _jreMaxLabel = new JLabel(); - protected final JLabel _jvmOptionsTextLabel = new JLabel(); - protected final JTextField _jreMinField = new JTextField(); - protected final JTextField _jreMaxField = new JTextField(); - protected final JTextArea _jvmOptionsTextArea = new JTextArea(); - protected final JLabel _initialHeapSizeLabel = new JLabel(); - protected final JLabel _maxHeapSizeLabel = new JLabel(); - protected final JTextField _initialHeapSizeField = new JTextField(); - protected final JTextField _maxHeapSizeField = new JTextField(); - protected final JTextField _maxHeapPercentField = new JTextField(); - protected final JTextField _initialHeapPercentField = new JTextField(); - protected final JComboBox _jdkPreferenceCombo = new JComboBox(); - protected final JComboBox _runtimeBitsCombo = new JComboBox(); - protected final JComboBox _varCombo = new JComboBox(); - protected final JButton _propertyButton = new JButton(); - protected final JButton _optionButton = new JButton(); - protected final JButton _envPropertyButton = new JButton(); - protected final JButton _envOptionButton = new JButton(); - protected final JTextField _envVarField = new JTextField(); - protected final JTextField _jrePathField = new JTextField(); - protected final JCheckBox _bundledJre64BitCheck = new JCheckBox(); - protected final JCheckBox _bundledJreAsFallbackCheck = new JCheckBox(); - - /** - * Default constructor - */ - public JreForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:50DLU:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _jrePathLabel.setName("jrePathLabel"); - _jrePathLabel.setText(Messages.getString("jrePath")); - jpanel1.add(_jrePathLabel,cc.xy(2,2)); - - _jreMinLabel.setName("jreMinLabel"); - _jreMinLabel.setText(Messages.getString("jreMin")); - jpanel1.add(_jreMinLabel,cc.xy(2,6)); - - _jreMaxLabel.setName("jreMaxLabel"); - _jreMaxLabel.setText(Messages.getString("jreMax")); - jpanel1.add(_jreMaxLabel,cc.xy(2,8)); - - _jvmOptionsTextLabel.setName("jvmOptionsTextLabel"); - _jvmOptionsTextLabel.setText(Messages.getString("jvmOptions")); - jpanel1.add(_jvmOptionsTextLabel,new CellConstraints(2,16,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _jreMinField.setName("jreMinField"); - jpanel1.add(_jreMinField,cc.xy(4,6)); - - _jreMaxField.setName("jreMaxField"); - jpanel1.add(_jreMaxField,cc.xy(4,8)); - - _jvmOptionsTextArea.setName("jvmOptionsTextArea"); - _jvmOptionsTextArea.setToolTipText(Messages.getString("jvmOptionsTip")); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_jvmOptionsTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xywh(4,16,7,1)); - - _initialHeapSizeLabel.setName("initialHeapSizeLabel"); - _initialHeapSizeLabel.setText(Messages.getString("initialHeapSize")); - jpanel1.add(_initialHeapSizeLabel,cc.xy(2,12)); - - _maxHeapSizeLabel.setName("maxHeapSizeLabel"); - _maxHeapSizeLabel.setText(Messages.getString("maxHeapSize")); - jpanel1.add(_maxHeapSizeLabel,cc.xy(2,14)); - - JLabel jlabel1 = new JLabel(); - jlabel1.setText("MB"); - jpanel1.add(jlabel1,cc.xy(6,12)); - - JLabel jlabel2 = new JLabel(); - jlabel2.setText("MB"); - jpanel1.add(jlabel2,cc.xy(6,14)); - - _initialHeapSizeField.setName("initialHeapSizeField"); - jpanel1.add(_initialHeapSizeField,cc.xy(4,12)); - - _maxHeapSizeField.setName("maxHeapSizeField"); - jpanel1.add(_maxHeapSizeField,cc.xy(4,14)); - - _maxHeapPercentField.setName("maxHeapPercentField"); - jpanel1.add(_maxHeapPercentField,cc.xy(8,14)); - - _initialHeapPercentField.setName("initialHeapPercentField"); - jpanel1.add(_initialHeapPercentField,cc.xy(8,12)); - - _jdkPreferenceCombo.setName("jdkPreferenceCombo"); - jpanel1.add(_jdkPreferenceCombo,cc.xywh(8,6,3,1)); - - JLabel jlabel3 = new JLabel(); - jlabel3.setText(Messages.getString("availableMemory")); - jpanel1.add(jlabel3,cc.xy(10,12)); - - JLabel jlabel4 = new JLabel(); - jlabel4.setText(Messages.getString("availableMemory")); - jpanel1.add(jlabel4,cc.xy(10,14)); - - _runtimeBitsCombo.setName("runtimeBitsCombo"); - _runtimeBitsCombo.setToolTipText(""); - jpanel1.add(_runtimeBitsCombo,cc.xywh(8,8,3,1)); - - jpanel1.add(createPanel1(),cc.xywh(2,18,9,1)); - TitledSeparator titledseparator1 = new TitledSeparator(); - titledseparator1.setText(Messages.getString("searchOptions")); - jpanel1.add(titledseparator1,cc.xywh(2,4,9,1)); - - TitledSeparator titledseparator2 = new TitledSeparator(); - titledseparator2.setText(Messages.getString("options")); - jpanel1.add(titledseparator2,cc.xywh(2,10,9,1)); - - jpanel1.add(createPanel2(),cc.xywh(4,2,7,1)); - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 }); - return jpanel1; - } - - public JPanel createPanel1() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _varCombo.setName("varCombo"); - jpanel1.add(_varCombo,cc.xy(3,1)); - - _propertyButton.setActionCommand("Add"); - _propertyButton.setIcon(loadImage("images/edit_add16.png")); - _propertyButton.setName("propertyButton"); - _propertyButton.setText(Messages.getString("property")); - _propertyButton.setToolTipText(Messages.getString("propertyTip")); - jpanel1.add(_propertyButton,cc.xy(5,1)); - - _optionButton.setActionCommand("Add"); - _optionButton.setIcon(loadImage("images/edit_add16.png")); - _optionButton.setName("optionButton"); - _optionButton.setText(Messages.getString("option")); - _optionButton.setToolTipText(Messages.getString("optionTip")); - jpanel1.add(_optionButton,cc.xy(7,1)); - - _envPropertyButton.setActionCommand("Add"); - _envPropertyButton.setIcon(loadImage("images/edit_add16.png")); - _envPropertyButton.setName("envPropertyButton"); - _envPropertyButton.setText(Messages.getString("property")); - _envPropertyButton.setToolTipText(Messages.getString("propertyTip")); - jpanel1.add(_envPropertyButton,cc.xy(5,3)); - - JLabel jlabel1 = new JLabel(); - jlabel1.setText(Messages.getString("varsAndRegistry")); - jpanel1.add(jlabel1,cc.xy(1,1)); - - JLabel jlabel2 = new JLabel(); - jlabel2.setIcon(loadImage("images/asterix.gif")); - jlabel2.setText(Messages.getString("envVar")); - jpanel1.add(jlabel2,cc.xy(1,3)); - - _envOptionButton.setActionCommand("Add"); - _envOptionButton.setIcon(loadImage("images/edit_add16.png")); - _envOptionButton.setName("envOptionButton"); - _envOptionButton.setText(Messages.getString("option")); - _envOptionButton.setToolTipText(Messages.getString("optionTip")); - jpanel1.add(_envOptionButton,cc.xy(7,3)); - - _envVarField.setName("envVarField"); - jpanel1.add(_envVarField,cc.xy(3,3)); - - addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[]{ 2 }); - return jpanel1; - } - - public JPanel createPanel2() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _jrePathField.setName("jrePathField"); - _jrePathField.setToolTipText(Messages.getString("jrePathTip")); - jpanel1.add(_jrePathField,cc.xy(1,1)); - - _bundledJre64BitCheck.setActionCommand(Messages.getString("bundledJre64Bit")); - _bundledJre64BitCheck.setName("bundledJre64BitCheck"); - _bundledJre64BitCheck.setText(Messages.getString("bundledJre64Bit")); - _bundledJre64BitCheck.setToolTipText(Messages.getString("bundledJre64BitTip")); - jpanel1.add(_bundledJre64BitCheck,cc.xy(3,1)); - - _bundledJreAsFallbackCheck.setActionCommand(Messages.getString("bundledJreAsFallback")); - _bundledJreAsFallbackCheck.setName("bundledJreAsFallbackCheck"); - _bundledJreAsFallbackCheck.setText(Messages.getString("bundledJreAsFallback")); - _bundledJreAsFallbackCheck.setToolTipText(Messages.getString("bundledJreAsFallbackTip")); - jpanel1.add(_bundledJreAsFallbackCheck,cc.xy(5,1)); - - addFillComponents(jpanel1,new int[]{ 2,4 },new int[0]); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jeta.forms.components.separator.TitledSeparator; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +public abstract class JreForm extends JPanel +{ + protected final JLabel _jrePathLabel = new JLabel(); + protected final JLabel _jreMinLabel = new JLabel(); + protected final JLabel _jreMaxLabel = new JLabel(); + protected final JLabel _jvmOptionsTextLabel = new JLabel(); + protected final JTextField _jreMinField = new JTextField(); + protected final JTextField _jreMaxField = new JTextField(); + protected final JTextArea _jvmOptionsTextArea = new JTextArea(); + protected final JLabel _initialHeapSizeLabel = new JLabel(); + protected final JLabel _maxHeapSizeLabel = new JLabel(); + protected final JTextField _initialHeapSizeField = new JTextField(); + protected final JTextField _maxHeapSizeField = new JTextField(); + protected final JTextField _maxHeapPercentField = new JTextField(); + protected final JTextField _initialHeapPercentField = new JTextField(); + protected final JComboBox _varCombo = new JComboBox(); + protected final JButton _propertyButton = new JButton(); + protected final JButton _optionButton = new JButton(); + protected final JButton _envPropertyButton = new JButton(); + protected final JButton _envOptionButton = new JButton(); + protected final JTextField _envVarField = new JTextField(); + protected final JTextField _jrePathField = new JTextField(); + protected final JCheckBox _requires64BitCheck = new JCheckBox(); + protected final JCheckBox _requiresJdkCheck = new JCheckBox(); + + /** + * Default constructor + */ + public JreForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:7DLU:NONE,FILL:60DLU:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:50DLU:GROW(1.0),CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _jrePathLabel.setName("jrePathLabel"); + _jrePathLabel.setText(Messages.getString("jrePath")); + jpanel1.add(_jrePathLabel,cc.xy(2,2)); + + _jreMinLabel.setName("jreMinLabel"); + _jreMinLabel.setText(Messages.getString("jreMin")); + jpanel1.add(_jreMinLabel,cc.xy(2,6)); + + _jreMaxLabel.setName("jreMaxLabel"); + _jreMaxLabel.setText(Messages.getString("jreMax")); + jpanel1.add(_jreMaxLabel,cc.xy(2,8)); + + _jvmOptionsTextLabel.setName("jvmOptionsTextLabel"); + _jvmOptionsTextLabel.setText(Messages.getString("jvmOptions")); + jpanel1.add(_jvmOptionsTextLabel,new CellConstraints(2,16,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _jreMinField.setName("jreMinField"); + jpanel1.add(_jreMinField,cc.xy(4,6)); + + _jreMaxField.setName("jreMaxField"); + jpanel1.add(_jreMaxField,cc.xy(4,8)); + + _jvmOptionsTextArea.setName("jvmOptionsTextArea"); + _jvmOptionsTextArea.setToolTipText(Messages.getString("jvmOptionsTip")); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_jvmOptionsTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xywh(4,16,7,1)); + + _initialHeapSizeLabel.setName("initialHeapSizeLabel"); + _initialHeapSizeLabel.setText(Messages.getString("initialHeapSize")); + jpanel1.add(_initialHeapSizeLabel,cc.xy(2,12)); + + _maxHeapSizeLabel.setName("maxHeapSizeLabel"); + _maxHeapSizeLabel.setText(Messages.getString("maxHeapSize")); + jpanel1.add(_maxHeapSizeLabel,cc.xy(2,14)); + + JLabel jlabel1 = new JLabel(); + jlabel1.setText("MB"); + jpanel1.add(jlabel1,cc.xy(6,12)); + + JLabel jlabel2 = new JLabel(); + jlabel2.setText("MB"); + jpanel1.add(jlabel2,cc.xy(6,14)); + + _initialHeapSizeField.setName("initialHeapSizeField"); + jpanel1.add(_initialHeapSizeField,cc.xy(4,12)); + + _maxHeapSizeField.setName("maxHeapSizeField"); + jpanel1.add(_maxHeapSizeField,cc.xy(4,14)); + + _maxHeapPercentField.setName("maxHeapPercentField"); + jpanel1.add(_maxHeapPercentField,cc.xy(8,14)); + + _initialHeapPercentField.setName("initialHeapPercentField"); + jpanel1.add(_initialHeapPercentField,cc.xy(8,12)); + + JLabel jlabel3 = new JLabel(); + jlabel3.setText(Messages.getString("availableMemory")); + jpanel1.add(jlabel3,cc.xy(10,12)); + + JLabel jlabel4 = new JLabel(); + jlabel4.setText(Messages.getString("availableMemory")); + jpanel1.add(jlabel4,cc.xy(10,14)); + + jpanel1.add(createPanel1(),cc.xywh(2,18,9,1)); + TitledSeparator titledseparator1 = new TitledSeparator(); + titledseparator1.setText(Messages.getString("searchOptions")); + jpanel1.add(titledseparator1,cc.xywh(2,4,9,1)); + + TitledSeparator titledseparator2 = new TitledSeparator(); + titledseparator2.setText(Messages.getString("options")); + jpanel1.add(titledseparator2,cc.xywh(2,10,9,1)); + + jpanel1.add(createPanel2(),cc.xywh(4,2,7,1)); + _requires64BitCheck.setActionCommand(Messages.getString("requires64Bit")); + _requires64BitCheck.setName("requires64BitCheck"); + _requires64BitCheck.setText(Messages.getString("requires64Bit")); + _requires64BitCheck.setToolTipText(Messages.getString("requires64BitTip")); + jpanel1.add(_requires64BitCheck,cc.xywh(8,8,3,1)); + + _requiresJdkCheck.setActionCommand(Messages.getString("requiresJdk")); + _requiresJdkCheck.setName("requiresJdkCheck"); + _requiresJdkCheck.setText(Messages.getString("requiresJdk")); + jpanel1.add(_requiresJdkCheck,cc.xywh(8,6,3,1)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9,10,11 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19 }); + return jpanel1; + } + + public JPanel createPanel1() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _varCombo.setName("varCombo"); + jpanel1.add(_varCombo,cc.xy(3,1)); + + _propertyButton.setActionCommand("Add"); + _propertyButton.setIcon(loadImage("images/edit_add16.png")); + _propertyButton.setName("propertyButton"); + _propertyButton.setText(Messages.getString("property")); + _propertyButton.setToolTipText(Messages.getString("propertyTip")); + jpanel1.add(_propertyButton,cc.xy(5,1)); + + _optionButton.setActionCommand("Add"); + _optionButton.setIcon(loadImage("images/edit_add16.png")); + _optionButton.setName("optionButton"); + _optionButton.setText(Messages.getString("option")); + _optionButton.setToolTipText(Messages.getString("optionTip")); + jpanel1.add(_optionButton,cc.xy(7,1)); + + _envPropertyButton.setActionCommand("Add"); + _envPropertyButton.setIcon(loadImage("images/edit_add16.png")); + _envPropertyButton.setName("envPropertyButton"); + _envPropertyButton.setText(Messages.getString("property")); + _envPropertyButton.setToolTipText(Messages.getString("propertyTip")); + jpanel1.add(_envPropertyButton,cc.xy(5,3)); + + JLabel jlabel1 = new JLabel(); + jlabel1.setText(Messages.getString("varsAndRegistry")); + jpanel1.add(jlabel1,cc.xy(1,1)); + + JLabel jlabel2 = new JLabel(); + jlabel2.setIcon(loadImage("images/asterix.gif")); + jlabel2.setText(Messages.getString("envVar")); + jpanel1.add(jlabel2,cc.xy(1,3)); + + _envOptionButton.setActionCommand("Add"); + _envOptionButton.setIcon(loadImage("images/edit_add16.png")); + _envOptionButton.setName("envOptionButton"); + _envOptionButton.setText(Messages.getString("option")); + _envOptionButton.setToolTipText(Messages.getString("optionTip")); + jpanel1.add(_envOptionButton,cc.xy(7,3)); + + _envVarField.setName("envVarField"); + jpanel1.add(_envVarField,cc.xy(3,3)); + + addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[]{ 2 }); + return jpanel1; + } + + public JPanel createPanel2() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _jrePathField.setName("jrePathField"); + _jrePathField.setToolTipText(Messages.getString("jrePathTip")); + jpanel1.add(_jrePathField,cc.xywh(1,1,5,1)); + + addFillComponents(jpanel1,new int[]{ 2,3,4,5 },new int[0]); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/JreForm.jfrm b/launch4j/src/net/sf/launch4j/form/JreForm.jfrm index ffb56c9..a666a8d 100644 Binary files a/launch4j/src/net/sf/launch4j/form/JreForm.jfrm and b/launch4j/src/net/sf/launch4j/form/JreForm.jfrm differ diff --git a/launch4j/src/net/sf/launch4j/form/Messages.java b/launch4j/src/net/sf/launch4j/form/Messages.java index d995a22..1529ed1 100644 --- a/launch4j/src/net/sf/launch4j/form/Messages.java +++ b/launch4j/src/net/sf/launch4j/form/Messages.java @@ -1,55 +1,55 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.form; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.form.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.form; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.form.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/launch4j/src/net/sf/launch4j/form/MessagesForm.java b/launch4j/src/net/sf/launch4j/form/MessagesForm.java index f2e8723..b456d9a 100644 --- a/launch4j/src/net/sf/launch4j/form/MessagesForm.java +++ b/launch4j/src/net/sf/launch4j/form/MessagesForm.java @@ -1,183 +1,183 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; - -public abstract class MessagesForm extends JPanel -{ - protected final JTextArea _startupErrTextArea = new JTextArea(); - protected final JTextArea _bundledJreErrTextArea = new JTextArea(); - protected final JTextArea _jreVersionErrTextArea = new JTextArea(); - protected final JTextArea _launcherErrTextArea = new JTextArea(); - protected final JCheckBox _messagesCheck = new JCheckBox(); - protected final JTextArea _instanceAlreadyExistsMsgTextArea = new JTextArea(); - - /** - * Default constructor - */ - public MessagesForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _startupErrTextArea.setName("startupErrTextArea"); - JScrollPane jscrollpane1 = new JScrollPane(); - jscrollpane1.setViewportView(_startupErrTextArea); - jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane1,cc.xy(4,4)); - - _bundledJreErrTextArea.setName("bundledJreErrTextArea"); - JScrollPane jscrollpane2 = new JScrollPane(); - jscrollpane2.setViewportView(_bundledJreErrTextArea); - jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane2,cc.xy(4,6)); - - _jreVersionErrTextArea.setName("jreVersionErrTextArea"); - _jreVersionErrTextArea.setToolTipText(Messages.getString("jreVersionErrTip")); - JScrollPane jscrollpane3 = new JScrollPane(); - jscrollpane3.setViewportView(_jreVersionErrTextArea); - jscrollpane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane3,cc.xy(4,8)); - - _launcherErrTextArea.setName("launcherErrTextArea"); - JScrollPane jscrollpane4 = new JScrollPane(); - jscrollpane4.setViewportView(_launcherErrTextArea); - jscrollpane4.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane4.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane4,cc.xy(4,10)); - - JLabel jlabel1 = new JLabel(); - jlabel1.setText(Messages.getString("startupErr")); - jpanel1.add(jlabel1,new CellConstraints(2,4,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - JLabel jlabel2 = new JLabel(); - jlabel2.setText(Messages.getString("bundledJreErr")); - jpanel1.add(jlabel2,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - JLabel jlabel3 = new JLabel(); - jlabel3.setText(Messages.getString("jreVersionErr")); - jpanel1.add(jlabel3,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - JLabel jlabel4 = new JLabel(); - jlabel4.setText(Messages.getString("launcherErr")); - jpanel1.add(jlabel4,new CellConstraints(2,10,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _messagesCheck.setActionCommand("Add version information"); - _messagesCheck.setName("messagesCheck"); - _messagesCheck.setText(Messages.getString("addMessages")); - jpanel1.add(_messagesCheck,cc.xy(4,2)); - - JLabel jlabel5 = new JLabel(); - jlabel5.setText(Messages.getString("instanceAlreadyExistsMsg")); - jpanel1.add(jlabel5,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); - - _instanceAlreadyExistsMsgTextArea.setName("instanceAlreadyExistsMsgTextArea"); - _instanceAlreadyExistsMsgTextArea.setToolTipText(Messages.getString("instanceAlreadyExistsMsgTip")); - JScrollPane jscrollpane5 = new JScrollPane(); - jscrollpane5.setViewportView(_instanceAlreadyExistsMsgTextArea); - jscrollpane5.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); - jscrollpane5.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - jpanel1.add(jscrollpane5,cc.xy(4,12)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +public abstract class MessagesForm extends JPanel +{ + protected final JTextArea _startupErrTextArea = new JTextArea(); + protected final JTextArea _jreNotFoundErrTextArea = new JTextArea(); + protected final JTextArea _jreVersionErrTextArea = new JTextArea(); + protected final JTextArea _launcherErrTextArea = new JTextArea(); + protected final JCheckBox _messagesCheck = new JCheckBox(); + protected final JTextArea _instanceAlreadyExistsMsgTextArea = new JTextArea(); + + /** + * Default constructor + */ + public MessagesForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _startupErrTextArea.setName("startupErrTextArea"); + JScrollPane jscrollpane1 = new JScrollPane(); + jscrollpane1.setViewportView(_startupErrTextArea); + jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane1,cc.xy(4,4)); + + _jreNotFoundErrTextArea.setName("jreNotFoundErrTextArea"); + JScrollPane jscrollpane2 = new JScrollPane(); + jscrollpane2.setViewportView(_jreNotFoundErrTextArea); + jscrollpane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane2,cc.xy(4,6)); + + _jreVersionErrTextArea.setName("jreVersionErrTextArea"); + _jreVersionErrTextArea.setToolTipText(Messages.getString("jreVersionErrTip")); + JScrollPane jscrollpane3 = new JScrollPane(); + jscrollpane3.setViewportView(_jreVersionErrTextArea); + jscrollpane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane3,cc.xy(4,8)); + + _launcherErrTextArea.setName("launcherErrTextArea"); + JScrollPane jscrollpane4 = new JScrollPane(); + jscrollpane4.setViewportView(_launcherErrTextArea); + jscrollpane4.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane4.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane4,cc.xy(4,10)); + + JLabel jlabel1 = new JLabel(); + jlabel1.setText(Messages.getString("startupErr")); + jpanel1.add(jlabel1,new CellConstraints(2,4,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + JLabel jlabel2 = new JLabel(); + jlabel2.setText(Messages.getString("jreNotFoundErr")); + jpanel1.add(jlabel2,new CellConstraints(2,6,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + JLabel jlabel3 = new JLabel(); + jlabel3.setText(Messages.getString("jreVersionErr")); + jpanel1.add(jlabel3,new CellConstraints(2,8,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + JLabel jlabel4 = new JLabel(); + jlabel4.setText(Messages.getString("launcherErr")); + jpanel1.add(jlabel4,new CellConstraints(2,10,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _messagesCheck.setActionCommand("Add version information"); + _messagesCheck.setName("messagesCheck"); + _messagesCheck.setText(Messages.getString("addMessages")); + jpanel1.add(_messagesCheck,cc.xy(4,2)); + + JLabel jlabel5 = new JLabel(); + jlabel5.setText(Messages.getString("instanceAlreadyExistsMsg")); + jpanel1.add(jlabel5,new CellConstraints(2,12,1,1,CellConstraints.DEFAULT,CellConstraints.TOP)); + + _instanceAlreadyExistsMsgTextArea.setName("instanceAlreadyExistsMsgTextArea"); + _instanceAlreadyExistsMsgTextArea.setToolTipText(Messages.getString("instanceAlreadyExistsMsgTip")); + JScrollPane jscrollpane5 = new JScrollPane(); + jscrollpane5.setViewportView(_instanceAlreadyExistsMsgTextArea); + jscrollpane5.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + jscrollpane5.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + jpanel1.add(jscrollpane5,cc.xy(4,12)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm b/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm index e8044df..bc36e1d 100644 Binary files a/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm and b/launch4j/src/net/sf/launch4j/form/MessagesForm.jfrm differ diff --git a/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java b/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java index 2bfe724..7a2eb2e 100644 --- a/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java +++ b/launch4j/src/net/sf/launch4j/form/SingleInstanceForm.java @@ -1,141 +1,141 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -public abstract class SingleInstanceForm extends JPanel -{ - protected final JLabel _splashFileLabel = new JLabel(); - protected final JTextField _mutexNameField = new JTextField(); - protected final JCheckBox _singleInstanceCheck = new JCheckBox(); - protected final JTextField _windowTitleField = new JTextField(); - protected final JLabel _splashFileLabel1 = new JLabel(); - - /** - * Default constructor - */ - public SingleInstanceForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _splashFileLabel.setIcon(loadImage("images/asterix.gif")); - _splashFileLabel.setName("splashFileLabel"); - _splashFileLabel.setText(Messages.getString("mutexName")); - jpanel1.add(_splashFileLabel,cc.xy(2,4)); - - _mutexNameField.setName("mutexNameField"); - _mutexNameField.setToolTipText(Messages.getString("mutexNameTip")); - jpanel1.add(_mutexNameField,cc.xywh(4,4,2,1)); - - _singleInstanceCheck.setActionCommand("Enable splash screen"); - _singleInstanceCheck.setName("singleInstanceCheck"); - _singleInstanceCheck.setText(Messages.getString("enableSingleInstance")); - jpanel1.add(_singleInstanceCheck,cc.xywh(4,2,2,1)); - - _windowTitleField.setName("windowTitleField"); - _windowTitleField.setToolTipText(Messages.getString("windowTitleTip")); - jpanel1.add(_windowTitleField,cc.xywh(4,6,2,1)); - - _splashFileLabel1.setName("splashFileLabel"); - _splashFileLabel1.setText(Messages.getString("windowTitle")); - jpanel1.add(_splashFileLabel1,cc.xy(2,6)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6 },new int[]{ 1,2,3,4,5,6,7 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + +public abstract class SingleInstanceForm extends JPanel +{ + protected final JLabel _splashFileLabel = new JLabel(); + protected final JTextField _mutexNameField = new JTextField(); + protected final JCheckBox _singleInstanceCheck = new JCheckBox(); + protected final JTextField _windowTitleField = new JTextField(); + protected final JLabel _splashFileLabel1 = new JLabel(); + + /** + * Default constructor + */ + public SingleInstanceForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _splashFileLabel.setIcon(loadImage("images/asterix.gif")); + _splashFileLabel.setName("splashFileLabel"); + _splashFileLabel.setText(Messages.getString("mutexName")); + jpanel1.add(_splashFileLabel,cc.xy(2,4)); + + _mutexNameField.setName("mutexNameField"); + _mutexNameField.setToolTipText(Messages.getString("mutexNameTip")); + jpanel1.add(_mutexNameField,cc.xywh(4,4,2,1)); + + _singleInstanceCheck.setActionCommand("Enable splash screen"); + _singleInstanceCheck.setName("singleInstanceCheck"); + _singleInstanceCheck.setText(Messages.getString("enableSingleInstance")); + jpanel1.add(_singleInstanceCheck,cc.xywh(4,2,2,1)); + + _windowTitleField.setName("windowTitleField"); + _windowTitleField.setToolTipText(Messages.getString("windowTitleTip")); + jpanel1.add(_windowTitleField,cc.xywh(4,6,2,1)); + + _splashFileLabel1.setName("splashFileLabel"); + _splashFileLabel1.setText(Messages.getString("windowTitle")); + jpanel1.add(_splashFileLabel1,cc.xy(2,6)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6 },new int[]{ 1,2,3,4,5,6,7 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/SplashForm.java b/launch4j/src/net/sf/launch4j/form/SplashForm.java index 7a3085a..f391733 100644 --- a/launch4j/src/net/sf/launch4j/form/SplashForm.java +++ b/launch4j/src/net/sf/launch4j/form/SplashForm.java @@ -1,166 +1,167 @@ -package net.sf.launch4j.form; - -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -public abstract class SplashForm extends JPanel -{ - protected final JLabel _splashFileLabel = new JLabel(); - protected final JLabel _waitForWindowLabel = new JLabel(); - protected final JLabel _timeoutLabel = new JLabel(); - protected final JCheckBox _timeoutErrCheck = new JCheckBox(); - protected final JTextField _splashFileField = new JTextField(); - protected final JTextField _timeoutField = new JTextField(); - protected final JButton _splashFileButton = new JButton(); - protected final JCheckBox _splashCheck = new JCheckBox(); - protected final JCheckBox _waitForWindowCheck = new JCheckBox(); - - /** - * Default constructor - */ - public SplashForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _splashFileLabel.setIcon(loadImage("images/asterix.gif")); - _splashFileLabel.setName("splashFileLabel"); - _splashFileLabel.setText(Messages.getString("splashFile")); - jpanel1.add(_splashFileLabel,cc.xy(2,4)); - - _waitForWindowLabel.setName("waitForWindowLabel"); - _waitForWindowLabel.setText(Messages.getString("waitForWindow")); - jpanel1.add(_waitForWindowLabel,cc.xy(2,6)); - - _timeoutLabel.setIcon(loadImage("images/asterix.gif")); - _timeoutLabel.setName("timeoutLabel"); - _timeoutLabel.setText(Messages.getString("timeout")); - jpanel1.add(_timeoutLabel,cc.xy(2,8)); - - _timeoutErrCheck.setActionCommand("Signal error on timeout"); - _timeoutErrCheck.setName("timeoutErrCheck"); - _timeoutErrCheck.setText(Messages.getString("timeoutErr")); - _timeoutErrCheck.setToolTipText(Messages.getString("timeoutErrTip")); - jpanel1.add(_timeoutErrCheck,cc.xywh(4,10,2,1)); - - _splashFileField.setName("splashFileField"); - _splashFileField.setToolTipText(Messages.getString("splashFileTip")); - jpanel1.add(_splashFileField,cc.xywh(4,4,2,1)); - - _timeoutField.setName("timeoutField"); - _timeoutField.setToolTipText(Messages.getString("timeoutTip")); - jpanel1.add(_timeoutField,cc.xy(4,8)); - - _splashFileButton.setIcon(loadImage("images/open16.png")); - _splashFileButton.setName("splashFileButton"); - jpanel1.add(_splashFileButton,cc.xy(7,4)); - - _splashCheck.setActionCommand("Enable splash screen"); - _splashCheck.setName("splashCheck"); - _splashCheck.setText(Messages.getString("enableSplash")); - jpanel1.add(_splashCheck,cc.xywh(4,2,2,1)); - - _waitForWindowCheck.setActionCommand("Close splash screen when an application window appears"); - _waitForWindowCheck.setName("waitForWindowCheck"); - _waitForWindowCheck.setText(Messages.getString("waitForWindowText")); - jpanel1.add(_waitForWindowCheck,cc.xywh(4,6,2,1)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.UIManager; + +public abstract class SplashForm extends JPanel +{ + protected final JLabel _splashFileLabel = new JLabel(); + protected final JLabel _waitForWindowLabel = new JLabel(); + protected final JLabel _timeoutLabel = new JLabel(); + protected final JCheckBox _timeoutErrCheck = new JCheckBox(); + protected final JTextField _splashFileField = new JTextField(); + protected final JTextField _timeoutField = new JTextField(); + protected final JButton _splashFileButton = new JButton(); + protected final JCheckBox _splashCheck = new JCheckBox(); + protected final JCheckBox _waitForWindowCheck = new JCheckBox(); + + /** + * Default constructor + */ + public SplashForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:26PX:NONE,FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _splashFileLabel.setIcon(loadImage("images/asterix.gif")); + _splashFileLabel.setName("splashFileLabel"); + _splashFileLabel.setText(Messages.getString("splashFile")); + jpanel1.add(_splashFileLabel,cc.xy(2,4)); + + _waitForWindowLabel.setName("waitForWindowLabel"); + _waitForWindowLabel.setText(Messages.getString("waitForWindow")); + jpanel1.add(_waitForWindowLabel,cc.xy(2,6)); + + _timeoutLabel.setIcon(loadImage("images/asterix.gif")); + _timeoutLabel.setName("timeoutLabel"); + _timeoutLabel.setText(Messages.getString("timeout")); + jpanel1.add(_timeoutLabel,cc.xy(2,8)); + + _timeoutErrCheck.setActionCommand("Signal error on timeout"); + _timeoutErrCheck.setName("timeoutErrCheck"); + _timeoutErrCheck.setText(Messages.getString("timeoutErr")); + _timeoutErrCheck.setToolTipText(Messages.getString("timeoutErrTip")); + jpanel1.add(_timeoutErrCheck,cc.xywh(4,10,2,1)); + + _splashFileField.setName("splashFileField"); + _splashFileField.setToolTipText(Messages.getString("splashFileTip")); + jpanel1.add(_splashFileField,cc.xywh(4,4,2,1)); + + _timeoutField.setName("timeoutField"); + _timeoutField.setToolTipText(Messages.getString("timeoutTip")); + jpanel1.add(_timeoutField,cc.xy(4,8)); + + _splashFileButton.setIcon(UIManager.getIcon("Tree.closedIcon")); + _splashFileButton.setName("splashFileButton"); + jpanel1.add(_splashFileButton,cc.xy(7,4)); + + _splashCheck.setActionCommand("Enable splash screen"); + _splashCheck.setName("splashCheck"); + _splashCheck.setText(Messages.getString("enableSplash")); + jpanel1.add(_splashCheck,cc.xywh(4,2,2,1)); + + _waitForWindowCheck.setActionCommand("Close splash screen when an application window appears"); + _waitForWindowCheck.setName("waitForWindowCheck"); + _waitForWindowCheck.setText(Messages.getString("waitForWindowText")); + jpanel1.add(_waitForWindowCheck,cc.xywh(4,6,2,1)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java b/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java index 92cfda2..5afd615 100644 --- a/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java +++ b/launch4j/src/net/sf/launch4j/form/VersionInfoForm.java @@ -1,251 +1,255 @@ -package net.sf.launch4j.form; - -import com.jeta.forms.components.separator.TitledSeparator; -import com.jgoodies.forms.layout.CellConstraints; -import com.jgoodies.forms.layout.FormLayout; -import java.awt.BorderLayout; -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.Box; -import javax.swing.ImageIcon; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -public abstract class VersionInfoForm extends JPanel -{ - protected final JCheckBox _versionInfoCheck = new JCheckBox(); - protected final JLabel _fileVersionLabel = new JLabel(); - protected final JTextField _fileVersionField = new JTextField(); - protected final TitledSeparator _addVersionInfoSeparator = new TitledSeparator(); - protected final JLabel _productVersionLabel = new JLabel(); - protected final JTextField _productVersionField = new JTextField(); - protected final JLabel _fileDescriptionLabel = new JLabel(); - protected final JTextField _fileDescriptionField = new JTextField(); - protected final JLabel _copyrightLabel = new JLabel(); - protected final JTextField _copyrightField = new JTextField(); - protected final JLabel _txtFileVersionLabel = new JLabel(); - protected final JTextField _txtFileVersionField = new JTextField(); - protected final JLabel _txtProductVersionLabel = new JLabel(); - protected final JTextField _txtProductVersionField = new JTextField(); - protected final JLabel _productNameLabel = new JLabel(); - protected final JTextField _productNameField = new JTextField(); - protected final JLabel _originalFilenameLabel = new JLabel(); - protected final JTextField _originalFilenameField = new JTextField(); - protected final JLabel _internalNameLabel = new JLabel(); - protected final JTextField _internalNameField = new JTextField(); - protected final JLabel _companyNameLabel = new JLabel(); - protected final JTextField _companyNameField = new JTextField(); - protected final JLabel _languageLabel = new JLabel(); - protected final JComboBox _languageCombo = new JComboBox(); - protected final JLabel _trademarksLabel = new JLabel(); - protected final JTextField _trademarksField = new JTextField(); - - /** - * Default constructor - */ - public VersionInfoForm() - { - initializePanel(); - } - - /** - * Adds fill components to empty cells in the first row and first column of the grid. - * This ensures that the grid spacing will be the same as shown in the designer. - * @param cols an array of column indices in the first row where fill components should be added. - * @param rows an array of row indices in the first column where fill components should be added. - */ - void addFillComponents( Container panel, int[] cols, int[] rows ) - { - Dimension filler = new Dimension(10,10); - - boolean filled_cell_11 = false; - CellConstraints cc = new CellConstraints(); - if ( cols.length > 0 && rows.length > 0 ) - { - if ( cols[0] == 1 && rows[0] == 1 ) - { - /** add a rigid area */ - panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); - filled_cell_11 = true; - } - } - - for( int index = 0; index < cols.length; index++ ) - { - if ( cols[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); - } - - for( int index = 0; index < rows.length; index++ ) - { - if ( rows[index] == 1 && filled_cell_11 ) - { - continue; - } - panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); - } - - } - - /** - * Helper method to load an image file from the CLASSPATH - * @param imageName the package and name of the file to load relative to the CLASSPATH - * @return an ImageIcon instance with the specified image file - * @throws IllegalArgumentException if the image resource cannot be loaded. - */ - public ImageIcon loadImage( String imageName ) - { - try - { - ClassLoader classloader = getClass().getClassLoader(); - java.net.URL url = classloader.getResource( imageName ); - if ( url != null ) - { - ImageIcon icon = new ImageIcon( url ); - return icon; - } - } - catch( Exception e ) - { - e.printStackTrace(); - } - throw new IllegalArgumentException( "Unable to load image: " + imageName ); - } - - public JPanel createPanel() - { - JPanel jpanel1 = new JPanel(); - FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:7DLU:NONE,RIGHT:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); - CellConstraints cc = new CellConstraints(); - jpanel1.setLayout(formlayout1); - - _versionInfoCheck.setActionCommand("Add version information"); - _versionInfoCheck.setName("versionInfoCheck"); - _versionInfoCheck.setText(Messages.getString("addVersionInfo")); - jpanel1.add(_versionInfoCheck,cc.xywh(4,2,5,1)); - - _fileVersionLabel.setIcon(loadImage("images/asterix.gif")); - _fileVersionLabel.setName("fileVersionLabel"); - _fileVersionLabel.setText(Messages.getString("fileVersion")); - jpanel1.add(_fileVersionLabel,cc.xy(2,4)); - - _fileVersionField.setName("fileVersionField"); - _fileVersionField.setToolTipText(Messages.getString("fileVersionTip")); - jpanel1.add(_fileVersionField,cc.xy(4,4)); - - _addVersionInfoSeparator.setName("addVersionInfoSeparator"); - _addVersionInfoSeparator.setText("Additional information"); - jpanel1.add(_addVersionInfoSeparator,cc.xywh(2,10,7,1)); - - _productVersionLabel.setIcon(loadImage("images/asterix.gif")); - _productVersionLabel.setName("productVersionLabel"); - _productVersionLabel.setText(Messages.getString("productVersion")); - jpanel1.add(_productVersionLabel,cc.xy(2,12)); - - _productVersionField.setName("productVersionField"); - _productVersionField.setToolTipText(Messages.getString("productVersionTip")); - jpanel1.add(_productVersionField,cc.xy(4,12)); - - _fileDescriptionLabel.setIcon(loadImage("images/asterix.gif")); - _fileDescriptionLabel.setName("fileDescriptionLabel"); - _fileDescriptionLabel.setText(Messages.getString("fileDescription")); - jpanel1.add(_fileDescriptionLabel,cc.xy(2,6)); - - _fileDescriptionField.setName("fileDescriptionField"); - _fileDescriptionField.setToolTipText(Messages.getString("fileDescriptionTip")); - jpanel1.add(_fileDescriptionField,cc.xywh(4,6,5,1)); - - _copyrightLabel.setIcon(loadImage("images/asterix.gif")); - _copyrightLabel.setName("copyrightLabel"); - _copyrightLabel.setText(Messages.getString("copyright")); - jpanel1.add(_copyrightLabel,cc.xy(2,8)); - - _copyrightField.setName("copyrightField"); - jpanel1.add(_copyrightField,cc.xywh(4,8,5,1)); - - _txtFileVersionLabel.setIcon(loadImage("images/asterix.gif")); - _txtFileVersionLabel.setName("txtFileVersionLabel"); - _txtFileVersionLabel.setText(Messages.getString("txtFileVersion")); - jpanel1.add(_txtFileVersionLabel,cc.xy(6,4)); - - _txtFileVersionField.setName("txtFileVersionField"); - _txtFileVersionField.setToolTipText(Messages.getString("txtFileVersionTip")); - jpanel1.add(_txtFileVersionField,cc.xy(8,4)); - - _txtProductVersionLabel.setIcon(loadImage("images/asterix.gif")); - _txtProductVersionLabel.setName("txtProductVersionLabel"); - _txtProductVersionLabel.setText(Messages.getString("txtProductVersion")); - jpanel1.add(_txtProductVersionLabel,cc.xy(6,12)); - - _txtProductVersionField.setName("txtProductVersionField"); - _txtProductVersionField.setToolTipText(Messages.getString("txtProductVersionTip")); - jpanel1.add(_txtProductVersionField,cc.xy(8,12)); - - _productNameLabel.setIcon(loadImage("images/asterix.gif")); - _productNameLabel.setName("productNameLabel"); - _productNameLabel.setText(Messages.getString("productName")); - jpanel1.add(_productNameLabel,cc.xy(2,14)); - - _productNameField.setName("productNameField"); - jpanel1.add(_productNameField,cc.xywh(4,14,5,1)); - - _originalFilenameLabel.setIcon(loadImage("images/asterix.gif")); - _originalFilenameLabel.setName("originalFilenameLabel"); - _originalFilenameLabel.setText(Messages.getString("originalFilename")); - jpanel1.add(_originalFilenameLabel,cc.xy(2,20)); - - _originalFilenameField.setName("originalFilenameField"); - _originalFilenameField.setToolTipText(Messages.getString("originalFilenameTip")); - jpanel1.add(_originalFilenameField,cc.xywh(4,20,5,1)); - - _internalNameLabel.setIcon(loadImage("images/asterix.gif")); - _internalNameLabel.setName("internalNameLabel"); - _internalNameLabel.setText(Messages.getString("internalName")); - jpanel1.add(_internalNameLabel,cc.xy(2,18)); - - _internalNameField.setName("internalNameField"); - _internalNameField.setToolTipText(Messages.getString("internalNameTip")); - jpanel1.add(_internalNameField,cc.xywh(4,18,5,1)); - - _companyNameLabel.setName("companyNameLabel"); - _companyNameLabel.setText(Messages.getString("companyName")); - jpanel1.add(_companyNameLabel,cc.xy(2,16)); - - _companyNameField.setName("companyNameField"); - jpanel1.add(_companyNameField,cc.xywh(4,16,5,1)); - - _languageLabel.setName("languageLabel"); - _languageLabel.setText(Messages.getString("language")); - jpanel1.add(_languageLabel,cc.xy(2,24)); - - _languageCombo.setName("languageCombo"); - jpanel1.add(_languageCombo,cc.xywh(4,24,3,1)); - - _trademarksLabel.setName("trademarksLabel"); - _trademarksLabel.setText(Messages.getString("trademarks")); - jpanel1.add(_trademarksLabel,cc.xy(2,22)); - - _trademarksField.setName("trademarksField"); - jpanel1.add(_trademarksField,cc.xywh(4,22,5,1)); - - addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 }); - return jpanel1; - } - - /** - * Initializer - */ - protected void initializePanel() - { - setLayout(new BorderLayout()); - add(createPanel(), BorderLayout.CENTER); - } - - -} +package net.sf.launch4j.form; + +import com.jeta.forms.components.separator.TitledSeparator; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; + +import net.sf.launch4j.config.LanguageID; + +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.Box; +import javax.swing.ImageIcon; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; + + +public abstract class VersionInfoForm extends JPanel +{ + protected final JCheckBox _versionInfoCheck = new JCheckBox(); + protected final JLabel _fileVersionLabel = new JLabel(); + protected final JTextField _fileVersionField = new JTextField(); + protected final TitledSeparator _addVersionInfoSeparator = new TitledSeparator(); + protected final JLabel _productVersionLabel = new JLabel(); + protected final JTextField _productVersionField = new JTextField(); + protected final JLabel _fileDescriptionLabel = new JLabel(); + protected final JTextField _fileDescriptionField = new JTextField(); + protected final JLabel _copyrightLabel = new JLabel(); + protected final JTextField _copyrightField = new JTextField(); + protected final JLabel _txtFileVersionLabel = new JLabel(); + protected final JTextField _txtFileVersionField = new JTextField(); + protected final JLabel _txtProductVersionLabel = new JLabel(); + protected final JTextField _txtProductVersionField = new JTextField(); + protected final JLabel _productNameLabel = new JLabel(); + protected final JTextField _productNameField = new JTextField(); + protected final JLabel _originalFilenameLabel = new JLabel(); + protected final JTextField _originalFilenameField = new JTextField(); + protected final JLabel _internalNameLabel = new JLabel(); + protected final JTextField _internalNameField = new JTextField(); + protected final JLabel _companyNameLabel = new JLabel(); + protected final JTextField _companyNameField = new JTextField(); + protected final JLabel _languageLabel = new JLabel(); + protected final JComboBox _languageCombo = new JComboBox(); + protected final JLabel _trademarksLabel = new JLabel(); + protected final JTextField _trademarksField = new JTextField(); + + /** + * Default constructor + */ + public VersionInfoForm() + { + initializePanel(); + } + + /** + * Adds fill components to empty cells in the first row and first column of the grid. + * This ensures that the grid spacing will be the same as shown in the designer. + * @param cols an array of column indices in the first row where fill components should be added. + * @param rows an array of row indices in the first column where fill components should be added. + */ + void addFillComponents( Container panel, int[] cols, int[] rows ) + { + Dimension filler = new Dimension(10,10); + + boolean filled_cell_11 = false; + CellConstraints cc = new CellConstraints(); + if ( cols.length > 0 && rows.length > 0 ) + { + if ( cols[0] == 1 && rows[0] == 1 ) + { + /** add a rigid area */ + panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); + filled_cell_11 = true; + } + } + + for( int index = 0; index < cols.length; index++ ) + { + if ( cols[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); + } + + for( int index = 0; index < rows.length; index++ ) + { + if ( rows[index] == 1 && filled_cell_11 ) + { + continue; + } + panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); + } + + } + + /** + * Helper method to load an image file from the CLASSPATH + * @param imageName the package and name of the file to load relative to the CLASSPATH + * @return an ImageIcon instance with the specified image file + * @throws IllegalArgumentException if the image resource cannot be loaded. + */ + public ImageIcon loadImage( String imageName ) + { + try + { + ClassLoader classloader = getClass().getClassLoader(); + java.net.URL url = classloader.getResource( imageName ); + if ( url != null ) + { + ImageIcon icon = new ImageIcon( url ); + return icon; + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + throw new IllegalArgumentException( "Unable to load image: " + imageName ); + } + + public JPanel createPanel() + { + JPanel jpanel1 = new JPanel(); + FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:60DLU:NONE,FILL:7DLU:NONE,RIGHT:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE","CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:9DLU:NONE"); + CellConstraints cc = new CellConstraints(); + jpanel1.setLayout(formlayout1); + + _versionInfoCheck.setActionCommand("Add version information"); + _versionInfoCheck.setName("versionInfoCheck"); + _versionInfoCheck.setText(Messages.getString("addVersionInfo")); + jpanel1.add(_versionInfoCheck,cc.xywh(4,2,5,1)); + + _fileVersionLabel.setIcon(loadImage("images/asterix.gif")); + _fileVersionLabel.setName("fileVersionLabel"); + _fileVersionLabel.setText(Messages.getString("fileVersion")); + jpanel1.add(_fileVersionLabel,cc.xy(2,4)); + + _fileVersionField.setName("fileVersionField"); + _fileVersionField.setToolTipText(Messages.getString("fileVersionTip")); + jpanel1.add(_fileVersionField,cc.xy(4,4)); + + _addVersionInfoSeparator.setName("addVersionInfoSeparator"); + _addVersionInfoSeparator.setText("Additional information"); + jpanel1.add(_addVersionInfoSeparator,cc.xywh(2,10,7,1)); + + _productVersionLabel.setIcon(loadImage("images/asterix.gif")); + _productVersionLabel.setName("productVersionLabel"); + _productVersionLabel.setText(Messages.getString("productVersion")); + jpanel1.add(_productVersionLabel,cc.xy(2,12)); + + _productVersionField.setName("productVersionField"); + _productVersionField.setToolTipText(Messages.getString("productVersionTip")); + jpanel1.add(_productVersionField,cc.xy(4,12)); + + _fileDescriptionLabel.setIcon(loadImage("images/asterix.gif")); + _fileDescriptionLabel.setName("fileDescriptionLabel"); + _fileDescriptionLabel.setText(Messages.getString("fileDescription")); + jpanel1.add(_fileDescriptionLabel,cc.xy(2,6)); + + _fileDescriptionField.setName("fileDescriptionField"); + _fileDescriptionField.setToolTipText(Messages.getString("fileDescriptionTip")); + jpanel1.add(_fileDescriptionField,cc.xywh(4,6,5,1)); + + _copyrightLabel.setIcon(loadImage("images/asterix.gif")); + _copyrightLabel.setName("copyrightLabel"); + _copyrightLabel.setText(Messages.getString("copyright")); + jpanel1.add(_copyrightLabel,cc.xy(2,8)); + + _copyrightField.setName("copyrightField"); + jpanel1.add(_copyrightField,cc.xywh(4,8,5,1)); + + _txtFileVersionLabel.setIcon(loadImage("images/asterix.gif")); + _txtFileVersionLabel.setName("txtFileVersionLabel"); + _txtFileVersionLabel.setText(Messages.getString("txtFileVersion")); + jpanel1.add(_txtFileVersionLabel,cc.xy(6,4)); + + _txtFileVersionField.setName("txtFileVersionField"); + _txtFileVersionField.setToolTipText(Messages.getString("txtFileVersionTip")); + jpanel1.add(_txtFileVersionField,cc.xy(8,4)); + + _txtProductVersionLabel.setIcon(loadImage("images/asterix.gif")); + _txtProductVersionLabel.setName("txtProductVersionLabel"); + _txtProductVersionLabel.setText(Messages.getString("txtProductVersion")); + jpanel1.add(_txtProductVersionLabel,cc.xy(6,12)); + + _txtProductVersionField.setName("txtProductVersionField"); + _txtProductVersionField.setToolTipText(Messages.getString("txtProductVersionTip")); + jpanel1.add(_txtProductVersionField,cc.xy(8,12)); + + _productNameLabel.setIcon(loadImage("images/asterix.gif")); + _productNameLabel.setName("productNameLabel"); + _productNameLabel.setText(Messages.getString("productName")); + jpanel1.add(_productNameLabel,cc.xy(2,14)); + + _productNameField.setName("productNameField"); + jpanel1.add(_productNameField,cc.xywh(4,14,5,1)); + + _originalFilenameLabel.setIcon(loadImage("images/asterix.gif")); + _originalFilenameLabel.setName("originalFilenameLabel"); + _originalFilenameLabel.setText(Messages.getString("originalFilename")); + jpanel1.add(_originalFilenameLabel,cc.xy(2,20)); + + _originalFilenameField.setName("originalFilenameField"); + _originalFilenameField.setToolTipText(Messages.getString("originalFilenameTip")); + jpanel1.add(_originalFilenameField,cc.xywh(4,20,5,1)); + + _internalNameLabel.setIcon(loadImage("images/asterix.gif")); + _internalNameLabel.setName("internalNameLabel"); + _internalNameLabel.setText(Messages.getString("internalName")); + jpanel1.add(_internalNameLabel,cc.xy(2,18)); + + _internalNameField.setName("internalNameField"); + _internalNameField.setToolTipText(Messages.getString("internalNameTip")); + jpanel1.add(_internalNameField,cc.xywh(4,18,5,1)); + + _companyNameLabel.setName("companyNameLabel"); + _companyNameLabel.setText(Messages.getString("companyName")); + jpanel1.add(_companyNameLabel,cc.xy(2,16)); + + _companyNameField.setName("companyNameField"); + jpanel1.add(_companyNameField,cc.xywh(4,16,5,1)); + + _languageLabel.setName("languageLabel"); + _languageLabel.setText(Messages.getString("language")); + jpanel1.add(_languageLabel,cc.xy(2,24)); + + _languageCombo.setName("languageCombo"); + jpanel1.add(_languageCombo,cc.xywh(4,24,3,1)); + + _trademarksLabel.setName("trademarksLabel"); + _trademarksLabel.setText(Messages.getString("trademarks")); + jpanel1.add(_trademarksLabel,cc.xy(2,22)); + + _trademarksField.setName("trademarksField"); + jpanel1.add(_trademarksField,cc.xywh(4,22,5,1)); + + addFillComponents(jpanel1,new int[]{ 1,2,3,4,5,6,7,8,9 },new int[]{ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 }); + return jpanel1; + } + + /** + * Initializer + */ + protected void initializePanel() + { + setLayout(new BorderLayout()); + add(createPanel(), BorderLayout.CENTER); + } + + +} diff --git a/launch4j/src/net/sf/launch4j/form/messages.properties b/launch4j/src/net/sf/launch4j/form/messages.properties index b50c32b..32caff3 100644 --- a/launch4j/src/net/sf/launch4j/form/messages.properties +++ b/launch4j/src/net/sf/launch4j/form/messages.properties @@ -1,161 +1,159 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2015 Grzegorz Kowal -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -log=Log - -outfile=Output file: -outfileTip=Output executable file. -stayAlive=Stay alive after launching a GUI application -restartOnCrash=Restart the application after a crash -restartOnCrashToolTip=When the application exits, any exit code other than 0 is considered a crash and the application will be started again -manifest=Wrapper manifest: -manifestTip=Wrapper manifest for User Account Control. -icon=Icon: -iconTip=Application icon. -jar=Jar: -jarTip=Application jar. -dontWrapJar=Dont't wrap the jar, launch only -cmdLine=Command line args: -cmdLineTip=Constant command line arguments passed to the application. -options=Options: -chdir=Change dir: -chdirTip=Change current directory to a location relative to the executable. Empty field has no effect, . - changes directory to the exe location. -priority=Process priority: -normalPriority=Normal -idlePriority=Idle -highPriority=High -downloadAndSupport=Java download and support -errorTitle=Error title: -errorTitleTip=Launch4j signals errors using a message box, you can set it's title to the application's name. -downloadUrl=Java download URL: -supportUrl=Support URL: - -new=New -accept=Accept -remove=Remove -customClassPath=Custom classpath -classPath=Classpath: -mainClass=Main class: -editClassPath=Edit item: -importClassPath=Import attributes from a jar's manifest. - -headerType=Header type: -gui=GUI -guiTooltip=Stable version of the GUI header which uses the javaw.exe launcher. -console=Console -consoleTooltip=Stable version of the console header which uses the java.exe launcher. -jniGui=JNI GUI (beta) -jniGuiTooltip=BETA version of the GUI header which launches the Java VM through JNI. -jniConsole=JNI Console (beta) -jniConsoleTooltip=BETA version of the console header which launches the Java VM through JNI. -objectFiles=Object files: -libs=w32api: -linkerOptions=Custom header - linker options - -enableSingleInstance=Allow only a single instance of the application -mutexName=Mutex name -mutexNameTip=Mutex name that will uniquely identify your application. -windowTitle=Window title -windowTitleTip=Title of the GUI application window to bring up on attempt to start a next instance. - -jrePath=Bundled JRE path: -jrePathTip=Bundled JRE path relative to the executable or absolute. -bundledJre64Bit=64-bit -bundledJre64BitTip=The bundled JRE is 64-bit, heap size will not be limited to the 32-bit maximum. -bundledJreAsFallback=Fallback option -bundledJreAsFallbackTip=When the fallback option is checked, the bundled JRE will be used only if the min/max search fails. By default the bundled JRE, if specified, is used as first. -searchOptions=Search options -options=Options -jreMin=Min JRE version: -jreMax=Max JRE version: -dontUsePrivateJres=Don't use private JREs -jvmOptions=JVM options: -jvmOptionsTip=Accepts everything you would normally pass to java/javaw launcher: assertion options, system properties and X options. -initialHeapSize=Initial heap size: -maxHeapSize=Max heap size: -availableMemory=% of available memory -addVariables=Add variables: -addVariablesTip=Add special variable or map environment variables to system properties. -exeDirVarTip=Executable's runtime directory path. -exeFileVarTip=Executable's runtime file path (directory and filename). -varsAndRegistry=Variables / registry: -envVar=Environment var: -property=Property -propertyTip=Map a variable to a system property. -option=Option -optionTip=Pass a JVM option using a variable. - -setVariables=Set variables: - -enableSplash=Enable splash screen -splashFile=Splash file: -splashFileTip=Splash screen file in BMP format. -waitForWindow=Wait for window -waitForWindowText=Close splash screen when an application window appears -timeout=Timeout [s]: -timeoutTip=Number of seconds after which the splash screen must close. Splash timeout may cause an error depending on splashTimeoutErr property. -timeoutErr=Signal error on timeout -timeoutErrTip=True signals an error on splash timeout, false closes the splash screen quietly. - -version=Version -additionalInfo=Additional information -addVersionInfo=Add version information -fileVersion=File version: -fileVersionTip=Version number 'x.x.x.x' -productVersion=Product version: -productVersionTip=Version number 'x.x.x.x' -fileDescription=File description: -fileDescriptionTip=File description presented to the user. -copyright=Copyright: -txtFileVersion=Free form: -txtFileVersionTip=Free form file version, for example '1.20.RC1'. -txtProductVersion=Free form: -txtProductVersionTip=Free form product version, for example '1.20.RC1'. -productName=Product name: -originalFilename=Original filename: -originalFilenameTip=Original name of the file without the path. Allows to determine whether a file has been renamed by a user. -internalName=Internal name: -internalNameTip=Internal name without extension, original filename or module name for example. -companyName=Company name: -trademarks=Trademarks: -language=Language: -charset=Charset: - -addMessages=Add custom messages -startupErr=Startup error: -bundledJreErr=Bundled JRE error: -jreVersionErr=JRE version error: -jreVersionErrTip=Launch4j will append the required version number at the end of this message. -launcherErr=Launcher error: -instanceAlreadyExistsMsg=Inst. already exists: -instanceAlreadyExistsMsgTip=Message displayed by single instance console applications if an instance already exists. +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2015 Grzegorz Kowal +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +log=Log + +outfile=Output file: +outfileTip=Output executable file. +stayAlive=Stay alive after launching a GUI application +restartOnCrash=Restart the application after a crash +restartOnCrashToolTip=When the application exits, any exit code other than 0 is considered a crash and the application will be started again +manifest=Wrapper manifest: +manifestTip=Wrapper manifest for User Account Control. +icon=Icon: +iconTip=Application icon. +jar=Jar: +jarTip=Application jar. +dontWrapJar=Dont't wrap the jar, launch only +cmdLine=Command line args: +cmdLineTip=Constant command line arguments passed to the application. +options=Options: +chdir=Change dir: +chdirTip=Change current directory to a location relative to the executable. Empty field has no effect, . - changes directory to the exe location. +priority=Process priority: +normalPriority=Normal +idlePriority=Idle +highPriority=High +downloadAndSupport=Java download and support +errorTitle=Error title: +errorTitleTip=Launch4j signals errors using a message box, you can set it's title to the application's name. +downloadUrl=Java download URL: +supportUrl=Support URL: + +new=New +accept=Accept +remove=Remove +customClassPath=Custom classpath +classPath=Classpath: +mainClass=Main class: +editClassPath=Edit item: +importClassPath=Import attributes from a jar's manifest. + +headerType=Header type: +gui=GUI +guiTooltip=Stable version of the GUI header which uses the javaw.exe launcher. +console=Console +consoleTooltip=Stable version of the console header which uses the java.exe launcher. +jniGui=JNI GUI (beta) +jniGuiTooltip=BETA version of the GUI header which launches the Java VM through JNI. +jniConsole=JNI Console (beta) +jniConsoleTooltip=BETA version of the console header which launches the Java VM through JNI. +objectFiles=Object files: +libs=w32api: +linkerOptions=Custom header - linker options + +enableSingleInstance=Allow only a single instance of the application +mutexName=Mutex name +mutexNameTip=Mutex name that will uniquely identify your application. +windowTitle=Window title +windowTitleTip=Title of the GUI application window to bring up on attempt to start a next instance. + +jrePath=JRE paths: +jrePathTip=JRE path(s) relative to the executable or absolute, for example 'myAppJre' or 'c:\\GlobalJre;%JAVA_HOME%'. +requiresJdk=JDK required +requires64Bit=64-Bit required +requires64BitTip=64-bit runtime is required so that the heap size will not be limited to the 32-bit maximum. +searchOptions=Search options +options=Options +jreMin=Min JRE version: +jreMax=Max JRE version: +jvmOptions=JVM options: +jvmOptionsTip=Accepts everything you would normally pass to java/javaw launcher: assertion options, system properties and X options. +initialHeapSize=Initial heap size: +maxHeapSize=Max heap size: +availableMemory=% of available memory +addVariables=Add variables: +addVariablesTip=Add special variable or map environment variables to system properties. +exeDirVarTip=Executable's runtime directory path. +exeFileVarTip=Executable's runtime file path (directory and filename). +varsAndRegistry=Variables / registry: +envVar=Environment var: +property=Property +propertyTip=Map a variable to a system property. +option=Option +optionTip=Pass a JVM option using a variable. + +setVariables=Set variables: + +enableSplash=Enable splash screen +splashFile=Splash file: +splashFileTip=Splash screen file in BMP format. +waitForWindow=Wait for window +waitForWindowText=Close splash screen when an application window appears +timeout=Timeout [s]: +timeoutTip=Number of seconds after which the splash screen must close. Splash timeout may cause an error depending on splashTimeoutErr property. +timeoutErr=Signal error on timeout +timeoutErrTip=True signals an error on splash timeout, false closes the splash screen quietly. + +version=Version +additionalInfo=Additional information +addVersionInfo=Add version information +fileVersion=File version: +fileVersionTip=Version number 'x.x.x.x' +productVersion=Product version: +productVersionTip=Version number 'x.x.x.x' +fileDescription=File description: +fileDescriptionTip=File description presented to the user. +copyright=Copyright: +txtFileVersion=Free form: +txtFileVersionTip=Free form file version, for example '1.20.RC1'. +txtProductVersion=Free form: +txtProductVersionTip=Free form product version, for example '1.20.RC1'. +productName=Product name: +originalFilename=Original filename: +originalFilenameTip=Original name of the file without the path. Allows to determine whether a file has been renamed by a user. +internalName=Internal name: +internalNameTip=Internal name without extension, original filename or module name for example. +companyName=Company name: +trademarks=Trademarks: +language=Language: +charset=Charset: + +addMessages=Add custom messages +startupErr=Startup error: +jreNotFoundErr=JRE error: +jreVersionErr=JRE version error: +jreVersionErrTip=Launch4j will append the required version number at the end of this message. +launcherErr=Launcher error: +instanceAlreadyExistsMsg=Inst. already exists: +instanceAlreadyExistsMsgTip=Message displayed by single instance console applications if an instance already exists. diff --git a/launch4j/src/net/sf/launch4j/form/messages_es.properties b/launch4j/src/net/sf/launch4j/form/messages_es.properties deleted file mode 100644 index fa77e0f..0000000 --- a/launch4j/src/net/sf/launch4j/form/messages_es.properties +++ /dev/null @@ -1,117 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -log = Registro - -outfile = Fichero de salida -outfileTip = Fichero ejecutable de salida. -errorTitle = T\u00EDtulo de error -errorTitleTip = Launch4j indica los errores usando una ventana de mensaje, usted puede ponerle el nombre de la aplicaci\u00F3n a esta ventana. -stayAlive = Mantener abierto despu\u00E9s de lanzar una aplicaci\u00F3n GUI -icon = Icono -iconTip = Icono de la aplicaci\u00F3n. -jar = Jar -jarTip = Jar de la aplicaci\u00F3n. -dontWrapJar = No empaquetar el jar, s\u00F3lo lanzar -cmdLine = Argumentos del jar -cmdLine = Argumentos de l\u00EDnea de \u00F3rdenes pasados a la aplicaci\u00F3n. -options = Opciones -chdir = Cambiar al directorio -chdirTip = Cambia el directorio actual a la localizaci\u00F3n relativa al ejecutable. Si el campo se deja vac\u00EDo, no tiene efecto, . - cambia el directorio a la localizaci\u00F3n del exe. -headerType = Tipo de cabecera -gui = GUI -console = Consola -objectFiles = Ficheros objeto -libs = w32api -linkerOptions = Cabecera personalizada - opciones del enlazador -jrePath = Ruta del JRE -jrePathTip = Ruta relativa al ejecutable del JRE. -jreMin = Versi\u00F3n m\u00EDnima del JRE -jreMax = Versi\u00F3n m\u00E1xima del JRE -jvmOptions = Argumentos de la JVM -jvmOptionsTip = Acepta cualquier argumento que normalmente se le pasar\u00EDa al lanzador java/javaw\: opciones assertion, propiedades de sistema y opciones X. -initialHeapSize = Tama\u00F1o inicial de la pila -maxHeapSize = Tama\u00F1o m\u00E1ximo de la pila -freeMemory=% of free memory -addVariables = A\u00F1adir variables -addVariablesTip = A\u00F1adir una variable especial o mapear variables de entorno a las propiedades del sistema. -exeDirVarTip = Ruta del directorio del ejecutable. -exeFileVarTip = Ruta del fichero ejecutable (directorio y nombre del fichero). -other = Otra -otherTip = Mapear una variable de entorno a una propiedad del sistema. -otherVarTip = Variable de entorno que mapear. -add = A\u00F1adir -specifyVar = Especificar variable de entorno que a\u00F1adir. -enableSplash = Activar pantalla de bienvenida -splashFile = Imagen -splashFileTip = Imagen en formato BMP para la pantalla de bienvenida. -waitForWindow = Esperar la ventana -waitForWindowText = Cerrar la pantalla de bienvenida cuando aparezca una ventana de la aplicaci\u00F3n -timeout = Tiempo de espera [s] -timeoutTip = Numero de segundos despu\u00E9s de los que la pantalla de bienvenida se debe cerrar. Esta propiedad puede causar provocar un error dependiendo de la propiedad splashTimeoutErr. -timeoutErr = Se\u00F1al de error asociada al tiempo de espera -timeoutErrTip = Marcado (true) se\u00F1ala un error despu\u00E9s del tiempo de espera de la pantalla de bienvenida, no marcado (false) cierra la pantalla de bienvenida silenciosamente -addVersionInfo = A\u00F1ade informaci\u00F3n sobre la versi\u00F3n -fileVersion = Versi\u00F3n del fichero -fileVersionTip = N\u00FAmero de versi\u00F3n 'x.x.x.x' -additionalInfo = Informaci\u00F3n adicional -productVersion = Versi\u00F3n del producto -productVersionTip = N\u00FAmero de versi\u00F3n 'x.x.x.x' -fileDescription = Descripci\u00F3n del fichero -fileDescriptionTip = Descripci\u00F3n del fichero que se le muestra al usuario. -copyright = Copyright -txtFileVersion = Forma libre -txtFileVersionTip = Forma libre de versi\u00F3n, por ejemplo '1.20.RC1'. -txtProductVersion = Forma libre -txtProductVersionTip = Forma libre del producto, por ejemplo '1.20.RC1'. -productName = Nombre del producto -originalFilename = Nombre original del fichero -originalFilenameTip = Nombre original del fichero sin la ruta. Permite determinar si un fichero ha sido renombrado por un usuario. -internalName = Nombre interno -internalNameTip = Nombre interno sin extensi\u00F3n, el nombre original del fichero o el m\u00F3dulo, por ejemplo. -companyName = Nombre de la organizaci\u00F3n - -addMessages=Add custom messages -startupErr=Startup error: -bundledJreErr=Bundled JRE error: -jreVersionErr=JRE version error: -jreVersionErrTip=Launch4j will append the required version number at the end of this message. -launcherErr=Launcher error: -instanceAlreadyExistsMsg=Inst. already exists: -instanceAlreadyExistsMsgTip=Message displayed by single instance console applications if an instance already exists. - -enableSingleInstance=Allow only a single instance of the application -mutexName=Mutex name -mutexNameTip=Mutex name that will uniquely identify your application. -windowTitle=Window title -windowTitleTip=Title of the application window to bring up on attempt to start a next instance. diff --git a/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java b/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java index cbf69d1..5e31593 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java +++ b/launch4j/src/net/sf/launch4j/formimpl/AbstractAcceptListener.java @@ -1,75 +1,75 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.Color; -import java.awt.event.ActionListener; - -import javax.swing.JTextField; - -import net.sf.launch4j.binding.Binding; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public abstract class AbstractAcceptListener implements ActionListener { - final JTextField _field; - - public AbstractAcceptListener(JTextField f, boolean listen) { - _field = f; - if (listen) { - _field.addActionListener(this); - } - } - - protected String getText() { - return _field.getText(); - } - - protected void clear() { - _field.setText(""); - _field.requestFocusInWindow(); - } - - protected void signalViolation(String msg) { - final Color bg = _field.getBackground(); - _field.setBackground(Binding.INVALID_COLOR); - MainFrame.getInstance().warn(msg); - _field.setBackground(bg); - _field.requestFocusInWindow(); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.Color; +import java.awt.event.ActionListener; + +import javax.swing.JTextField; + +import net.sf.launch4j.binding.Binding; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public abstract class AbstractAcceptListener implements ActionListener { + final JTextField _field; + + public AbstractAcceptListener(JTextField f, boolean listen) { + _field = f; + if (listen) { + _field.addActionListener(this); + } + } + + protected String getText() { + return _field.getText(); + } + + protected void clear() { + _field.setText(""); + _field.requestFocusInWindow(); + } + + protected void signalViolation(String msg) { + final Color bg = _field.getBackground(); + _field.setBackground(Binding.INVALID_COLOR); + MainFrame.getInstance().warn(msg); + _field.setBackground(bg); + _field.requestFocusInWindow(); + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java index 6488aaf..866cecc 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/BasicFormImpl.java @@ -1,101 +1,100 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import javax.swing.JFileChooser; -import javax.swing.JRadioButton; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import net.sf.launch4j.FileChooserFilter; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.form.BasicForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class BasicFormImpl extends BasicForm { - - public BasicFormImpl(Bindings bindings, JFileChooser fc) { - bindings.add("outfile", _outfileField) - .add("dontWrapJar", _dontWrapJarCheck) - .add("jar", _jarField) - .add("manifest", _manifestField) - .add("icon", _iconField) - .add("cmdLine", _cmdLineField) - .add("errTitle", _errorTitleField) - .add("downloadUrl", _downloadUrlField, Config.DOWNLOAD_URL) - .add("supportUrl", _supportUrlField) - .add("chdir", _chdirField, ".") - .add("priorityIndex", new JRadioButton[] { _normalPriorityRadio, - _idlePriorityRadio, - _highPriorityRadio }) - .add("stayAlive", _stayAliveCheck) - .add("restartOnCrash", _restartOnCrashCheck); - - _dontWrapJarCheck.addChangeListener(new DontWrapJarChangeListener()); - - _outfileButton.addActionListener(new BrowseActionListener(true, fc, - new FileChooserFilter("Windows executables (.exe)", ".exe"), - _outfileField)); - _jarButton.addActionListener(new BrowseActionListener(false, fc, - new FileChooserFilter("Jar files", ".jar"), _jarField)); - _manifestButton.addActionListener(new BrowseActionListener(false, fc, - new FileChooserFilter("Manifest files (.manifest)", ".manifest"), - _manifestField)); - _iconButton.addActionListener(new BrowseActionListener(false, fc, - new FileChooserFilter("Icon files (.ico)", ".ico"), _iconField)); - } - - private class DontWrapJarChangeListener implements ChangeListener { - - public void stateChanged(ChangeEvent e) { - boolean dontWrap = _dontWrapJarCheck.isSelected(); - if (dontWrap) { - _jarLabel.setIcon(loadImage("images/asterix-o.gif")); - _jarLabel.setText(Messages.getString("jarPath")); - _jarField.setToolTipText(Messages.getString("jarPathTip")); - } else { - _jarLabel.setIcon(loadImage("images/asterix.gif")); - _jarLabel.setText(Messages.getString("jar")); - _jarField.setToolTipText(Messages.getString("jarTip")); - } - _jarButton.setEnabled(!dontWrap); - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import javax.swing.JFileChooser; +import javax.swing.JRadioButton; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +import net.sf.launch4j.FileChooserFilter; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.form.BasicForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class BasicFormImpl extends BasicForm { + + public BasicFormImpl(Bindings bindings, JFileChooser fc) { + bindings.add("outfile", _outfileField) + .add("dontWrapJar", _dontWrapJarCheck) + .add("jar", _jarField) + .add("manifest", _manifestField) + .add("icon", _iconField) + .add("cmdLine", _cmdLineField) + .add("errTitle", _errorTitleField) + .add("downloadUrl", _downloadUrlField) + .add("supportUrl", _supportUrlField) + .add("chdir", _chdirField, ".") + .add("priorityIndex", new JRadioButton[] { _normalPriorityRadio, + _idlePriorityRadio, + _highPriorityRadio }) + .add("stayAlive", _stayAliveCheck) + .add("restartOnCrash", _restartOnCrashCheck); + + _dontWrapJarCheck.addChangeListener(new DontWrapJarChangeListener()); + + _outfileButton.addActionListener(new BrowseActionListener(true, fc, + new FileChooserFilter("Windows executables (.exe)", ".exe"), + _outfileField)); + _jarButton.addActionListener(new BrowseActionListener(false, fc, + new FileChooserFilter("Jar files", ".jar"), _jarField)); + _manifestButton.addActionListener(new BrowseActionListener(false, fc, + new FileChooserFilter("Manifest files (.manifest)", ".manifest"), + _manifestField)); + _iconButton.addActionListener(new BrowseActionListener(false, fc, + new FileChooserFilter("Icon files (.ico)", ".ico"), _iconField)); + } + + private class DontWrapJarChangeListener implements ChangeListener { + + public void stateChanged(ChangeEvent e) { + boolean dontWrap = _dontWrapJarCheck.isSelected(); + if (dontWrap) { + _jarLabel.setIcon(loadImage("images/asterix-o.gif")); + _jarLabel.setText(Messages.getString("jarPath")); + _jarField.setToolTipText(Messages.getString("jarPathTip")); + } else { + _jarLabel.setIcon(loadImage("images/asterix.gif")); + _jarLabel.setText(Messages.getString("jar")); + _jarField.setToolTipText(Messages.getString("jarTip")); + } + _jarButton.setEnabled(!dontWrap); + } + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java b/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java index 103e954..8404c5c 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java +++ b/launch4j/src/net/sf/launch4j/formimpl/BrowseActionListener.java @@ -1,79 +1,79 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; - -import javax.swing.JFileChooser; -import javax.swing.JTextField; - -import net.sf.launch4j.FileChooserFilter; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class BrowseActionListener implements ActionListener { - private final boolean _save; - private final JFileChooser _fileChooser; - private final FileChooserFilter _filter; - private final JTextField _field; - - public BrowseActionListener(boolean save, JFileChooser fileChooser, - FileChooserFilter filter, JTextField field) { - _save = save; - _fileChooser = fileChooser; - _filter = filter; - _field = field; - } - - public void actionPerformed(ActionEvent e) { - if (!_field.isEnabled()) { - return; - } - _fileChooser.setFileFilter(_filter); - _fileChooser.setSelectedFile(new File("")); - int result = _save - ? _fileChooser.showSaveDialog(MainFrame.getInstance()) - : _fileChooser.showOpenDialog(MainFrame.getInstance()); - if (result == JFileChooser.APPROVE_OPTION) { - _field.setText(_fileChooser.getSelectedFile().getPath()); - } - _fileChooser.removeChoosableFileFilter(_filter); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; + +import javax.swing.JFileChooser; +import javax.swing.JTextField; + +import net.sf.launch4j.FileChooserFilter; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class BrowseActionListener implements ActionListener { + private final boolean _save; + private final JFileChooser _fileChooser; + private final FileChooserFilter _filter; + private final JTextField _field; + + public BrowseActionListener(boolean save, JFileChooser fileChooser, + FileChooserFilter filter, JTextField field) { + _save = save; + _fileChooser = fileChooser; + _filter = filter; + _field = field; + } + + public void actionPerformed(ActionEvent e) { + if (!_field.isEnabled()) { + return; + } + _fileChooser.setFileFilter(_filter); + _fileChooser.setSelectedFile(new File("")); + int result = _save + ? _fileChooser.showSaveDialog(MainFrame.getInstance()) + : _fileChooser.showOpenDialog(MainFrame.getInstance()); + if (result == JFileChooser.APPROVE_OPTION) { + _field.setText(_fileChooser.getSelectedFile().getPath()); + } + _fileChooser.removeChoosableFileFilter(_filter); + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java index 79c5074..005a9d9 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/ClassPathFormImpl.java @@ -1,222 +1,222 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.IOException; -import java.util.jar.Attributes; -import java.util.jar.JarFile; - -import javax.swing.DefaultListModel; -import javax.swing.JFileChooser; -import javax.swing.JTextField; -import javax.swing.ListSelectionModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -import net.sf.launch4j.FileChooserFilter; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.binding.Validator; -import net.sf.launch4j.config.ClassPath; -import net.sf.launch4j.form.ClassPathForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class ClassPathFormImpl extends ClassPathForm { - private final JFileChooser _fileChooser; - private final FileChooserFilter _filter - = new FileChooserFilter("Executable jar", ".jar"); - - public ClassPathFormImpl(Bindings bindings, JFileChooser fc) { - bindings.addOptComponent("classPath", ClassPath.class, _classpathCheck) - .add("classPath.mainClass", _mainclassField) - .add("classPath.paths", _classpathList); - _fileChooser = fc; - - ClasspathCheckListener cpl = new ClasspathCheckListener(); - _classpathCheck.addChangeListener(cpl); - cpl.stateChanged(null); - - _classpathList.setModel(new DefaultListModel()); - _classpathList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); - _classpathList.addListSelectionListener(new ClasspathSelectionListener()); - - _newClasspathButton.addActionListener(new NewClasspathListener()); - _acceptClasspathButton.addActionListener( - new AcceptClasspathListener(_classpathField)); - _removeClasspathButton.addActionListener(new RemoveClasspathListener()); - _importClasspathButton.addActionListener(new ImportClasspathListener()); - _classpathUpButton.addActionListener(new MoveUpListener()); - _classpathDownButton.addActionListener(new MoveDownListener()); - } - - private class ClasspathCheckListener implements ChangeListener { - public void stateChanged(ChangeEvent e) { - boolean on = _classpathCheck.isSelected(); - _importClasspathButton.setEnabled(on); - _classpathUpButton.setEnabled(on); - _classpathDownButton.setEnabled(on); - _classpathField.setEnabled(on); - _newClasspathButton.setEnabled(on); - _acceptClasspathButton.setEnabled(on); - _removeClasspathButton.setEnabled(on); - } - } - - private class NewClasspathListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - _classpathList.clearSelection(); - _classpathField.setText(""); - _classpathField.requestFocusInWindow(); - } - } - - private class AcceptClasspathListener extends AbstractAcceptListener { - public AcceptClasspathListener(JTextField f) { - super(f, true); - } - - public void actionPerformed(ActionEvent e) { - String cp = getText(); - if (Validator.isEmpty(cp)) { - signalViolation(Messages.getString("specifyClassPath")); - return; - } - DefaultListModel model = (DefaultListModel) _classpathList.getModel(); - if (_classpathList.isSelectionEmpty()) { - model.addElement(cp); - clear(); - } else { - model.setElementAt(cp, _classpathList.getSelectedIndex()); - } - } - } - - private class ClasspathSelectionListener implements ListSelectionListener { - public void valueChanged(ListSelectionEvent e) { - if (e.getValueIsAdjusting()) { - return; - } - if (_classpathList.isSelectionEmpty()) { - _classpathField.setText(""); - } else { - _classpathField.setText((String) _classpathList.getSelectedValue()); - } - _classpathField.requestFocusInWindow(); - } - } - - private class RemoveClasspathListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (_classpathList.isSelectionEmpty() - || !MainFrame.getInstance().confirm( - Messages.getString("confirmClassPathRemoval"))) { - return; - } - DefaultListModel model = (DefaultListModel) _classpathList.getModel(); - while (!_classpathList.isSelectionEmpty()) { - model.remove(_classpathList.getSelectedIndex()); - } - } - } - - private class MoveUpListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - int x = _classpathList.getSelectedIndex(); - if (x < 1) { - return; - } - DefaultListModel model = (DefaultListModel) _classpathList.getModel(); - Object o = model.get(x - 1); - model.set(x - 1, model.get(x)); - model.set(x, o); - _classpathList.setSelectedIndex(x - 1); - } - } - - private class MoveDownListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - DefaultListModel model = (DefaultListModel) _classpathList.getModel(); - int x = _classpathList.getSelectedIndex(); - if (x == -1 || x >= model.getSize() - 1) { - return; - } - Object o = model.get(x + 1); - model.set(x + 1, model.get(x)); - model.set(x, o); - _classpathList.setSelectedIndex(x + 1); - } - } - - private class ImportClasspathListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - try { - _fileChooser.setFileFilter(_filter); - _fileChooser.setSelectedFile(new File("")); - if (_fileChooser.showOpenDialog(MainFrame.getInstance()) - == JFileChooser.APPROVE_OPTION) { - JarFile jar = new JarFile(_fileChooser.getSelectedFile()); - if (jar.getManifest() == null) { - jar.close(); - MainFrame.getInstance().info(Messages.getString("noManifest")); - return; - } - Attributes attr = jar.getManifest().getMainAttributes(); - String mainClass = (String) attr.getValue("Main-Class"); - String classPath = (String) attr.getValue("Class-Path"); - jar.close(); - _mainclassField.setText(mainClass != null ? mainClass : ""); - DefaultListModel model = new DefaultListModel(); - if (classPath != null) { - String[] paths = classPath.split(" "); - for (int i = 0; i < paths.length; i++) { - model.addElement(paths[i]); - } - } - _classpathList.setModel(model); - } - } catch (IOException ex) { - MainFrame.getInstance().warn(ex.getMessage()); - } - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.IOException; +import java.util.jar.Attributes; +import java.util.jar.JarFile; + +import javax.swing.DefaultListModel; +import javax.swing.JFileChooser; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import net.sf.launch4j.FileChooserFilter; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.binding.Validator; +import net.sf.launch4j.config.ClassPath; +import net.sf.launch4j.form.ClassPathForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class ClassPathFormImpl extends ClassPathForm { + private final JFileChooser _fileChooser; + private final FileChooserFilter _filter + = new FileChooserFilter("Executable jar", ".jar"); + + public ClassPathFormImpl(Bindings bindings, JFileChooser fc) { + bindings.addOptComponent("classPath", ClassPath.class, _classpathCheck) + .add("classPath.mainClass", _mainclassField) + .add("classPath.paths", _classpathList); + _fileChooser = fc; + + ClasspathCheckListener cpl = new ClasspathCheckListener(); + _classpathCheck.addChangeListener(cpl); + cpl.stateChanged(null); + + _classpathList.setModel(new DefaultListModel()); + _classpathList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + _classpathList.addListSelectionListener(new ClasspathSelectionListener()); + + _newClasspathButton.addActionListener(new NewClasspathListener()); + _acceptClasspathButton.addActionListener( + new AcceptClasspathListener(_classpathField)); + _removeClasspathButton.addActionListener(new RemoveClasspathListener()); + _importClasspathButton.addActionListener(new ImportClasspathListener()); + _classpathUpButton.addActionListener(new MoveUpListener()); + _classpathDownButton.addActionListener(new MoveDownListener()); + } + + private class ClasspathCheckListener implements ChangeListener { + public void stateChanged(ChangeEvent e) { + boolean on = _classpathCheck.isSelected(); + _importClasspathButton.setEnabled(on); + _classpathUpButton.setEnabled(on); + _classpathDownButton.setEnabled(on); + _classpathField.setEnabled(on); + _newClasspathButton.setEnabled(on); + _acceptClasspathButton.setEnabled(on); + _removeClasspathButton.setEnabled(on); + } + } + + private class NewClasspathListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + _classpathList.clearSelection(); + _classpathField.setText(""); + _classpathField.requestFocusInWindow(); + } + } + + private class AcceptClasspathListener extends AbstractAcceptListener { + public AcceptClasspathListener(JTextField f) { + super(f, true); + } + + public void actionPerformed(ActionEvent e) { + String cp = getText(); + if (Validator.isEmpty(cp)) { + signalViolation(Messages.getString("specifyClassPath")); + return; + } + DefaultListModel model = (DefaultListModel) _classpathList.getModel(); + if (_classpathList.isSelectionEmpty()) { + model.addElement(cp); + clear(); + } else { + model.setElementAt(cp, _classpathList.getSelectedIndex()); + } + } + } + + private class ClasspathSelectionListener implements ListSelectionListener { + public void valueChanged(ListSelectionEvent e) { + if (e.getValueIsAdjusting()) { + return; + } + if (_classpathList.isSelectionEmpty()) { + _classpathField.setText(""); + } else { + _classpathField.setText((String) _classpathList.getSelectedValue()); + } + _classpathField.requestFocusInWindow(); + } + } + + private class RemoveClasspathListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + if (_classpathList.isSelectionEmpty() + || !MainFrame.getInstance().confirm( + Messages.getString("confirmClassPathRemoval"))) { + return; + } + DefaultListModel model = (DefaultListModel) _classpathList.getModel(); + while (!_classpathList.isSelectionEmpty()) { + model.remove(_classpathList.getSelectedIndex()); + } + } + } + + private class MoveUpListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + int x = _classpathList.getSelectedIndex(); + if (x < 1) { + return; + } + DefaultListModel model = (DefaultListModel) _classpathList.getModel(); + String s = model.get(x - 1); + model.set(x - 1, model.get(x)); + model.set(x, s); + _classpathList.setSelectedIndex(x - 1); + } + } + + private class MoveDownListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + DefaultListModel model = (DefaultListModel) _classpathList.getModel(); + int x = _classpathList.getSelectedIndex(); + if (x == -1 || x >= model.getSize() - 1) { + return; + } + String s = model.get(x + 1); + model.set(x + 1, model.get(x)); + model.set(x, s); + _classpathList.setSelectedIndex(x + 1); + } + } + + private class ImportClasspathListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + try { + _fileChooser.setFileFilter(_filter); + _fileChooser.setSelectedFile(new File("")); + if (_fileChooser.showOpenDialog(MainFrame.getInstance()) + == JFileChooser.APPROVE_OPTION) { + JarFile jar = new JarFile(_fileChooser.getSelectedFile()); + if (jar.getManifest() == null) { + jar.close(); + MainFrame.getInstance().info(Messages.getString("noManifest")); + return; + } + Attributes attr = jar.getManifest().getMainAttributes(); + String mainClass = (String) attr.getValue("Main-Class"); + String classPath = (String) attr.getValue("Class-Path"); + jar.close(); + _mainclassField.setText(mainClass != null ? mainClass : ""); + DefaultListModel model = new DefaultListModel(); + if (classPath != null) { + String[] paths = classPath.split(" "); + for (int i = 0; i < paths.length; i++) { + model.addElement(paths[i]); + } + } + _classpathList.setModel(model); + } + } catch (IOException ex) { + MainFrame.getInstance().warn(ex.getMessage()); + } + } + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java index f028d98..5e905ba 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/ConfigFormImpl.java @@ -1,100 +1,100 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 10, 2005 - */ -package net.sf.launch4j.formimpl; - -import javax.swing.BorderFactory; -import javax.swing.JFileChooser; -import javax.swing.JTextArea; - -import net.sf.launch4j.binding.Binding; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.binding.IValidatable; -import net.sf.launch4j.form.ConfigForm; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class ConfigFormImpl extends ConfigForm { - private final Bindings _bindings = new Bindings(); - private final JFileChooser _fileChooser = new FileChooser(ConfigFormImpl.class); - - public ConfigFormImpl() { - _tab.setBorder(BorderFactory.createMatteBorder(0, -1, -1, -1, getBackground())); - _tab.addTab(Messages.getString("tab.basic"), - new BasicFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.classpath"), - new ClassPathFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.header"), - new HeaderFormImpl(_bindings)); - _tab.addTab(Messages.getString("tab.singleInstance"), - new SingleInstanceFormImpl(_bindings)); - _tab.addTab(Messages.getString("tab.jre"), - new JreFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.envVars"), - new EnvironmentVarsFormImpl(_bindings)); - _tab.addTab(Messages.getString("tab.splash"), - new SplashFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.version"), - new VersionInfoFormImpl(_bindings, _fileChooser)); - _tab.addTab(Messages.getString("tab.messages"), - new MessagesFormImpl(_bindings)); - } - - public void clear(IValidatable bean) { - _bindings.clear(bean); - } - - public void put(IValidatable bean) { - _bindings.put(bean); - } - - public void get(IValidatable bean) { - _bindings.get(bean); - } - - public boolean isModified() { - return _bindings.isModified(); - } - - public JTextArea getLogTextArea() { - return _logTextArea; - } - - public Binding getBinding(String property) { - return _bindings.getBinding(property); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 10, 2005 + */ +package net.sf.launch4j.formimpl; + +import javax.swing.BorderFactory; +import javax.swing.JFileChooser; +import javax.swing.JTextArea; + +import net.sf.launch4j.binding.Binding; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.binding.IValidatable; +import net.sf.launch4j.form.ConfigForm; + +/** + * @author Copyright (C) 2005 Grzegorz Kowal + */ +public class ConfigFormImpl extends ConfigForm { + private final Bindings _bindings = new Bindings(); + private final JFileChooser _fileChooser = new FileChooser(ConfigFormImpl.class); + + public ConfigFormImpl() { + _tab.setBorder(BorderFactory.createMatteBorder(0, -1, -1, -1, getBackground())); + _tab.addTab(Messages.getString("tab.basic"), + new BasicFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.classpath"), + new ClassPathFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.header"), + new HeaderFormImpl(_bindings)); + _tab.addTab(Messages.getString("tab.singleInstance"), + new SingleInstanceFormImpl(_bindings)); + _tab.addTab(Messages.getString("tab.jre"), + new JreFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.envVars"), + new EnvironmentVarsFormImpl(_bindings)); + _tab.addTab(Messages.getString("tab.splash"), + new SplashFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.version"), + new VersionInfoFormImpl(_bindings, _fileChooser)); + _tab.addTab(Messages.getString("tab.messages"), + new MessagesFormImpl(_bindings)); + } + + public void clear(IValidatable bean) { + _bindings.clear(bean); + } + + public void put(IValidatable bean) { + _bindings.put(bean); + } + + public void get(IValidatable bean) { + _bindings.get(bean); + } + + public boolean isModified() { + return _bindings.isModified(); + } + + public JTextArea getLogTextArea() { + return _logTextArea; + } + + public Binding getBinding(String property) { + return _bindings.getBinding(property); + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java index e2fa1eb..0fe99d2 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/EnvironmentVarsFormImpl.java @@ -1,50 +1,50 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jun 10, 2006 - */ -package net.sf.launch4j.formimpl; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.form.EnvironmentVarsForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class EnvironmentVarsFormImpl extends EnvironmentVarsForm { - - public EnvironmentVarsFormImpl(Bindings bindings) { - bindings.add("variables", _envVarsTextArea); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jun 10, 2006 + */ +package net.sf.launch4j.formimpl; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.form.EnvironmentVarsForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class EnvironmentVarsFormImpl extends EnvironmentVarsForm { + + public EnvironmentVarsFormImpl(Bindings bindings) { + bindings.add("variables", _envVarsTextArea); + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java b/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java index 6814a37..2cf0689 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java +++ b/launch4j/src/net/sf/launch4j/formimpl/FileChooser.java @@ -1,66 +1,66 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Jul 19, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.io.File; -import java.util.prefs.Preferences; - -import javax.swing.JFileChooser; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class FileChooser extends JFileChooser { - private final Preferences _prefs; - private final String _key; - - public FileChooser(Class clazz) { - _prefs = Preferences.userNodeForPackage(clazz); - _key = "currentDir-" - + clazz.getName().substring(clazz.getName().lastIndexOf('.') + 1); - String path = _prefs.get(_key, null); - - if (path != null) { - setCurrentDirectory(new File(path)); - } - } - - public void approveSelection() { - _prefs.put(_key, getCurrentDirectory().getPath()); - super.approveSelection(); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Jul 19, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.io.File; +import java.util.prefs.Preferences; + +import javax.swing.JFileChooser; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class FileChooser extends JFileChooser { + private final Preferences _prefs; + private final String _key; + + public FileChooser(Class clazz) { + _prefs = Preferences.userNodeForPackage(clazz); + _key = "currentDir-" + + clazz.getName().substring(clazz.getName().lastIndexOf('.') + 1); + String path = _prefs.get(_key, null); + + if (path != null) { + setCurrentDirectory(new File(path)); + } + } + + public void approveSelection() { + _prefs.put(_key, getCurrentDirectory().getPath()); + super.approveSelection(); + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java index 1938fd4..b26aca4 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/HeaderFormImpl.java @@ -1,117 +1,117 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JRadioButton; - -import net.sf.launch4j.binding.Binding; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.Config; -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.form.HeaderForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class HeaderFormImpl extends HeaderForm { - private final Bindings _bindings; - - public HeaderFormImpl(Bindings bindings) { - _bindings = bindings; - _bindings.add("headerTypeIndex", new JRadioButton[] { _guiHeaderRadio, - _consoleHeaderRadio, - _jniGuiHeaderRadio, - _jniConsoleHeaderRadio }) - .add("headerObjects", "customHeaderObjects", _headerObjectsCheck, - _headerObjectsTextArea) - .add("libs", "customLibs", _libsCheck, _libsTextArea); - - _guiHeaderRadio.setActionCommand(Config.GUI_HEADER); - _consoleHeaderRadio.setActionCommand(Config.CONSOLE_HEADER); - _jniGuiHeaderRadio.setActionCommand(Config.JNI_GUI_HEADER_32); - _jniConsoleHeaderRadio.setActionCommand(Config.JNI_CONSOLE_HEADER_32); - - ActionListener headerTypeActionListener = new HeaderTypeActionListener(); - _guiHeaderRadio.addActionListener(headerTypeActionListener); - _consoleHeaderRadio.addActionListener(headerTypeActionListener); - _jniGuiHeaderRadio.addActionListener(headerTypeActionListener); - _jniConsoleHeaderRadio.addActionListener(headerTypeActionListener); - - _headerObjectsCheck.addActionListener(new HeaderObjectsActionListener()); - _libsCheck.addActionListener(new LibsActionListener()); - } - - private void updateLibs() { - if (!_libsCheck.isSelected()) { - ConfigPersister.getInstance().getConfig().setLibs(null); - Binding b = _bindings.getBinding("libs"); - b.put(ConfigPersister.getInstance().getConfig()); - } - } - - private class HeaderTypeActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - Config c = ConfigPersister.getInstance().getConfig(); - c.setHeaderType(e.getActionCommand()); - - if (!_headerObjectsCheck.isSelected()) { - Binding b = _bindings.getBinding("headerObjects"); - b.put(c); - updateLibs(); - } - } - } - - private class HeaderObjectsActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (!_headerObjectsCheck.isSelected()) { - ConfigPersister.getInstance().getConfig().setHeaderObjects(null); - Binding b = _bindings.getBinding("headerObjects"); - b.put(ConfigPersister.getInstance().getConfig()); - } - } - } - - private class LibsActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - updateLibs(); - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JRadioButton; + +import net.sf.launch4j.binding.Binding; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.Config; +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.form.HeaderForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class HeaderFormImpl extends HeaderForm { + private final Bindings _bindings; + + public HeaderFormImpl(Bindings bindings) { + _bindings = bindings; + _bindings.add("headerTypeIndex", new JRadioButton[] { _guiHeaderRadio, + _consoleHeaderRadio, + _jniGuiHeaderRadio, + _jniConsoleHeaderRadio }) + .add("headerObjects", "customHeaderObjects", _headerObjectsCheck, + _headerObjectsTextArea) + .add("libs", "customLibs", _libsCheck, _libsTextArea); + + _guiHeaderRadio.setActionCommand(Config.GUI_HEADER); + _consoleHeaderRadio.setActionCommand(Config.CONSOLE_HEADER); + _jniGuiHeaderRadio.setActionCommand(Config.JNI_GUI_HEADER_32); + _jniConsoleHeaderRadio.setActionCommand(Config.JNI_CONSOLE_HEADER_32); + + ActionListener headerTypeActionListener = new HeaderTypeActionListener(); + _guiHeaderRadio.addActionListener(headerTypeActionListener); + _consoleHeaderRadio.addActionListener(headerTypeActionListener); + _jniGuiHeaderRadio.addActionListener(headerTypeActionListener); + _jniConsoleHeaderRadio.addActionListener(headerTypeActionListener); + + _headerObjectsCheck.addActionListener(new HeaderObjectsActionListener()); + _libsCheck.addActionListener(new LibsActionListener()); + } + + private void updateLibs() { + if (!_libsCheck.isSelected()) { + ConfigPersister.getInstance().getConfig().setLibs(null); + Binding b = _bindings.getBinding("libs"); + b.put(ConfigPersister.getInstance().getConfig()); + } + } + + private class HeaderTypeActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + Config c = ConfigPersister.getInstance().getConfig(); + c.setHeaderType(e.getActionCommand()); + + if (!_headerObjectsCheck.isSelected()) { + Binding b = _bindings.getBinding("headerObjects"); + b.put(c); + updateLibs(); + } + } + } + + private class HeaderObjectsActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + if (!_headerObjectsCheck.isSelected()) { + ConfigPersister.getInstance().getConfig().setHeaderObjects(null); + Binding b = _bindings.getBinding("headerObjects"); + b.put(ConfigPersister.getInstance().getConfig()); + } + } + } + + private class LibsActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + updateLibs(); + } + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java index ad25442..85d932b 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/JreFormImpl.java @@ -1,175 +1,161 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.JFileChooser; -import javax.swing.JTextField; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.binding.Validator; -import net.sf.launch4j.form.JreForm; -import net.sf.launch4j.config.Jre; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class JreFormImpl extends JreForm { - - public JreFormImpl(Bindings bindings, JFileChooser fc) { - _jdkPreferenceCombo.setModel(new DefaultComboBoxModel(new String[] { - Messages.getString("jdkPreference.jre.only"), - Messages.getString("jdkPreference.prefer.jre"), - Messages.getString("jdkPreference.prefer.jdk"), - Messages.getString("jdkPreference.jdk.only")})); - - _runtimeBitsCombo.setModel(new DefaultComboBoxModel(new String[] { - Messages.getString("runtimeBits.64"), - Messages.getString("runtimeBits.64And32"), - Messages.getString("runtimeBits.32And64"), - Messages.getString("runtimeBits.32")})); - - bindings.add("jre.path", _jrePathField) - .add("jre.bundledJre64Bit", _bundledJre64BitCheck) - .add("jre.bundledJreAsFallback", _bundledJreAsFallbackCheck) - .add("jre.minVersion", _jreMinField) - .add("jre.maxVersion", _jreMaxField) - .add("jre.jdkPreferenceIndex", _jdkPreferenceCombo, Jre.DEFAULT_JDK_PREFERENCE_INDEX) - .add("jre.runtimeBitsIndex", _runtimeBitsCombo, Jre.DEFAULT_JDK_PREFERENCE_INDEX) - .add("jre.initialHeapSize", _initialHeapSizeField) - .add("jre.initialHeapPercent", _initialHeapPercentField) - .add("jre.maxHeapSize", _maxHeapSizeField) - .add("jre.maxHeapPercent", _maxHeapPercentField) - .add("jre.options", _jvmOptionsTextArea); - - _varCombo.setModel(new DefaultComboBoxModel(new String[] { - "EXEDIR", "EXEFILE", "PWD", "OLDPWD", "JREHOMEDIR", - "HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE", - "HKEY_USERS", "HKEY_CURRENT_CONFIG" })); - - _varCombo.addActionListener(new VarComboActionListener()); - _varCombo.setSelectedIndex(0); - - _propertyButton.addActionListener(new PropertyActionListener()); - _optionButton.addActionListener(new OptionActionListener()); - - _envPropertyButton.addActionListener(new EnvPropertyActionListener(_envVarField)); - _envOptionButton.addActionListener(new EnvOptionActionListener(_envVarField)); - } - - private class VarComboActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - _optionButton.setEnabled(((String) _varCombo.getSelectedItem()) - .startsWith("HKEY_")); - } - } - - private class PropertyActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - final int pos = _jvmOptionsTextArea.getCaretPosition(); - final String var = (String) _varCombo.getSelectedItem(); - if (var.startsWith("HKEY_")) { - _jvmOptionsTextArea.insert("-Dreg.key=\"%" - + var + "\\...%\"\n", pos); - } else { - _jvmOptionsTextArea.insert("-Dlaunch4j." + var.toLowerCase() - + "=\"%" + var + "%\"\n", pos); - } - } - } - - private class OptionActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - final int pos = _jvmOptionsTextArea.getCaretPosition(); - final String var = (String) _varCombo.getSelectedItem(); - if (var.startsWith("HKEY_")) { - _jvmOptionsTextArea.insert("%" + var + "\\...%\n", pos); - } else { - _jvmOptionsTextArea.insert("%" + var + "%\n", pos); - } - } - } - - private abstract class EnvActionListener extends AbstractAcceptListener { - public EnvActionListener(JTextField f, boolean listen) { - super(f, listen); - } - - public void actionPerformed(ActionEvent e) { - final int pos = _jvmOptionsTextArea.getCaretPosition(); - final String var = getText() - .replaceAll("\"", "") - .replaceAll("%", ""); - if (Validator.isEmpty(var)) { - signalViolation(Messages.getString("specifyVar")); - return; - } - add(var, pos); - clear(); - } - - protected abstract void add(String var, int pos); - } - - private class EnvPropertyActionListener extends EnvActionListener { - public EnvPropertyActionListener(JTextField f) { - super(f, true); - } - - protected void add(String var, int pos) { - final String prop = var - .replaceAll(" ", ".") - .replaceAll("_", ".") - .toLowerCase(); - _jvmOptionsTextArea.insert("-Denv." + prop + "=\"%" + var - + "%\"\n", pos); - } - } - - private class EnvOptionActionListener extends EnvActionListener { - public EnvOptionActionListener(JTextField f) { - super(f, false); - } - - protected void add(String var, int pos) { - _jvmOptionsTextArea.insert("%" + var + "%\n", pos); - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JFileChooser; +import javax.swing.JTextField; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.binding.Validator; +import net.sf.launch4j.config.Jre; +import net.sf.launch4j.form.JreForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class JreFormImpl extends JreForm { + + public JreFormImpl(Bindings bindings, JFileChooser fc) { + bindings.add("jre.path", _jrePathField, Jre.DEFAULT_PATH) + .add("jre.requiresJdk", _requiresJdkCheck) + .add("jre.requires64Bit", _requires64BitCheck) + .add("jre.minVersion", _jreMinField) + .add("jre.maxVersion", _jreMaxField) + .add("jre.initialHeapSize", _initialHeapSizeField) + .add("jre.initialHeapPercent", _initialHeapPercentField) + .add("jre.maxHeapSize", _maxHeapSizeField) + .add("jre.maxHeapPercent", _maxHeapPercentField) + .add("jre.options", _jvmOptionsTextArea); + + _varCombo.setModel(new DefaultComboBoxModel(new String[] { + "EXEDIR", "EXEFILE", "PWD", "OLDPWD", "JREHOMEDIR", + "HKEY_CLASSES_ROOT", "HKEY_CURRENT_USER", "HKEY_LOCAL_MACHINE", + "HKEY_USERS", "HKEY_CURRENT_CONFIG" })); + + _varCombo.addActionListener(new VarComboActionListener()); + _varCombo.setSelectedIndex(0); + + _propertyButton.addActionListener(new PropertyActionListener()); + _optionButton.addActionListener(new OptionActionListener()); + + _envPropertyButton.addActionListener(new EnvPropertyActionListener(_envVarField)); + _envOptionButton.addActionListener(new EnvOptionActionListener(_envVarField)); + } + + private class VarComboActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + _optionButton.setEnabled(((String) _varCombo.getSelectedItem()) + .startsWith("HKEY_")); + } + } + + private class PropertyActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + final int pos = _jvmOptionsTextArea.getCaretPosition(); + final String var = (String) _varCombo.getSelectedItem(); + if (var.startsWith("HKEY_")) { + _jvmOptionsTextArea.insert("-Dreg.key=\"%" + + var + "\\...%\"\n", pos); + } else { + _jvmOptionsTextArea.insert("-Dlaunch4j." + var.toLowerCase() + + "=\"%" + var + "%\"\n", pos); + } + } + } + + private class OptionActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + final int pos = _jvmOptionsTextArea.getCaretPosition(); + final String var = (String) _varCombo.getSelectedItem(); + if (var.startsWith("HKEY_")) { + _jvmOptionsTextArea.insert("%" + var + "\\...%\n", pos); + } else { + _jvmOptionsTextArea.insert("%" + var + "%\n", pos); + } + } + } + + private abstract class EnvActionListener extends AbstractAcceptListener { + public EnvActionListener(JTextField f, boolean listen) { + super(f, listen); + } + + public void actionPerformed(ActionEvent e) { + final int pos = _jvmOptionsTextArea.getCaretPosition(); + final String var = getText() + .replaceAll("\"", "") + .replaceAll("%", ""); + if (Validator.isEmpty(var)) { + signalViolation(Messages.getString("specifyVar")); + return; + } + add(var, pos); + clear(); + } + + protected abstract void add(String var, int pos); + } + + private class EnvPropertyActionListener extends EnvActionListener { + public EnvPropertyActionListener(JTextField f) { + super(f, true); + } + + protected void add(String var, int pos) { + final String prop = var + .replaceAll(" ", ".") + .replaceAll("_", ".") + .toLowerCase(); + _jvmOptionsTextArea.insert("-Denv." + prop + "=\"%" + var + + "%\"\n", pos); + } + } + + private class EnvOptionActionListener extends EnvActionListener { + public EnvOptionActionListener(JTextField f) { + super(f, false); + } + + protected void add(String var, int pos) { + _jvmOptionsTextArea.insert("%" + var + "%\n", pos); + } + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java b/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java index 2799bdb..ecb18c2 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java +++ b/launch4j/src/net/sf/launch4j/formimpl/MainFrame.java @@ -1,359 +1,346 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on 2005-05-09 - */ -package net.sf.launch4j.formimpl; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JToolBar; -import javax.swing.UIManager; - -import com.jgoodies.looks.Options; -import com.jgoodies.looks.plastic.PlasticXPLookAndFeel; -import com.jgoodies.looks.windows.WindowsLookAndFeel; - -import foxtrot.Task; -import foxtrot.Worker; -import net.sf.launch4j.Builder; -import net.sf.launch4j.BuilderException; -import net.sf.launch4j.ExecException; -import net.sf.launch4j.FileChooserFilter; -import net.sf.launch4j.Log; -import net.sf.launch4j.Main; -import net.sf.launch4j.Util; -import net.sf.launch4j.binding.Binding; -import net.sf.launch4j.binding.BindingException; -import net.sf.launch4j.binding.InvariantViolationException; -import net.sf.launch4j.config.ConfigPersister; -import net.sf.launch4j.config.ConfigPersisterException; - -/** - * @author Copyright (C) 2005 Grzegorz Kowal - */ -public class MainFrame extends JFrame { - private static MainFrame _instance; - - private final JToolBar _toolBar; - private final JButton _runButton; - private final ConfigFormImpl _configForm; - private final JFileChooser _fileChooser = new FileChooser(MainFrame.class); - private File _outfile; - private boolean _saved = false; - - public static void createInstance() { - try { - Toolkit.getDefaultToolkit().setDynamicLayout(true); - System.setProperty("sun.awt.noerasebackground","true"); - - // JGoodies - Options.setDefaultIconSize(new Dimension(16, 16)); // menu icons - Options.setUseNarrowButtons(false); - Options.setPopupDropShadowEnabled(true); - - UIManager.setLookAndFeel(System.getProperty("os.name").toLowerCase().startsWith("windows") - ? new WindowsLookAndFeel() : new PlasticXPLookAndFeel()); - - _instance = new MainFrame(); - } catch (Exception e) { - System.err.println(e); - } - } - - public static MainFrame getInstance() { - return _instance; - } - - public MainFrame() { - showConfigName(null); - setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); - addWindowListener(new MainFrameListener()); - setGlassPane(new GlassPane(this)); - _fileChooser.setFileFilter(new FileChooserFilter( - Messages.getString("MainFrame.config.files"), - new String[] {".xml", ".cfg"})); - - _toolBar = new JToolBar(); - _toolBar.setFloatable(false); - _toolBar.setRollover(true); - addButton("images/new.png", Messages.getString("MainFrame.new.config"), - new NewActionListener()); - addButton("images/open.png", Messages.getString("MainFrame.open.config"), - new OpenActionListener()); - addButton("images/save.png", Messages.getString("MainFrame.save.config"), - new SaveActionListener()); - _toolBar.addSeparator(); - addButton("images/build.png", Messages.getString("MainFrame.build.wrapper"), - new BuildActionListener()); - _runButton = addButton("images/run.png", - Messages.getString("MainFrame.test.wrapper"), - new RunActionListener()); - setRunEnabled(false); - _toolBar.addSeparator(); - addButton("images/info.png", Messages.getString("MainFrame.about.launch4j"), - new AboutActionListener()); - - _configForm = new ConfigFormImpl(); - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(_toolBar, BorderLayout.NORTH); - getContentPane().add(_configForm, BorderLayout.CENTER); - pack(); - Dimension scr = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension fr = getSize(); - fr.width += 25; - fr.height += 100; - setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2, - fr.width, fr.height); - setVisible(true); - } - - private JButton addButton(String iconPath, String tooltip, ActionListener l) { - ImageIcon icon = new ImageIcon(MainFrame.class.getClassLoader() - .getResource(iconPath)); - JButton b = new JButton(icon); - b.setToolTipText(tooltip); - b.addActionListener(l); - _toolBar.add(b); - return b; - } - - public void info(String text) { - JOptionPane.showMessageDialog(this, - text, - Main.getName(), - JOptionPane.INFORMATION_MESSAGE); - } - - public void warn(String text) { - JOptionPane.showMessageDialog(this, - text, - Main.getName(), - JOptionPane.WARNING_MESSAGE); - } - - public void warn(InvariantViolationException e) { - Binding b = e.getBinding(); - if (b != null) { - b.markInvalid(); - } - warn(e.getMessage()); - if (b != null) { - e.getBinding().markValid(); - } - } - - public boolean confirm(String text) { - return JOptionPane.showConfirmDialog(MainFrame.this, - text, - Messages.getString("MainFrame.confirm"), - JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; - } - - private boolean canDiscardChanges() { - return (!_configForm.isModified()) - || confirm(Messages.getString("MainFrame.discard.changes")); - } - - private boolean save() { - try { - _configForm.get(ConfigPersister.getInstance().getConfig()); - if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) { - File f = _fileChooser.getSelectedFile(); - if (!f.getPath().endsWith(".xml")) { - f = new File(f.getPath() + ".xml"); - } - ConfigPersister.getInstance().save(f); - _saved = true; - showConfigName(f); - return true; - } - return false; - } catch (InvariantViolationException ex) { - warn(ex); - return false; - } catch (BindingException ex) { - warn(ex.getMessage()); - return false; - } catch (ConfigPersisterException ex) { - warn(ex.getMessage()); - return false; - } - } - - private void showConfigName(File config) { - setTitle(Main.getName() + " - " + (config != null ? config.getName() - : Messages.getString("MainFrame.untitled"))); - } - - private void setRunEnabled(boolean enabled) { - if (!enabled) { - _outfile = null; - } - _runButton.setEnabled(enabled); - } - - private void clearConfig() { - ConfigPersister.getInstance().createBlank(); - _configForm.clear(ConfigPersister.getInstance().getConfig()); - } - - private class MainFrameListener extends WindowAdapter { - public void windowOpened(WindowEvent e) { - clearConfig(); - } - - public void windowClosing(WindowEvent e) { - if (canDiscardChanges()) { - dispose(); - System.exit(0); - } - } - } - - private class NewActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - if (canDiscardChanges()) { - clearConfig(); - _saved = false; - showConfigName(null); - setRunEnabled(false); - } - } - } - - private class OpenActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - try { - if (canDiscardChanges() && _fileChooser.showOpenDialog(MainFrame.this) - == JOptionPane.YES_OPTION) { - final File f = _fileChooser.getSelectedFile(); - if (f.getPath().endsWith(".xml")) { - ConfigPersister.getInstance().load(f); - _saved = true; - } else { - ConfigPersister.getInstance().loadVersion1(f); - _saved = false; - } - _configForm.put(ConfigPersister.getInstance().getConfig()); - showConfigName(f); - setRunEnabled(false); - } - } catch (ConfigPersisterException ex) { - warn(ex.getMessage()); - } catch (BindingException ex) { - warn(ex.getMessage()); - } - } - } - - private class SaveActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - save(); - } - } - - private class BuildActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - final Log log = Log.getSwingLog(_configForm.getLogTextArea()); - try { - if ((!_saved || _configForm.isModified()) - && !save()) { - return; - } - log.clear(); - ConfigPersister.getInstance().getConfig().checkInvariants(); - Builder b = new Builder(log); - _outfile = b.build(); - setRunEnabled(ConfigPersister.getInstance().getConfig().isGuiApplication() - // TODO fix console app test - && (Util.WINDOWS_OS || !ConfigPersister.getInstance() - .getConfig().isDontWrapJar())); - } catch (InvariantViolationException ex) { - setRunEnabled(false); - ex.setBinding(_configForm.getBinding(ex.getProperty())); - warn(ex); - } catch (BuilderException ex) { - setRunEnabled(false); - log.append(ex.getMessage()); - } - } - } - - private class RunActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - try { - getGlassPane().setVisible(true); - Worker.post(new Task() { - public Object run() throws ExecException { - Log log = Log.getSwingLog(_configForm.getLogTextArea()); - log.clear(); - String path = _outfile.getPath(); - if (Util.WINDOWS_OS) { - log.append(Messages.getString("MainFrame.executing") + path); - Util.exec(new String[] { path, "--l4j-debug" }, log); - } else { - log.append(Messages.getString("MainFrame.jar.integrity.test") - + path); - Util.exec(new String[] { "java", "-jar", path }, log); - } - return null; - } - }); - } catch (Exception ex) { - // XXX errors logged by exec - } finally { - getGlassPane().setVisible(false); - } - }; - } - - private class AboutActionListener implements ActionListener { - public void actionPerformed(ActionEvent e) { - info(Main.getDescription()); - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on 2005-05-09 + */ +package net.sf.launch4j.formimpl; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.File; + +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JToolBar; +import javax.swing.SwingWorker; +import javax.swing.UIManager; + +import com.formdev.flatlaf.FlatLightLaf; + +import net.sf.launch4j.Builder; +import net.sf.launch4j.BuilderException; +import net.sf.launch4j.ExecException; +import net.sf.launch4j.FileChooserFilter; +import net.sf.launch4j.Log; +import net.sf.launch4j.Main; +import net.sf.launch4j.Util; +import net.sf.launch4j.binding.Binding; +import net.sf.launch4j.binding.BindingException; +import net.sf.launch4j.binding.InvariantViolationException; +import net.sf.launch4j.config.ConfigPersister; +import net.sf.launch4j.config.ConfigPersisterException; + +/** + * @author Copyright (C) 2022 Grzegorz Kowal + */ +public class MainFrame extends JFrame { + private static MainFrame _instance; + + private final JToolBar _toolBar; + private final JButton _runButton; + private final ConfigFormImpl _configForm; + private final JFileChooser _fileChooser = new FileChooser(MainFrame.class); + private File _outfile; + private boolean _saved = false; + + public static void createInstance() { + try { + FlatLightLaf.install(); + _instance = new MainFrame(); + } catch (Exception e) { + System.err.println(e); + } + } + + public static MainFrame getInstance() { + return _instance; + } + + public MainFrame() { + showConfigName(null); + setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + addWindowListener(new MainFrameListener()); + setGlassPane(new GlassPane(this)); + _fileChooser.setFileFilter(new FileChooserFilter( + Messages.getString("MainFrame.config.files"), + new String[] { ".xml" })); + + _toolBar = new JToolBar(); + _toolBar.setFloatable(false); + _toolBar.setRollover(true); + addButton(UIManager.getIcon("Tree.leafIcon"), Messages.getString("MainFrame.new.config"), + new NewActionListener()); + addButton(UIManager.getIcon("Tree.openIcon"), Messages.getString("MainFrame.open.config"), + new OpenActionListener()); + addButton(UIManager.getIcon("FileView.floppyDriveIcon"), Messages.getString("MainFrame.save.config"), + new SaveActionListener()); + _toolBar.addSeparator(); + addButton(getLocalIcon("images/build.png"), Messages.getString("MainFrame.build.wrapper"), + new BuildActionListener()); + _runButton = addButton(getLocalIcon("images/run.png"), + Messages.getString("MainFrame.test.wrapper"), + new RunActionListener()); + setRunEnabled(false); + _toolBar.addSeparator(); + addButton(UIManager.getIcon("HelpButton.icon"), Messages.getString("MainFrame.about.launch4j"), + new AboutActionListener()); + + _configForm = new ConfigFormImpl(); + getContentPane().setLayout(new BorderLayout()); + getContentPane().add(_toolBar, BorderLayout.NORTH); + getContentPane().add(_configForm, BorderLayout.CENTER); + pack(); + Dimension scr = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension fr = getSize(); + fr.width = 900; + fr.height += 100; + setBounds((scr.width - fr.width) / 2, (scr.height - fr.height) / 2, + fr.width, fr.height); + setVisible(true); + } + + private ImageIcon getLocalIcon(String iconPath) { + return new ImageIcon(MainFrame.class.getClassLoader().getResource(iconPath)); + } + + private JButton addButton(Icon icon, String tooltip, ActionListener l) { + JButton b = new JButton(icon); + b.setToolTipText(tooltip); + b.addActionListener(l); + _toolBar.add(b); + return b; + } + + public void info(String text) { + JOptionPane.showMessageDialog(this, + text, + Main.getName(), + JOptionPane.INFORMATION_MESSAGE); + } + + public void warn(String text) { + JOptionPane.showMessageDialog(this, + text, + Main.getName(), + JOptionPane.WARNING_MESSAGE); + } + + public void warn(InvariantViolationException e) { + Binding b = e.getBinding(); + if (b != null) { + b.markInvalid(); + } + warn(e.getMessage()); + if (b != null) { + e.getBinding().markValid(); + } + } + + public boolean confirm(String text) { + return JOptionPane.showConfirmDialog(MainFrame.this, + text, + Messages.getString("MainFrame.confirm"), + JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; + } + + private boolean canDiscardChanges() { + return (!_configForm.isModified()) + || confirm(Messages.getString("MainFrame.discard.changes")); + } + + private boolean save() { + try { + _configForm.get(ConfigPersister.getInstance().getConfig()); + if (_fileChooser.showSaveDialog(MainFrame.this) == JOptionPane.YES_OPTION) { + File f = _fileChooser.getSelectedFile(); + if (!f.getPath().endsWith(".xml")) { + f = new File(f.getPath() + ".xml"); + } + ConfigPersister.getInstance().save(f); + _saved = true; + showConfigName(f); + return true; + } + return false; + } catch (InvariantViolationException ex) { + warn(ex); + return false; + } catch (BindingException ex) { + warn(ex.getMessage()); + return false; + } catch (ConfigPersisterException ex) { + warn(ex.getMessage()); + return false; + } + } + + private void showConfigName(File config) { + setTitle(Main.getName() + " - " + (config != null ? config.getName() + : Messages.getString("MainFrame.untitled"))); + } + + private void setRunEnabled(boolean enabled) { + if (!enabled) { + _outfile = null; + } + _runButton.setEnabled(enabled); + } + + private void clearConfig() { + ConfigPersister.getInstance().createBlank(); + _configForm.clear(ConfigPersister.getInstance().getConfig()); + } + + private class MainFrameListener extends WindowAdapter { + public void windowOpened(WindowEvent e) { + clearConfig(); + } + + public void windowClosing(WindowEvent e) { + if (canDiscardChanges()) { + dispose(); + System.exit(0); + } + } + } + + private class NewActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + if (canDiscardChanges()) { + clearConfig(); + _saved = false; + showConfigName(null); + setRunEnabled(false); + } + } + } + + private class OpenActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + try { + if (canDiscardChanges() && _fileChooser.showOpenDialog(MainFrame.this) + == JOptionPane.YES_OPTION) { + final File f = _fileChooser.getSelectedFile(); + ConfigPersister.getInstance().load(f); + _saved = true; + _configForm.put(ConfigPersister.getInstance().getConfig()); + showConfigName(f); + setRunEnabled(false); + } + } catch (ConfigPersisterException ex) { + warn(ex.getMessage()); + } catch (BindingException ex) { + warn(ex.getMessage()); + } + } + } + + private class SaveActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + save(); + } + } + + private class BuildActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + final Log log = Log.getSwingLog(_configForm.getLogTextArea()); + try { + if ((!_saved || _configForm.isModified()) + && !save()) { + return; + } + log.clear(); + ConfigPersister.getInstance().getConfig().checkInvariants(); + Builder b = new Builder(log); + _outfile = b.build(); + setRunEnabled(ConfigPersister.getInstance().getConfig().isGuiApplication() + // TODO fix console app test + && (Util.WINDOWS_OS || !ConfigPersister.getInstance() + .getConfig().isDontWrapJar())); + } catch (InvariantViolationException ex) { + setRunEnabled(false); + ex.setBinding(_configForm.getBinding(ex.getProperty())); + warn(ex); + } catch (BuilderException ex) { + setRunEnabled(false); + log.append(ex.getMessage()); + } + } + } + + private class RunActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + try { + getGlassPane().setVisible(true); + new SwingWorker() { + @Override + protected Boolean doInBackground() throws ExecException + { + Log log = Log.getSwingLog(_configForm.getLogTextArea()); + log.clear(); + String path = _outfile.getPath(); + if (Util.WINDOWS_OS) { + log.append(Messages.getString("MainFrame.executing") + path); + Util.exec(new String[] { path, "--l4j-debug" }, log); + } else { + log.append(Messages.getString("MainFrame.jar.integrity.test") + + path); + Util.exec(new String[] { "java", "-jar", path }, log); + } + return true; + } + }.execute(); + } catch (Exception ex) { + // XXX errors logged by exec + } finally { + getGlassPane().setVisible(false); + } + }; + } + + private class AboutActionListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + info(Main.getDescription()); + } + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/Messages.java b/launch4j/src/net/sf/launch4j/formimpl/Messages.java index d4d045a..5a1e6f2 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/Messages.java +++ b/launch4j/src/net/sf/launch4j/formimpl/Messages.java @@ -1,55 +1,55 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -package net.sf.launch4j.formimpl; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "net.sf.launch4j.formimpl.messages"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle - .getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package net.sf.launch4j.formimpl; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.sf.launch4j.formimpl.messages"; + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle + .getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java index ad9413d..4703803 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/MessagesFormImpl.java @@ -1,58 +1,58 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on Oct 7, 2006 - */ -package net.sf.launch4j.formimpl; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.Msg; -import net.sf.launch4j.form.MessagesForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class MessagesFormImpl extends MessagesForm { - - public MessagesFormImpl(Bindings bindings) { - Msg m = new Msg(); - bindings.addOptComponent("messages", Msg.class, _messagesCheck) - .add("messages.startupErr", _startupErrTextArea, m.getStartupErr()) - .add("messages.bundledJreErr", _bundledJreErrTextArea, m.getBundledJreErr()) - .add("messages.jreVersionErr", _jreVersionErrTextArea, m.getJreVersionErr()) - .add("messages.launcherErr", _launcherErrTextArea, m.getLauncherErr()) - .add("messages.instanceAlreadyExistsMsg", _instanceAlreadyExistsMsgTextArea, - m.getInstanceAlreadyExistsMsg()); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on Oct 7, 2006 + */ +package net.sf.launch4j.formimpl; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.Msg; +import net.sf.launch4j.form.MessagesForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class MessagesFormImpl extends MessagesForm { + + public MessagesFormImpl(Bindings bindings) { + Msg m = new Msg(); + bindings.addOptComponent("messages", Msg.class, _messagesCheck) + .add("messages.startupErr", _startupErrTextArea, m.getStartupErr()) + .add("messages.jreNotFoundErr", _jreNotFoundErrTextArea, m.getJreNotFoundErr()) + .add("messages.jreVersionErr", _jreVersionErrTextArea, m.getJreVersionErr()) + .add("messages.launcherErr", _launcherErrTextArea, m.getLauncherErr()) + .add("messages.instanceAlreadyExistsMsg", _instanceAlreadyExistsMsgTextArea, + m.getInstanceAlreadyExistsMsg()); + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java index 5e6dc40..2cfa5bd 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/SingleInstanceFormImpl.java @@ -1,54 +1,54 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - * Created on 2007-09-22 - */ -package net.sf.launch4j.formimpl; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.SingleInstance; -import net.sf.launch4j.form.SingleInstanceForm; - -/** - * @author Copyright (C) 2007 Grzegorz Kowal - */ -public class SingleInstanceFormImpl extends SingleInstanceForm { - - public SingleInstanceFormImpl(Bindings bindings) { - bindings.addOptComponent("singleInstance", SingleInstance.class, - _singleInstanceCheck) - .add("singleInstance.mutexName", _mutexNameField) - .add("singleInstance.windowTitle", _windowTitleField); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * Created on 2007-09-22 + */ +package net.sf.launch4j.formimpl; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.SingleInstance; +import net.sf.launch4j.form.SingleInstanceForm; + +/** + * @author Copyright (C) 2007 Grzegorz Kowal + */ +public class SingleInstanceFormImpl extends SingleInstanceForm { + + public SingleInstanceFormImpl(Bindings bindings) { + bindings.addOptComponent("singleInstance", SingleInstance.class, + _singleInstanceCheck) + .add("singleInstance.mutexName", _mutexNameField) + .add("singleInstance.windowTitle", _windowTitleField); + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java index b204bfd..839a981 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/SplashFormImpl.java @@ -1,61 +1,61 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import javax.swing.JFileChooser; - -import net.sf.launch4j.FileChooserFilter; -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.Splash; -import net.sf.launch4j.form.SplashForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class SplashFormImpl extends SplashForm { - - public SplashFormImpl(Bindings bindings, JFileChooser fc) { - bindings.addOptComponent("splash", Splash.class, _splashCheck) - .add("splash.file", _splashFileField) - .add("splash.waitForWindow", _waitForWindowCheck, true) - .add("splash.timeout", _timeoutField, "60") - .add("splash.timeoutErr", _timeoutErrCheck, true); - - _splashFileButton.addActionListener(new BrowseActionListener(false, fc, - new FileChooserFilter("Bitmap files (.bmp)", ".bmp"), _splashFileField)); - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import javax.swing.JFileChooser; + +import net.sf.launch4j.FileChooserFilter; +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.Splash; +import net.sf.launch4j.form.SplashForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class SplashFormImpl extends SplashForm { + + public SplashFormImpl(Bindings bindings, JFileChooser fc) { + bindings.addOptComponent("splash", Splash.class, _splashCheck) + .add("splash.file", _splashFileField) + .add("splash.waitForWindow", _waitForWindowCheck, true) + .add("splash.timeout", _timeoutField, "60") + .add("splash.timeoutErr", _timeoutErrCheck, true); + + _splashFileButton.addActionListener(new BrowseActionListener(false, fc, + new FileChooserFilter("Bitmap files (.bmp)", ".bmp"), _splashFileField)); + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java b/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java index 8e0e5f3..89e3369 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java +++ b/launch4j/src/net/sf/launch4j/formimpl/VersionInfoFormImpl.java @@ -1,69 +1,69 @@ -/* - Launch4j (http://launch4j.sourceforge.net/) - Cross-platform Java application wrapper for creating Windows native executables. - - Copyright (c) 2004, 2015 Grzegorz Kowal - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors - may be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* - * Created on May 1, 2006 - */ -package net.sf.launch4j.formimpl; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.JFileChooser; - -import net.sf.launch4j.binding.Bindings; -import net.sf.launch4j.config.LanguageID; -import net.sf.launch4j.config.VersionInfo; -import net.sf.launch4j.form.VersionInfoForm; - -/** - * @author Copyright (C) 2006 Grzegorz Kowal - */ -public class VersionInfoFormImpl extends VersionInfoForm { - - public VersionInfoFormImpl(Bindings bindings, JFileChooser fc) { - _languageCombo.setModel(new DefaultComboBoxModel(LanguageID.sortedValues())); - bindings.addOptComponent("versionInfo", VersionInfo.class, _versionInfoCheck) - .add("versionInfo.fileVersion", _fileVersionField) - .add("versionInfo.productVersion", _productVersionField) - .add("versionInfo.fileDescription", _fileDescriptionField) - .add("versionInfo.internalName", _internalNameField) - .add("versionInfo.originalFilename", _originalFilenameField) - .add("versionInfo.productName", _productNameField) - .add("versionInfo.txtFileVersion", _txtFileVersionField) - .add("versionInfo.txtProductVersion", _txtProductVersionField) - .add("versionInfo.companyName", _companyNameField) - .add("versionInfo.copyright", _copyrightField) - .add("versionInfo.trademarks", _trademarksField) - .add("versionInfo.languageIndex", _languageCombo, VersionInfo.DEFAULT_LANGUAGE_INDEX) - ; - } -} +/* + Launch4j (http://launch4j.sourceforge.net/) + Cross-platform Java application wrapper for creating Windows native executables. + + Copyright (c) 2004, 2015 Grzegorz Kowal + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * Created on May 1, 2006 + */ +package net.sf.launch4j.formimpl; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JFileChooser; + +import net.sf.launch4j.binding.Bindings; +import net.sf.launch4j.config.LanguageID; +import net.sf.launch4j.config.VersionInfo; +import net.sf.launch4j.form.VersionInfoForm; + +/** + * @author Copyright (C) 2006 Grzegorz Kowal + */ +public class VersionInfoFormImpl extends VersionInfoForm { + + public VersionInfoFormImpl(Bindings bindings, JFileChooser fc) { + _languageCombo.setModel(new DefaultComboBoxModel(LanguageID.sortedValues())); + bindings.addOptComponent("versionInfo", VersionInfo.class, _versionInfoCheck) + .add("versionInfo.fileVersion", _fileVersionField) + .add("versionInfo.productVersion", _productVersionField) + .add("versionInfo.fileDescription", _fileDescriptionField) + .add("versionInfo.internalName", _internalNameField) + .add("versionInfo.originalFilename", _originalFilenameField) + .add("versionInfo.productName", _productNameField) + .add("versionInfo.txtFileVersion", _txtFileVersionField) + .add("versionInfo.txtProductVersion", _txtProductVersionField) + .add("versionInfo.companyName", _companyNameField) + .add("versionInfo.copyright", _copyrightField) + .add("versionInfo.trademarks", _trademarksField) + .add("versionInfo.languageIndex", _languageCombo, VersionInfo.DEFAULT_LANGUAGE_INDEX) + ; + } +} diff --git a/launch4j/src/net/sf/launch4j/formimpl/messages.properties b/launch4j/src/net/sf/launch4j/formimpl/messages.properties index 385adbd..cd8f71d 100644 --- a/launch4j/src/net/sf/launch4j/formimpl/messages.properties +++ b/launch4j/src/net/sf/launch4j/formimpl/messages.properties @@ -1,80 +1,72 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2015 Grzegorz Kowal -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -tab.basic=Basic -tab.classpath=Classpath -tab.header=Header -tab.singleInstance=Single instance -tab.jre=JRE -tab.envVars=Set env. variables -tab.splash=Splash -tab.version=Version Info -tab.messages=Messages - -# Basic -jar=Jar: -jarPath=Jar runtime path: -jarTip=Application jar. -jarPathTip=Optional runtime path of the jar relative to the executable. For example, if the executable launcher and the application jar named calc.exe and calc.jar are in the same directory, it would be: calc.jar. - -# Classpath -specifyClassPath=Specify classpath item to add. -confirmClassPathRemoval=Remove selected classpath items? -noManifest=The selected jar does not have a manifest. - -# JRE -specifyVar=Specify environment variable to add. -otherVar=Other var - -jdkPreference.jre.only=Only use public JREs -jdkPreference.prefer.jre=Prefer public JRE, but use JDK runtime if newer -jdkPreference.prefer.jdk=Prefer JDK runtime, but use public JRE if newer -jdkPreference.jdk.only=Only use private JDK runtimes - -runtimeBits.64=64-bit only -runtimeBits.64And32=First 64-bit, then 32-bit -runtimeBits.32And64=First 32-bit, then 64-bit -runtimeBits.32=32-bit only - -MainFrame.config.files=launch4j config files (.xml, .cfg) -MainFrame.new.config=New configuration -MainFrame.open.config=Open configuration or import 1.x -MainFrame.save.config=Save configuration -MainFrame.build.wrapper=Build wrapper -MainFrame.test.wrapper=Test wrapper -MainFrame.about.launch4j=About launch4j -MainFrame.discard.changes=Discard changes? -MainFrame.confirm=Confirm -MainFrame.untitled=untitled -MainFrame.executing=Executing: -MainFrame.jar.integrity.test=Jar integrity test, executing: +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2015 Grzegorz Kowal +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +tab.basic=Basic +tab.classpath=Classpath +tab.header=Header +tab.singleInstance=Single instance +tab.jre=JRE +tab.envVars=Set env. variables +tab.splash=Splash +tab.version=Version Info +tab.messages=Messages + +# Basic +jar=Jar: +jarPath=Jar runtime path: +jarTip=Application jar. +jarPathTip=Optional runtime path of the jar relative to the executable. For example, if the executable launcher and the application jar named calc.exe and calc.jar are in the same directory, it would be: calc.jar. + +# Classpath +specifyClassPath=Specify classpath item to add. +confirmClassPathRemoval=Remove selected classpath items? +noManifest=The selected jar does not have a manifest. + +# JRE +specifyVar=Specify environment variable to add. +otherVar=Other var + +requiresJdk=Requires JDK + +MainFrame.config.files=launch4j config files (.xml) +MainFrame.new.config=New configuration +MainFrame.open.config=Open configuration or import 1.x +MainFrame.save.config=Save configuration +MainFrame.build.wrapper=Build wrapper +MainFrame.test.wrapper=Test wrapper +MainFrame.about.launch4j=About launch4j +MainFrame.discard.changes=Discard changes? +MainFrame.confirm=Confirm +MainFrame.untitled=untitled +MainFrame.executing=Executing: +MainFrame.jar.integrity.test=Jar integrity test, executing: diff --git a/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties b/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties deleted file mode 100644 index e856f38..0000000 --- a/launch4j/src/net/sf/launch4j/formimpl/messages_es.properties +++ /dev/null @@ -1,56 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -tab.basic = B\u00E1sico -tab.header = Cabecera -tab.jre = JRE -tab.splash = Pantalla de bienvenida -tab.version = Informaci\u00F3n de la versi\u00F3n - -jar = Jar -jarPath = Ruta del jar -jarTip = Jar de la aplicaci\u00F3n. -jarPathTip = Ruta del jar relativa al ejecutable. Por ejemplo, si el lanzador ejecutable y el jar de la aplicaci\u00F3n, llamados calc.exe y calc.jar respectivamente, est\u00E1n en el mismo directorio, ser\u00EDa\: calc.jar. - -MainFrame.config.files = Ficheros de configuraci\u00F3n de launch4j (.xml, .cfg) -MainFrame.new.config = Nueva configuraci\u00F3n -MainFrame.open.config = Abrir configuraci\u00F3n o importar 1.x -MainFrame.save.config = Guardar configuraci\u00F3n -MainFrame.build.wrapper = Construir el empaquetador -MainFrame.test.wrapper = Comprobar el empaquetador -MainFrame.about.launch4j = Acerca de launch4j -MainFrame.discard.changes = \u00BFDescartar cambios? -MainFrame.confirm = Confirmar -MainFrame.untitled = Sin nombre -MainFrame.executing = Ejecutando\: -MainFrame.jar.integrity.test = Prueba de integridad jar, ejecutando\: diff --git a/launch4j/src/net/sf/launch4j/messages.properties b/launch4j/src/net/sf/launch4j/messages.properties index db2f9cc..67e30c1 100644 --- a/launch4j/src/net/sf/launch4j/messages.properties +++ b/launch4j/src/net/sf/launch4j/messages.properties @@ -1,45 +1,45 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2015 Grzegorz Kowal -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Main.usage=usage - -Builder.compiling.resources=Compiling resources -Builder.linking=Linking -Builder.wrapping=Wrapping\nWARNING: Sign the executable to minimize antivirus false positives or use launching instead of wrapping. -Builder.success=Successfully created -Builder.generated.resource.file=Generated resource file...\n -Builder.line.has.errors=Line {0} has errors... - -Util.exec.failed=Exec failed -Util.tmpdir=Temporary file directory path (launch4j.tmpdir) cannot contain spaces. - +# +# Launch4j (http://launch4j.sourceforge.net/) +# Cross-platform Java application wrapper for creating Windows native executables. +# +# Copyright (c) 2004, 2015 Grzegorz Kowal +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors +# may be used to endorse or promote products derived from this software without +# specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +Main.usage=usage + +Builder.compiling.resources=Compiling resources +Builder.linking=Linking +Builder.wrapping=Wrapping\nWARNING: Sign the executable to minimize antivirus false positives or use launching instead of wrapping. +Builder.success=Successfully created +Builder.generated.resource.file=Generated resource file...\n +Builder.line.has.errors=Line {0} has errors... + +Util.exec.failed=Exec failed +Util.tmpdir=Temporary file directory path (launch4j.tmpdir) cannot contain spaces. + diff --git a/launch4j/src/net/sf/launch4j/messages_es.properties b/launch4j/src/net/sf/launch4j/messages_es.properties deleted file mode 100644 index 8565cf4..0000000 --- a/launch4j/src/net/sf/launch4j/messages_es.properties +++ /dev/null @@ -1,44 +0,0 @@ -# -# Launch4j (http://launch4j.sourceforge.net/) -# Cross-platform Java application wrapper for creating Windows native executables. -# -# Copyright (c) 2004, 2007 Grzegorz Kowal, Patricio Martínez Ros -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors -# may be used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -Main.usage=Uso - -Builder.compiling.resources=Compilando recursos -Builder.linking=Enlazando -Builder.wrapping=Empaquetando -Builder.success=Creado con \ufffdxito -Builder.generated.resource.file=Fichero de recursos generado...\n -Builder.line.has.errors=Line {0} has errors... - -Util.exec.failed=Fallo en la ejecuci\ufffd -Util.tmpdir=Temporary file directory path (launch4j.tmpdir) cannot contain spaces. diff --git a/launch4j/w32api/MinGW.LICENSE.txt b/launch4j/w32api/MinGW.LICENSE.txt index aea85bd..141412d 100644 --- a/launch4j/w32api/MinGW.LICENSE.txt +++ b/launch4j/w32api/MinGW.LICENSE.txt @@ -1,25 +1,25 @@ -MinGW - Licensing Terms - -Various pieces distributed with MinGW come with its own copyright and license: - -Basic MinGW runtime - MinGW base runtime package is uncopyrighted and placed in the public domain. - This basically means that you can do what you want with the code. - -w32api - You are free to use, modify and copy this package. - No restrictions are imposed on programs or object files compiled with this library. - You may not restrict the the usage of this library. - You may distribute this library as part of another package or as a modified package - if and only if you do not restrict the usage of the portions consisting - of this (optionally modified) library. - If distributed as a modified package then this file must be included. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -MinGW profiling code - MinGW profiling code is distributed under the GNU General Public License. - -The development tools such as GCC, GDB, GNU Make, etc all covered by GNU General Public License. +MinGW - Licensing Terms + +Various pieces distributed with MinGW come with its own copyright and license: + +Basic MinGW runtime + MinGW base runtime package is uncopyrighted and placed in the public domain. + This basically means that you can do what you want with the code. + +w32api + You are free to use, modify and copy this package. + No restrictions are imposed on programs or object files compiled with this library. + You may not restrict the the usage of this library. + You may distribute this library as part of another package or as a modified package + if and only if you do not restrict the usage of the portions consisting + of this (optionally modified) library. + If distributed as a modified package then this file must be included. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +MinGW profiling code + MinGW profiling code is distributed under the GNU General Public License. + +The development tools such as GCC, GDB, GNU Make, etc all covered by GNU General Public License. diff --git a/launch4j/w32api/crt2.o b/launch4j/w32api/crt2.o index f81f836..4f5f3be 100644 Binary files a/launch4j/w32api/crt2.o and b/launch4j/w32api/crt2.o differ diff --git a/launch4j/w32api/libadvapi32.a b/launch4j/w32api/libadvapi32.a index c471853..21a8d7b 100644 Binary files a/launch4j/w32api/libadvapi32.a and b/launch4j/w32api/libadvapi32.a differ diff --git a/launch4j/w32api/libgcc.a b/launch4j/w32api/libgcc.a index d3f8947..f98edb8 100644 Binary files a/launch4j/w32api/libgcc.a and b/launch4j/w32api/libgcc.a differ diff --git a/launch4j/w32api/libkernel32.a b/launch4j/w32api/libkernel32.a index 5d3eb07..03ee7cd 100644 Binary files a/launch4j/w32api/libkernel32.a and b/launch4j/w32api/libkernel32.a differ diff --git a/launch4j/w32api/libmingw32.a b/launch4j/w32api/libmingw32.a index d1f7888..d849b85 100644 Binary files a/launch4j/w32api/libmingw32.a and b/launch4j/w32api/libmingw32.a differ diff --git a/launch4j/w32api_jni/libmingwex.a b/launch4j/w32api/libmingwex.a similarity index 100% rename from launch4j/w32api_jni/libmingwex.a rename to launch4j/w32api/libmingwex.a diff --git a/launch4j/w32api_jni/libmoldname.a b/launch4j/w32api/libmoldname.a similarity index 100% rename from launch4j/w32api_jni/libmoldname.a rename to launch4j/w32api/libmoldname.a diff --git a/launch4j/w32api/libmsvcrt.a b/launch4j/w32api/libmsvcrt.a index 6714146..be8ae31 100644 Binary files a/launch4j/w32api/libmsvcrt.a and b/launch4j/w32api/libmsvcrt.a differ diff --git a/launch4j/w32api/libshell32.a b/launch4j/w32api/libshell32.a index d35fbda..efdd8bc 100644 Binary files a/launch4j/w32api/libshell32.a and b/launch4j/w32api/libshell32.a differ diff --git a/launch4j/w32api/libuser32.a b/launch4j/w32api/libuser32.a index 387fb65..cbddae6 100644 Binary files a/launch4j/w32api/libuser32.a and b/launch4j/w32api/libuser32.a differ diff --git a/launch4j/w32api_jni/MinGW.LICENSE.txt b/launch4j/w32api_jni/MinGW.LICENSE.txt deleted file mode 100644 index aea85bd..0000000 --- a/launch4j/w32api_jni/MinGW.LICENSE.txt +++ /dev/null @@ -1,25 +0,0 @@ -MinGW - Licensing Terms - -Various pieces distributed with MinGW come with its own copyright and license: - -Basic MinGW runtime - MinGW base runtime package is uncopyrighted and placed in the public domain. - This basically means that you can do what you want with the code. - -w32api - You are free to use, modify and copy this package. - No restrictions are imposed on programs or object files compiled with this library. - You may not restrict the the usage of this library. - You may distribute this library as part of another package or as a modified package - if and only if you do not restrict the usage of the portions consisting - of this (optionally modified) library. - If distributed as a modified package then this file must be included. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty - of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -MinGW profiling code - MinGW profiling code is distributed under the GNU General Public License. - -The development tools such as GCC, GDB, GNU Make, etc all covered by GNU General Public License. diff --git a/launch4j/w32api_jni/crt2.o b/launch4j/w32api_jni/crt2.o deleted file mode 100644 index 4f5f3be..0000000 Binary files a/launch4j/w32api_jni/crt2.o and /dev/null differ diff --git a/launch4j/w32api_jni/libadvapi32.a b/launch4j/w32api_jni/libadvapi32.a deleted file mode 100644 index 21a8d7b..0000000 Binary files a/launch4j/w32api_jni/libadvapi32.a and /dev/null differ diff --git a/launch4j/w32api_jni/libgcc.a b/launch4j/w32api_jni/libgcc.a deleted file mode 100644 index f98edb8..0000000 Binary files a/launch4j/w32api_jni/libgcc.a and /dev/null differ diff --git a/launch4j/w32api_jni/libkernel32.a b/launch4j/w32api_jni/libkernel32.a deleted file mode 100644 index 03ee7cd..0000000 Binary files a/launch4j/w32api_jni/libkernel32.a and /dev/null differ diff --git a/launch4j/w32api_jni/libmingw32.a b/launch4j/w32api_jni/libmingw32.a deleted file mode 100644 index d849b85..0000000 Binary files a/launch4j/w32api_jni/libmingw32.a and /dev/null differ diff --git a/launch4j/w32api_jni/libmsvcrt.a b/launch4j/w32api_jni/libmsvcrt.a deleted file mode 100644 index be8ae31..0000000 Binary files a/launch4j/w32api_jni/libmsvcrt.a and /dev/null differ diff --git a/launch4j/w32api_jni/libshell32.a b/launch4j/w32api_jni/libshell32.a deleted file mode 100644 index efdd8bc..0000000 Binary files a/launch4j/w32api_jni/libshell32.a and /dev/null differ diff --git a/launch4j/w32api_jni/libuser32.a b/launch4j/w32api_jni/libuser32.a deleted file mode 100644 index cbddae6..0000000 Binary files a/launch4j/w32api_jni/libuser32.a and /dev/null differ diff --git a/launch4j/web/changelog.html b/launch4j/web/changelog.html index 450a2c0..f0afb6f 100644 --- a/launch4j/web/changelog.html +++ b/launch4j/web/changelog.html @@ -1,468 +1,502 @@ - - - - Launch4j - Cross-platform Java executable wrapper - - - - - - - -
-
- launch4j 3.12 -
- -
-

Changelog

- -

Changes in version 3.12 (17-05-2018)

-
    -
  • Ticket #179, #183 The generated executable fully supports Java 9 and newer (Sergey Karpushin).
  • -
  • Ticket #161 Support of update version higher than 99 (Sergey Karpushin).
  • -
  • Ticket #177 Launching on Java 9 JDK and newer is now possible (not just JRE).
  • -
  • Known issue: launch4j itself does not support Java 9 Early Access, use a public release instead or Java 10.
  • -
- -

Changes in version 3.11 (27-06-2017)

-
    -
  • Log more regarding Java search and missing resources.
  • -
  • Log resource file during build.
  • -
  • Added basic Java 9 support (only major version is detected right now due to version scheme change).
  • -
  • Ticket #145 Allow literal use of % in JRE options and set environment variables, use %% (blueskyhigh).
  • -
  • Added Linux 64-bit binaries (Sebastian Bögl).
  • -
  • Added IBM Java 1.8 support.
  • -
  • JNI header: fixed a crash where launch4j would try to `free` non-heap memory (Alexander Floh).
  • -
  • Ticket #160 Removed old Mac OS X package which caused problems on newer versions of the system.
  • -
- -

Changes in version 3.9 (20-07-2016)

-
    -
  • Ticket #146 Fixed java version check where the update number was greater than 99 (e.g. 1.8.0_101).
  • -
  • Enlarged the total classpath length to 30KB.
  • -
  • Ticket #142 Unbound VersionInfo returns wrong LanguageID (Sebastian Bögl).
  • -
  • Ticket #141 Ensure encoding of resource file to be iso-8859-1 (Thomas Scheithauer).
  • -
  • More reactive splash screen response to main window appearance (Federico Fissore).
  • -
  • FR #95 Launch4j should return an exit value (Sebastian Bögl).
  • -
  • FR #94 Add the working directory classifier for OS X (Sebastian Bögl).
  • -
  • FR #39 Launch Java VM through JNI (Ryan Rusaw) - BETA!
  • -
  • FR #69 Configure the language property of generated executables (Sebastian Bögl).
  • -
  • FR #77 Add legal trademarks as an additional field in version info tab (Sebastian Bögl).
  • -
  • Added a simple example how to use the Maven plugin (demo/ExitCodeApp).
  • -
- -

Changes in version 3.8 (09-05-2015)

-
    -
  • FR #59 Mavenized launch4j (thanks to taxone, Paul Jungwirth, Lukasz Lenart).
  • -
  • Ticket #139 Sign4j compiles and works on Linux (Tim Angus).
  • -
- -

Changes in version 3.7 (01-03-2015)

-
    -
  • Fixed false positive virus warnings that appeared in version 3.6.
  • -
- -

Changes in version 3.6 (06-01-2015)

-
    -
  • FR #86 The 32/64 bit search is fully configurable (64, 64/32, 32/64, 32) - added option 32/64.
  • -
  • FR #70 Java search sequence - bundled JRE can be used before or after the min/max version search (bundledJreAsFallback).
  • -
  • Fixed: Crash when classpath contained wildcard patterns where the dependency was in the same directory as the launcher.
  • -
  • Fixed launch4j GUI application closing - the process was still running.
  • -
- -

Changes in version 3.5 (09-10-2014)

-
    -
  • Ticket #75 Fixed exit value of -1 results in launch4j error.
  • -
  • Ticket #133, #134 Fixed runtimeBits JRE option.
  • -
  • FR #28, #72 Ability to restart the application based on exit code (Pascal Gruen, GK).
  • -
- -

Changes in version 3.4 (21-04-2014)

-
    -
  • FR #61 Added a new special variable JREHOMEDIR (Stefan Knoefel).
  • -
  • Ticket #130 Removed ant from launch4j classpath to fix problems with other ant versions.
  • -
  • Updated JGoodies libraries.
  • -
  • Added logging based on launch4j environment variable for file association launch testing.
  • -
- -

Changes in version 3.3 (02-04-2014)

-
    -
  • FR #60 Check the registry during JRE search, so that only valid runtimes are taken into account.
  • -
  • Ticket #128 Updated MAC OS X 10.8 windres to 2.24.51.20140326 - version info was compiled incorrectly (Code Buddy).
  • -
  • Added support for Japanese characters (Toshimm).
  • -
  • Ticket #82, #125 Take configuration encoding into account and save file with UTF-8 encoding.
  • -
- -

Changes in version 3.2 (24-03-2014)

-
    -
  • Ticket #126, #127: Fixed crash when classpath was not defined.
  • -
  • Corrected problem with loading jvm options from ini file when bundled JRE is used.
  • -
  • FR #63, #80 Add possibility to configure 32/64 bit search.
  • -
  • Improved logging (--l4j-debug and --l4j-debug-all).
  • -
- -

Changes in version 3.1.0-beta2 (20-08-2013)

-
    -
  • Removed the custom process name feature which was not compatible with newer Windows versions.
  • -
  • #121 Fixed heap calculation on systems with more than 4GB of memory.
  • -
  • #115 Added 64-bit bundled JRE option to control when the 32-bit maximum heap is applied.
  • -
  • Reduced the 32-bit max heap size to the safer 1GB.
  • -
  • Changes in --l4j-debug for better readability.
  • -
  • Fixed Can discard changes popup which appeared even if no changes were made.
  • -
  • Corrected permissions, owner and group in tgz packages.
  • -
  • #117 Fixed launch4j home dir search in case of jar and class files.
  • -
  • #111 Support paths with spaces in Linux systems.
  • -
  • #91 Linux launch4j starting script no longer changes the current directory.
  • -
  • #77 Allow line feeds in custom messages.
  • -
  • #57 Escape backslashes.
  • -
- -

Changes in version 3.1.0-beta1 (02-12-2012)

-
    -
  • Migrated code to Java 1.6.
  • -
  • Updated binutils to 2.22
  • -
  • Added Max OS X x86 support (two versions).
  • -
  • Added feature to digitally sign executables - sign4j by the Bramfeld team, sponsored by Servoy.
  • -
  • FR #3569093 Support Windows Security Features of the Windows 8 certification kit (Luc Bruninx).
  • -
- -

Changes in version 3.0.2 (02-01-2011)

-
    -
  • Fixed the command line in Exec error message.
  • -
  • Fixed set environment variable bug.
  • -
  • Added wrapper logging to launch4j GUI.
  • -
  • Fixed critical bug: heap size over the limit.
  • -
- -

Changes in version 3.0.1 (20-07-2008)

-
    -
  • Enhanced the runtime logging (--l4j-debug).
  • -
  • Fixed critical bug #1925387 64-bit JDK detection problem caused a runtime search error (found by Stivo).
  • -
  • Fixed bug #1919406, #1989479 Not every option is loaded from saved xml file (found by Robert Lachner, Jan-Philipp Rathje).
  • -
  • Fixed bug #1930222 Simple typo (found by Daniel).
  • -
- -

Changes in version 3.0.0 (16-03-2008)

-
    -
  • FR #1390075 Added dynamic initial/max heap values.
  • -
  • FR #1707827 Allow to prefer JDK private runtimes over JREs (Ian Roberts).
  • -
  • FR #1730245 Allow to run only a single aplication instance (Sylvain Mina).
  • -
  • FR #1391610 Added IBM JRE/JDK support.
  • -
  • Added environment variable expansion in bundled JRE path.
  • -
  • Fixed critical bug #1882524 JRE detection problem on 64-bit Windows.
  • -
  • Fixed bug #1758912 Vista elevation to full administrator privileges.
  • -
  • Fixed bug #1784341 Problems with spaces in paths under linux (Michael Piefel).
  • -
  • Fixed bug where /bin was appended to path environment variable instead of jre_path/bin.
  • -
- -

Changed license to BSD, MIT (26-01-2008)

-
    -
  • - The upcoming Launch4j 3.0.0 release will be licensed under the much more - liberal new BSD license. The head subproject (the binary header attached to wrapped jars) - will be licensed under the similar MIT license. -
  • -
- -

Changes in version 3.0.0-pre2 (29-10-2006)

-
    -
  • Enhanced GUI.
  • -
  • Redesigned error reporting.
  • -
  • Added custom error messages.
  • -
  • Added support website feature.
  • -
  • Added PWD and OLDPWD special variables and access to the registry.
  • -
  • Runtime ini file extension changed to .l4j.ini, added comments (#).
  • -
  • FR #1427811 Initial process priority.
  • -
  • FR #1547339 Added VarFileInfo structure to Version Info (Stephan Laertz).
  • -
  • FR #1584295 Updated documentation for --l4j-debug. -
  • Fixed <jarArgs/> and <args/> config conversion bug (found by Dafe Simonek).
  • -
  • Fixed the Ant task exception reporting bug, added tmpdir and bindir attributes.
  • -
  • Fixed bug #1563415 Problem with launching application when ini file exists (found by mojomax).
  • -
  • Fixed bug #1527619 Console header wildcard expansion (found by erikjv).
  • -
  • Fixed bug #1544167 NPE when dontwrap and only classpath given (found by Hendrik Schreiber).
  • -
  • Fixed bug #1584264 Dropdown boxes get mixed up (found by Larsen).
  • -
- -

News (17-10-2006)

- - -

Changes in version 3.0.0-pre1 (21-07-2006)

-
    -
  • Improved configuration file format and embedded Ant config.
  • -
  • Launch executable jars, regular jars and class files.
  • -
  • Added dynamic classpath resolution with environment variable references and wildcards.
  • -
  • Added option to set environment variables before launching the application.
  • -
  • New command line switches to change the compiled options.
  • -
  • Improved debug information.
  • -
  • Added support for XP visual style manifests.
  • -
  • Added option to disable use of private JREs.
  • -
  • Many small fixes and improvements...
  • -
- -

Configuration file changes in 3.x

-
    -
  • Previous formats (1.x and 2.x) are supported.
  • -
  • <headerType> accepts gui|console
  • -
  • <jarArgs> was changed to <cmdLine>
  • -
  • - <launch4jConfig><headerObjects><file> was changed to - <launch4jConfig><obj> -
  • -
  • - <launch4jConfig><libs><file> was changed to - <launch4jConfig><lib> -
  • -
  • - <launch4jConfig><jre><args> was changed to multiple - <launch4jConfig><jre><opt> -
  • -
- -

Embedded Ant configuration changes in 3.x

-
    -
  • - <jre args="value"> was changed to - <jre><opt>value</opt></jre> -
  • -
  • Now it's possible to define headerObjects, libs and classpath.
  • -
- -

Changes in version 2.1.5 (21-07-2006)

-
    -
  • Changed the Java download site to http://java.com/download.
  • -
  • Now it's possible to use absolute and relative paths to specify the bundled JRE.
  • -
- -

Changes in version 2.1.4 (15-06-2006)

-
    -
  • - Fixed bug #1503996 Only the first wrapper instance had a custom process name - (found by Helge Böhme). -
  • -
- -

Changes in version 2.1.3 (31-05-2006)

-
    -
  • - Fixed bug #1497453 Ant task doesn't support relative jar path with '..' - (found by Aston, Pavel Moukhataev). -
  • -
  • Jar argument size limit is now 16KB.
  • -
  • Environment variable size limit raised to 32KB.
  • -
  • Allow to concatenate multiple env. variables in one property (Maria D.)
  • -
  • Added launch4j.tmpdir property.
  • -
- -

Changes in version 2.1.2 (03-04-2006)

-
    -
  • Important bugfix: insufficient command line buffer size was increased to 32KB - (found by Sebastian Kopsan).
  • -
  • Added runtime JVM options from an .ini file.
  • -
  • Launch4j's bin directory is now configurable through launch4j.bindir - system property.
  • -
- -

Changes in version 2.1.1 (25-01-2006)

-
    -
  • Fixed bug #1402748. Validation error occurred when using an Ant task with - embedded config and dontWrapJar option (found by Chris Nokleberg).
  • -
- -

Changes in version 2.1.0 (10-01-2006)

-
    -
  • More features and smaller header: 18 KB!!
  • -
  • Added launcher mode, you can choose whether or not to wrap the jar.
  • -
  • Spanish translation of the website/docs and program messages - (Patricio Martínez Ros).
  • -
  • JRE's bin directory is appended to the Path environment variable - (Ianiv Schweber).
  • -
  • Added special variables EXEDIR and EXEFILE that hold the executable's - directory and full path.
  • -
  • Support for mapping environment variables to system properties.
  • -
  • Added debug launching mode - various information is displayed before - starting the Java application.
  • -
  • Fixed min/max JRE version checking, previous versions allowed these - to be equal (found by Ryan).
  • -
  • Bug fixed. Quotes in jar/JVM arguments were handled incorrectly (found by Juan Alvarez Ferrando).
  • -
  • A few other enhancements.
  • -
- -

Changes in version 2.0.0 (31-10-2005)

-
    -
  • Launch4j for Mac OS X is available thanks to Peter Centgraf.
  • -
  • Added support for custom headers.
  • -
  • Fixed bug #1343908, command line arguments with spaces were handled - incorrectly by the console header (found by Oliver Schaefer / Steve Alberty).
  • -
  • Fixed stdin redirection bug (found by Timo Santasalo).
  • -
- -

Changes in version 2.0 RC3 (13-08-2005) - final RC

-
    -
  • Correct handling of pathnames with spaces.
  • -
  • Fixed the '%20' pathname bug.
  • -
  • Fixed basedir bug (Richard Xing).
  • -
  • Splash screen can be closed when the application window becomes visible - with out specifying it's title (Martin Busik). - Update your config file: <waitForTitle>title</waitForTitle> - is now <waitForWindow>true</waitForWindow>. -
  • -
  • Fixed build.bat files in demo directories.
  • -
- -

Changes in version 2.0 RC2 (21-06-2005)

-
    -
  • chdir allows to change the current directory to arbitrary paths - relative to the executable (FR #1144907). It's incompatible with - previous versions, update your config file: - <chdir>true</chdir> - is now <chdir>.</chdir>. -
  • -
  • Bundled JRE path no longer depends on chdir function.
  • -
  • Fixed Ant task bug, build files outside launch4j's directory - wouldn't work. Josh Elsasser submitted a patch that works without - setting launch4j's home dir in the build file. Thanks! -
  • -
  • Removed static edge from splash screen (Serge Baranov).
  • -
  • Program checks that the output file path doesn't contain spaces.
  • -
  • Fixed a NPE bug caused by a missing maxVersion property - (found by Morgan Schweers). -
  • -
  • Fixed relative JRE path bug (found by Nili_).
  • -
  • Cleaned up the Builder class.
  • -
  • Fixed Ant task NPE where the config was entirely defined in the - build file (Josh Elsasser). -
  • -
- -

Changes in version 2.0 RC (07-06-2005)

-
    -
  • Added an Ant task for better build integration.
  • -
  • Added 2.x documentation.
  • -
  • Updated the demo configuration files.
  • -
  • Fixed issues with relative paths in the configuration.
  • -
  • Removed the '-1' option in console mode.
  • -
  • Minor fixes.
  • -
- -

Changes in version 2.0 beta2 (23-05-2005)

-
    -
  • # comments are recognized when importing 1.x cfg files.
  • -
  • Added version information.
  • -
  • Resource file is displayed when a resource error occurs.
  • -
  • Fixed a bug found by Max, options on the first tab were always enabled.
  • -
- -

Changes in version 2.0 beta1 (13-05-2005)

-
    -
  • Completely new, cross-platform wrapper - create windows executables on Linux.
  • -
  • New .xml configuration file.
  • -
  • Application icon with multiple resolutions and color depths.
  • -
  • Swing GUI interface.
  • -
  • Header compiled with MinGW port of gcc instead of VC++.
  • -
- -

Changes in version 1.4.2 (12-03-2005)

-
    -
  • Fixed bug #1158143, stayAlive without a splash screen caused - an infinite loop (found by Gregory Kotsaftis). -
  • -
- -

Changes in version 1.4.1 (04-03-2005)

-
    -
  • Fixed bug #1119040, buffer for reading config properties - was too short (found by Tom Jensen and Neil). -
  • -
  • Added configurable splash timeout (FR #1102951).
  • -
  • Added option to disable the error message on splash timeout (FR #1109159).
  • -
  • Option to keep the gui launcher 'alive' after starting an application (FR #1124653).
  • -
  • Removed version info.
  • -
  • 'waitfor' property is now optional.
  • -
- -

Changes in version 1.4.0 (26-01-2005)

-
    -
  • Removed .lch4j suffix from process name, now it has the - form of the executable filename. The temporary launchers are stored in - launch4j-tmp directory (suggested by Emmanuel). -
  • -
  • Added support for console apps (FR #1050053).
  • -
- -

Changes in version 1.3.1 (05-11-2004)

-
    -
  • Fixed a bug where explorer window was opened instead of - launching the application when setProcName was set to false - (found by Rob Jones). -
  • -
  • Fixed temporary launcher deletion bug.
  • -
- -

Changes in version 1.3.0 (01-11-2004)

-
    -
  • Now you can configure launch4j to: -
      -
    • Use a bundled JRE.
    • -
    • Search for java, show an error message if the - right version cannot be found and open the java download page.
    • -
    • And a feature you asked for: use bundled JRE, if - that fails search for java and bring up the java download page on error.
    • -
    -
  • -
  • Enhanced code that sets the custom process name. In - case launch4j can't refresh the temporary launcher, bundled JRE on a - read only file system for example, it will use one created previously, - if it's present and has the correct size. If not, launching will still - continue, but with javaw.exe process name.Temporary launchers are - now created in the jre directory instead of jre/bin. -
  • -
  • errTitle property allows to set the title of the error message box.
  • -
- -

Changes in version 1.2.1 (25-09-2004)

-
    -
  • Bugfix that allows launching from command line using short - name (#1026514 / found by Zach Del) -
  • -
- -

Changes in version 1.2.0 (10-09-2004)

-
    -
  • Custom process name (myapp.lch4j.exe)
  • -
  • 9 KB stub!
  • -
  • Jar arguments
  • -
  • Bugfix that allows launching from command line.
  • -
  • Hide splash on javaw error.
  • -
  • Easier configuration with case insensitive parameters + show unrecognized parameter.
  • -
  • 12 KB demo application, 34 KB with splash screen.
  • -
  • Configuration parameter 'args' changed to 'jvmArgs'
  • -
-
- -
- - + + + + Launch4j - Cross-platform Java executable wrapper + + + + + + + +
+
+ launch4j 3.50 +
+ +
+

Changelog

+ +

Changes in version 3.50 (13-11-2022)

+
    +
  • Ticket #218, #222 Support min/max version check during path search (Barry McGillin, Han Shum).
  • +
  • Ticket #224 Setting multiple relative paths for bundled JREs is not working (Wladimir Leite).
  • +
  • Simplified and consistent configuration for finding 64-Bit runtimes and JDKs during path and registry search.
  • +
  • Path is now the primary search, registry secondary for better compatibility with latest runtimes.
  • +
  • Please see the docs regarding configuration changes.
  • +
+ +

Changes in version 3.14 (07-03-2021)

+
    +
  • Updated dependencies and switched to Java 1.8.
  • +
  • Ticket #120 Switched to FlatLaf and removed WindowsLookAndFeel for multi-platform compatibility.
  • +
  • Ticket #211 Fixed JNI header missing file.
  • +
+ +

Changes in version 3.13 (03-02-2021)

+
    +
  • FR #127 Added multiple bundled JRE path search (%JAVA_HOME%).
  • +
  • Allow equal sign in environment variable assignments.
  • +
  • Fix sign4j warnings for implicit definition of lseek, read, write, close, and access (foss1024).
  • +
  • Add launch4j console mode launch script for *nix (Luke S).
  • +
  • Tickets #172, #186, #198, #200, #206 Launch4j GUI supports also Java 1.9 and up.
  • +
+ +

Changes in version 3.12 (17-05-2018)

+
    +
  • Ticket #179, #183 The generated executable fully supports Java 9 and newer (Sergey Karpushin).
  • +
  • Ticket #161 Support of update version higher than 99 (Sergey Karpushin).
  • +
  • Ticket #177 Launching on Java 9 JDK and newer is now possible (not just JRE).
  • +
  • Known issue: launch4j itself does not support Java 9 Early Access, use a public release instead or Java 10.
  • +
+ +

Changes in version 3.11 (27-06-2017)

+
    +
  • Log more regarding Java search and missing resources.
  • +
  • Log resource file during build.
  • +
  • Added basic Java 9 support (only major version is detected right now due to version scheme change).
  • +
  • Ticket #145 Allow literal use of % in JRE options and set environment variables, use %% (blueskyhigh).
  • +
  • Added Linux 64-bit binaries (Sebastian Bögl).
  • +
  • Added IBM Java 1.8 support.
  • +
  • JNI header: fixed a crash where launch4j would try to `free` non-heap memory (Alexander Floh).
  • +
  • Ticket #160 Removed old Mac OS X package which caused problems on newer versions of the system.
  • +
+ +

Changes in version 3.9 (20-07-2016)

+
    +
  • Ticket #146 Fixed java version check where the update number was greater than 99 (e.g. 1.8.0_101).
  • +
  • Enlarged the total classpath length to 30KB.
  • +
  • Ticket #142 Unbound VersionInfo returns wrong LanguageID (Sebastian Bögl).
  • +
  • Ticket #141 Ensure encoding of resource file to be iso-8859-1 (Thomas Scheithauer).
  • +
  • More reactive splash screen response to main window appearance (Federico Fissore).
  • +
  • FR #95 Launch4j should return an exit value (Sebastian Bögl).
  • +
  • FR #94 Add the working directory classifier for OS X (Sebastian Bögl).
  • +
  • FR #39 Launch Java VM through JNI (Ryan Rusaw) - BETA!
  • +
  • FR #69 Configure the language property of generated executables (Sebastian Bögl).
  • +
  • FR #77 Add legal trademarks as an additional field in version info tab (Sebastian Bögl).
  • +
  • Added a simple example how to use the Maven plugin (demo/ExitCodeApp).
  • +
+ +

Changes in version 3.8 (09-05-2015)

+
    +
  • FR #59 Mavenized launch4j (thanks to taxone, Paul Jungwirth, Lukasz Lenart).
  • +
  • Ticket #139 Sign4j compiles and works on Linux (Tim Angus).
  • +
+ +

Changes in version 3.7 (01-03-2015)

+
    +
  • Fixed false positive virus warnings that appeared in version 3.6.
  • +
+ +

Changes in version 3.6 (06-01-2015)

+
    +
  • FR #86 The 32/64 bit search is fully configurable (64, 64/32, 32/64, 32) - added option 32/64.
  • +
  • FR #70 Java search sequence - bundled JRE can be used before or after the min/max version search (bundledJreAsFallback).
  • +
  • Fixed: Crash when classpath contained wildcard patterns where the dependency was in the same directory as the launcher.
  • +
  • Fixed launch4j GUI application closing - the process was still running.
  • +
+ +

Changes in version 3.5 (09-10-2014)

+
    +
  • Ticket #75 Fixed exit value of -1 results in launch4j error.
  • +
  • Ticket #133, #134 Fixed runtimeBits JRE option.
  • +
  • FR #28, #72 Ability to restart the application based on exit code (Pascal Gruen, GK).
  • +
+ +

Changes in version 3.4 (21-04-2014)

+
    +
  • FR #61 Added a new special variable JREHOMEDIR (Stefan Knoefel).
  • +
  • Ticket #130 Removed ant from launch4j classpath to fix problems with other ant versions.
  • +
  • Updated JGoodies libraries.
  • +
  • Added logging based on launch4j environment variable for file association launch testing.
  • +
+ +

Changes in version 3.3 (02-04-2014)

+
    +
  • FR #60 Check the registry during JRE search, so that only valid runtimes are taken into account.
  • +
  • Ticket #128 Updated MAC OS X 10.8 windres to 2.24.51.20140326 - version info was compiled incorrectly (Code Buddy).
  • +
  • Added support for Japanese characters (Toshimm).
  • +
  • Ticket #82, #125 Take configuration encoding into account and save file with UTF-8 encoding.
  • +
+ +

Changes in version 3.2 (24-03-2014)

+
    +
  • Ticket #126, #127: Fixed crash when classpath was not defined.
  • +
  • Corrected problem with loading jvm options from ini file when bundled JRE is used.
  • +
  • FR #63, #80 Add possibility to configure 32/64 bit search.
  • +
  • Improved logging (--l4j-debug and --l4j-debug-all).
  • +
+ +

Changes in version 3.1.0-beta2 (20-08-2013)

+
    +
  • Removed the custom process name feature which was not compatible with newer Windows versions.
  • +
  • #121 Fixed heap calculation on systems with more than 4GB of memory.
  • +
  • #115 Added 64-bit bundled JRE option to control when the 32-bit maximum heap is applied.
  • +
  • Reduced the 32-bit max heap size to the safer 1GB.
  • +
  • Changes in --l4j-debug for better readability.
  • +
  • Fixed Can discard changes popup which appeared even if no changes were made.
  • +
  • Corrected permissions, owner and group in tgz packages.
  • +
  • #117 Fixed launch4j home dir search in case of jar and class files.
  • +
  • #111 Support paths with spaces in Linux systems.
  • +
  • #91 Linux launch4j starting script no longer changes the current directory.
  • +
  • #77 Allow line feeds in custom messages.
  • +
  • #57 Escape backslashes.
  • +
+ +

Changes in version 3.1.0-beta1 (02-12-2012)

+
    +
  • Migrated code to Java 1.6.
  • +
  • Updated binutils to 2.22
  • +
  • Added Max OS X x86 support (two versions).
  • +
  • Added feature to digitally sign executables - sign4j by the Bramfeld team, sponsored by Servoy.
  • +
  • FR #3569093 Support Windows Security Features of the Windows 8 certification kit (Luc Bruninx).
  • +
+ +

Changes in version 3.0.2 (02-01-2011)

+
    +
  • Fixed the command line in Exec error message.
  • +
  • Fixed set environment variable bug.
  • +
  • Added wrapper logging to launch4j GUI.
  • +
  • Fixed critical bug: heap size over the limit.
  • +
+ +

Changes in version 3.0.1 (20-07-2008)

+
    +
  • Enhanced the runtime logging (--l4j-debug).
  • +
  • Fixed critical bug #1925387 64-bit JDK detection problem caused a runtime search error (found by Stivo).
  • +
  • Fixed bug #1919406, #1989479 Not every option is loaded from saved xml file (found by Robert Lachner, Jan-Philipp Rathje).
  • +
  • Fixed bug #1930222 Simple typo (found by Daniel).
  • +
+ +

Changes in version 3.0.0 (16-03-2008)

+
    +
  • FR #1390075 Added dynamic initial/max heap values.
  • +
  • FR #1707827 Allow to prefer JDK private runtimes over JREs (Ian Roberts).
  • +
  • FR #1730245 Allow to run only a single aplication instance (Sylvain Mina).
  • +
  • FR #1391610 Added IBM JRE/JDK support.
  • +
  • Added environment variable expansion in bundled JRE path.
  • +
  • Fixed critical bug #1882524 JRE detection problem on 64-bit Windows.
  • +
  • Fixed bug #1758912 Vista elevation to full administrator privileges.
  • +
  • Fixed bug #1784341 Problems with spaces in paths under linux (Michael Piefel).
  • +
  • Fixed bug where /bin was appended to path environment variable instead of jre_path/bin.
  • +
+ +

Changed license to BSD, MIT (26-01-2008)

+
    +
  • + The upcoming Launch4j 3.0.0 release will be licensed under the much more + liberal new BSD license. The head subproject (the binary header attached to wrapped jars) + will be licensed under the similar MIT license. +
  • +
+ +

Changes in version 3.0.0-pre2 (29-10-2006)

+
    +
  • Enhanced GUI.
  • +
  • Redesigned error reporting.
  • +
  • Added custom error messages.
  • +
  • Added support website feature.
  • +
  • Added PWD and OLDPWD special variables and access to the registry.
  • +
  • Runtime ini file extension changed to .l4j.ini, added comments (#).
  • +
  • FR #1427811 Initial process priority.
  • +
  • FR #1547339 Added VarFileInfo structure to Version Info (Stephan Laertz).
  • +
  • FR #1584295 Updated documentation for --l4j-debug. +
  • Fixed <jarArgs/> and <args/> config conversion bug (found by Dafe Simonek).
  • +
  • Fixed the Ant task exception reporting bug, added tmpdir and bindir attributes.
  • +
  • Fixed bug #1563415 Problem with launching application when ini file exists (found by mojomax).
  • +
  • Fixed bug #1527619 Console header wildcard expansion (found by erikjv).
  • +
  • Fixed bug #1544167 NPE when dontwrap and only classpath given (found by Hendrik Schreiber).
  • +
  • Fixed bug #1584264 Dropdown boxes get mixed up (found by Larsen).
  • +
+ +

News (17-10-2006)

+ + +

Changes in version 3.0.0-pre1 (21-07-2006)

+
    +
  • Improved configuration file format and embedded Ant config.
  • +
  • Launch executable jars, regular jars and class files.
  • +
  • Added dynamic classpath resolution with environment variable references and wildcards.
  • +
  • Added option to set environment variables before launching the application.
  • +
  • New command line switches to change the compiled options.
  • +
  • Improved debug information.
  • +
  • Added support for XP visual style manifests.
  • +
  • Added option to disable use of private JREs.
  • +
  • Many small fixes and improvements...
  • +
+ +

Configuration file changes in 3.x

+
    +
  • Previous formats (1.x and 2.x) are supported.
  • +
  • <headerType> accepts gui|console
  • +
  • <jarArgs> was changed to <cmdLine>
  • +
  • + <launch4jConfig><headerObjects><file> was changed to + <launch4jConfig><obj> +
  • +
  • + <launch4jConfig><libs><file> was changed to + <launch4jConfig><lib> +
  • +
  • + <launch4jConfig><jre><args> was changed to multiple + <launch4jConfig><jre><opt> +
  • +
+ +

Embedded Ant configuration changes in 3.x

+
    +
  • + <jre args="value"> was changed to + <jre><opt>value</opt></jre> +
  • +
  • Now it's possible to define headerObjects, libs and classpath.
  • +
+ +

Changes in version 2.1.5 (21-07-2006)

+
    +
  • Changed the Java download site to http://java.com/download.
  • +
  • Now it's possible to use absolute and relative paths to specify the bundled JRE.
  • +
+ +

Changes in version 2.1.4 (15-06-2006)

+
    +
  • + Fixed bug #1503996 Only the first wrapper instance had a custom process name + (found by Helge Böhme). +
  • +
+ +

Changes in version 2.1.3 (31-05-2006)

+
    +
  • + Fixed bug #1497453 Ant task doesn't support relative jar path with '..' + (found by Aston, Pavel Moukhataev). +
  • +
  • Jar argument size limit is now 16KB.
  • +
  • Environment variable size limit raised to 32KB.
  • +
  • Allow to concatenate multiple env. variables in one property (Maria D.)
  • +
  • Added launch4j.tmpdir property.
  • +
+ +

Changes in version 2.1.2 (03-04-2006)

+
    +
  • Important bugfix: insufficient command line buffer size was increased to 32KB + (found by Sebastian Kopsan).
  • +
  • Added runtime JVM options from an .ini file.
  • +
  • Launch4j's bin directory is now configurable through launch4j.bindir + system property.
  • +
+ +

Changes in version 2.1.1 (25-01-2006)

+
    +
  • Fixed bug #1402748. Validation error occurred when using an Ant task with + embedded config and dontWrapJar option (found by Chris Nokleberg).
  • +
+ +

Changes in version 2.1.0 (10-01-2006)

+
    +
  • More features and smaller header: 18 KB!!
  • +
  • Added launcher mode, you can choose whether or not to wrap the jar.
  • +
  • Spanish translation of the website/docs and program messages + (Patricio Martínez Ros).
  • +
  • JRE's bin directory is appended to the Path environment variable + (Ianiv Schweber).
  • +
  • Added special variables EXEDIR and EXEFILE that hold the executable's + directory and full path.
  • +
  • Support for mapping environment variables to system properties.
  • +
  • Added debug launching mode - various information is displayed before + starting the Java application.
  • +
  • Fixed min/max JRE version checking, previous versions allowed these + to be equal (found by Ryan).
  • +
  • Bug fixed. Quotes in jar/JVM arguments were handled incorrectly (found by Juan Alvarez Ferrando).
  • +
  • A few other enhancements.
  • +
+ +

Changes in version 2.0.0 (31-10-2005)

+
    +
  • Launch4j for Mac OS X is available thanks to Peter Centgraf.
  • +
  • Added support for custom headers.
  • +
  • Fixed bug #1343908, command line arguments with spaces were handled + incorrectly by the console header (found by Oliver Schaefer / Steve Alberty).
  • +
  • Fixed stdin redirection bug (found by Timo Santasalo).
  • +
+ +

Changes in version 2.0 RC3 (13-08-2005) - final RC

+
    +
  • Correct handling of pathnames with spaces.
  • +
  • Fixed the '%20' pathname bug.
  • +
  • Fixed basedir bug (Richard Xing).
  • +
  • Splash screen can be closed when the application window becomes visible + with out specifying it's title (Martin Busik). + Update your config file: <waitForTitle>title</waitForTitle> + is now <waitForWindow>true</waitForWindow>. +
  • +
  • Fixed build.bat files in demo directories.
  • +
+ +

Changes in version 2.0 RC2 (21-06-2005)

+
    +
  • chdir allows to change the current directory to arbitrary paths + relative to the executable (FR #1144907). It's incompatible with + previous versions, update your config file: + <chdir>true</chdir> + is now <chdir>.</chdir>. +
  • +
  • Bundled JRE path no longer depends on chdir function.
  • +
  • Fixed Ant task bug, build files outside launch4j's directory + wouldn't work. Josh Elsasser submitted a patch that works without + setting launch4j's home dir in the build file. Thanks! +
  • +
  • Removed static edge from splash screen (Serge Baranov).
  • +
  • Program checks that the output file path doesn't contain spaces.
  • +
  • Fixed a NPE bug caused by a missing maxVersion property + (found by Morgan Schweers). +
  • +
  • Fixed relative JRE path bug (found by Nili_).
  • +
  • Cleaned up the Builder class.
  • +
  • Fixed Ant task NPE where the config was entirely defined in the + build file (Josh Elsasser). +
  • +
+ +

Changes in version 2.0 RC (07-06-2005)

+
    +
  • Added an Ant task for better build integration.
  • +
  • Added 2.x documentation.
  • +
  • Updated the demo configuration files.
  • +
  • Fixed issues with relative paths in the configuration.
  • +
  • Removed the '-1' option in console mode.
  • +
  • Minor fixes.
  • +
+ +

Changes in version 2.0 beta2 (23-05-2005)

+
    +
  • # comments are recognized when importing 1.x cfg files.
  • +
  • Added version information.
  • +
  • Resource file is displayed when a resource error occurs.
  • +
  • Fixed a bug found by Max, options on the first tab were always enabled.
  • +
+ +

Changes in version 2.0 beta1 (13-05-2005)

+
    +
  • Completely new, cross-platform wrapper - create windows executables on Linux.
  • +
  • New .xml configuration file.
  • +
  • Application icon with multiple resolutions and color depths.
  • +
  • Swing GUI interface.
  • +
  • Header compiled with MinGW port of gcc instead of VC++.
  • +
+ +

Changes in version 1.4.2 (12-03-2005)

+
    +
  • Fixed bug #1158143, stayAlive without a splash screen caused + an infinite loop (found by Gregory Kotsaftis). +
  • +
+ +

Changes in version 1.4.1 (04-03-2005)

+
    +
  • Fixed bug #1119040, buffer for reading config properties + was too short (found by Tom Jensen and Neil). +
  • +
  • Added configurable splash timeout (FR #1102951).
  • +
  • Added option to disable the error message on splash timeout (FR #1109159).
  • +
  • Option to keep the gui launcher 'alive' after starting an application (FR #1124653).
  • +
  • Removed version info.
  • +
  • 'waitfor' property is now optional.
  • +
+ +

Changes in version 1.4.0 (26-01-2005)

+
    +
  • Removed .lch4j suffix from process name, now it has the + form of the executable filename. The temporary launchers are stored in + launch4j-tmp directory (suggested by Emmanuel). +
  • +
  • Added support for console apps (FR #1050053).
  • +
+ +

Changes in version 1.3.1 (05-11-2004)

+
    +
  • Fixed a bug where explorer window was opened instead of + launching the application when setProcName was set to false + (found by Rob Jones). +
  • +
  • Fixed temporary launcher deletion bug.
  • +
+ +

Changes in version 1.3.0 (01-11-2004)

+
    +
  • Now you can configure launch4j to: +
      +
    • Use a bundled JRE.
    • +
    • Search for java, show an error message if the + right version cannot be found and open the java download page.
    • +
    • And a feature you asked for: use bundled JRE, if + that fails search for java and bring up the java download page on error.
    • +
    +
  • +
  • Enhanced code that sets the custom process name. In + case launch4j can't refresh the temporary launcher, bundled JRE on a + read only file system for example, it will use one created previously, + if it's present and has the correct size. If not, launching will still + continue, but with javaw.exe process name.Temporary launchers are + now created in the jre directory instead of jre/bin. +
  • +
  • errTitle property allows to set the title of the error message box.
  • +
+ +

Changes in version 1.2.1 (25-09-2004)

+
    +
  • Bugfix that allows launching from command line using short + name (#1026514 / found by Zach Del) +
  • +
+ +

Changes in version 1.2.0 (10-09-2004)

+
    +
  • Custom process name (myapp.lch4j.exe)
  • +
  • 9 KB stub!
  • +
  • Jar arguments
  • +
  • Bugfix that allows launching from command line.
  • +
  • Hide splash on javaw error.
  • +
  • Easier configuration with case insensitive parameters + show unrecognized parameter.
  • +
  • 12 KB demo application, 34 KB with splash screen.
  • +
  • Configuration parameter 'args' changed to 'jvmArgs'
  • +
+
+ +
+ + diff --git a/launch4j/web/docs.html b/launch4j/web/docs.html index bd4f6f4..292cadf 100644 --- a/launch4j/web/docs.html +++ b/launch4j/web/docs.html @@ -1,742 +1,716 @@ - - - - Launch4j - Cross-platform Java executable wrapper - - - - - - - -
-
- launch4j 3.12 -
- -
-Running launch4j
-Configuration file
-Importing 1.x configuration
-Ant Task
-Additional JVM options at runtime
-Runtime options
-Settings
- -

Running launch4j

-Run launch4j.exe or launch4j script without command -line arguments to enter the GUI mode. - -
launch4j.exe
- -To wrap a jar in console mode use launch4jc.exe and -specify the configuration file. - -
launch4jc.exe config.xml
- -On Linux use the launch4j script. - -
launch4j ./demo/l4j/config.xml
- -

Configuration file

-Launch4j requires an xml configuration file for each output executable. -You can create and edit it conveniently using the graphic user -interface or your favorite editor. Alternatively it's possible to pass -all of the configuration parameters through the Ant task. All files -may be absolute paths or relative to the configuration file path. - -
-<!--
-  Bold elements are required.
-  Underlined values are the default when the element is not specified.
-  %VAR% expands environment/special variables and registry keys.
--->
-<launch4jConfig>
-  <headerType>gui|console|jniGui32|jniConsole32</headerType>
-  <outfile>file.exe</outfile>
-  <jar>file</jar>
-  <dontWrapJar>true|false</dontWrapJar>
-  <errTitle>application name</errTitle>
-  <downloadUrl>http://java.com/download</downloadUrl>
-  <supportUrl>url</supportUrl>
-  <cmdLine>text</cmdLine>
-  <chdir>path</chdir>
-  <priority>normal|idle|high</priority>
-  <stayAlive>true|false</stayAlive>
-  <restartOnCrash>true|false</restartOnCrash>
-  <icon>file</icon>
-  <obj>header object file</obj>
-  ...
-  <lib>w32api lib</lib>
-  ...
-  <var>var=text (%VAR%)</var>
-  ...
-  <classPath>
-    <mainClass>main class</mainClass>
-    <cp>classpath (%VAR%)</cp>
-    ...
-  </classPath>
-  <singleInstance>
-    <mutexName>text</mutexName>
-    <windowTitle>text</windowTitle>
-  </singleInstance> 
-  <jre>
-    <!-- Specify path or minVersion or both. -->
-    <path>bundled JRE path (%VAR%)</path>
-    <bundledJre64Bit>true|false</bundledJre64Bit>
-    <bundledJreAsFallback>true|false</bundledJreAsFallback>
-    <minVersion>1.x.x[_xxx]|xxx[.xxx[.xxx]]</minVersion>
-    <maxVersion>1.x.x[_xxx]|xxx[.xxx[.xxx]]</maxVersion>
-    <jdkPreference>jreOnly|preferJre|preferJdk|jdkOnly</jdkPreference>
-    <runtimeBits>64|64/32|32/64|32</runtimeBits>
-    <!-- Heap sizes in MB and % of available memory. -->
-    <initialHeapSize>MB</initialHeapSize>
-    <initialHeapPercent>%</initialHeapPercent>
-    <maxHeapSize>MB</maxHeapSize>
-    <maxHeapPercent>%</maxHeapPercent>
-    <opt>text (%VAR%)</opt>
-    ...
-  </jre>
-  <splash>
-    <file>file</file>
-    <waitForWindow>true|false</waitForWindow>
-    <timeout>seconds [60]</timeout>
-    <timeoutErr>true|false</timeoutErr>
-  </splash>
-  <versionInfo>
-    <fileVersion>x.x.x.x</fileVersion>
-    <txtFileVersion>text</txtFileVersion>
-    <fileDescription>text</fileDescription>
-    <copyright>text</copyright>
-    <productVersion>x.x.x.x</productVersion>
-    <txtProductVersion>text</txtProductVersion>
-    <productName>text</productName>
-    <companyName>text</companyName>
-    <internalName>filename</internalName>
-    <originalFilename>filename.exe</originalFilename>
-    <trademarks>text</trademarks>
-    <language>
-      ALBANIAN|ARABIC|BAHASA|DUTCH_BELGIAN|FRENCH_BELGIAN|BULGARIAN|
-      FRENCH_CANADIAN|CASTILIAN_SPANISH|CATALAN|CROATO_SERBIAN_LATIN|
-      CZECH|DANISH|DUTCH|ENGLISH_UK|ENGLISH_US|FINNISH|FRENCH|GERMAN|
-      GREEK|HEBREW|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|
-      NORWEGIAN_BOKMAL|NORWEGIAN_NYNORSK|POLISH|PORTUGUESE_BRAZIL|
-      PORTUGUESE_PORTUGAL|RHAETO_ROMANIC|ROMANIAN|RUSSIAN|
-      SERBO_CROATIAN_CYRILLIC|SIMPLIFIED_CHINESE|SLOVAK|SPANISH_MEXICO|
-      SWEDISH|FRENCH_SWISS|GERMAN_SWISS|ITALIAN_SWISS|THAI|
-      TRADITIONAL_CHINESE|TURKISH|URDU
-    </language>
-  </versionInfo>
-  <messages>
-    <startupErr>text</startupErr>
-    <bundledJreErr>text</bundledJreErr>
-    <jreVersionErr>text</jreVersionErr>
-    <launcherErr>text</launcherErr>
-    <!-- Used by console header only. -->
-    <instanceAlreadyExistsMsg>text</instanceAlreadyExistsMsg>
-  </messages>
-</launch4jConfig>
-
- -
-
<headerType>
-
- Type of the header used to wrap the application. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Header typeLauncherSplash screenWait for the application to close
guijavawyeswrapper waits only if stayAlive is set to true, - otherwise it terminates immediately or after closing - the splash screen. -
consolejavanoalways waits and returns application's exit code.
jniGui32 (beta)launch4jyesalways waits and returns application's exit code.
jniConsole32 (beta)launch4jnoalways waits and returns application's exit code.
-
- When JNI headers are used the JVM is created directly by the launch4j wrapper executable instead of running java/javaw launchers. - The process name will be the same as the wrapper. The JNI headers are in BETA and some features are not available which is signaled - during wrapper build based on the configuration. - For production use consider the classic gui/console headers. -
- Missing features: -
    -
  • Only '.' is allowed in change directory (chdir).
  • -
  • Command line arguments cannot be passed to the executable.
  • -
  • Constant command line arguments (cmdLine).
  • -
  • stayAlive should be ignored by JNI headers.
  • -
  • Restart of appplication based on exit code (restartOnCrash).
  • -
  • Process priority - only normal is supported (priority).
  • -
  • Jar manifest is ignored, mainclass and classpath must be defined.
  • -
  • 64-bit JRE are not supported.
  • -
-
-
-
-
<outfile>
-
Output executable file.
-
-
-
<jar>
-
- Optional, by default specifies the jar to wrap. To launch a jar without - wrapping it enter the runtime path of the jar relative to - the executable and set <dontWrapJar> to true. - For example, if the executable launcher and the application jar named - calc.exe and calc.jar are in the same directory - then you would use <jar>calc.jar</jar> - and <dontWrapJar>true</dontWrapJar>. -
-
-
-
<dontWrapJar>
-
- Optional, defaults to false. Launch4j by default wraps jars in native - executables, you can prevent this by setting <dontWrapJar> to true. - The exe acts then as a launcher and starts the application specified in - <jar> or <classPath><mainClass> -
-
-
-
<errTitle>
-
- Optional, sets the title of the error message box that's displayed if Java cannot - be found for instance. This usually should contain the name of your - application. The console header prefixes error messages with this - property (myapp: error...) -
-
-
-
<cmdLine>
-
Optional, constant command line arguments.
-
-
-
<chdir>
-
Optional. Change current directory to an arbitrary path relative to the executable. - If you omit this property or leave it blank it will have no effect. - Setting it to . will change the current dir to the same directory - as the executable. .. will change it to the parent directory, and so on. -
-
-
<chdir>.</chdir>
-
-
-
<chdir>../somedir</chdir>
-
-
-
-
<stayAlive>
-
Optional, defaults to false in GUI header, always true in console header. - When enabled the launcher waits for the Java application - to finish and returns it's exit code. -
-
-
-
<restartOnCrash>
-
Optional, defaults to false. - When the application exits, any exit code other than 0 is considered a crash and the application will be started again. -
-
-
-
<icon>
-
Application icon in ICO format. May contain multiple color depths/resolutions.
-
-
-
<obj>
-
Optional, custom headers only. Ordered list of header object files.
-
-
-
<lib>
-
Optional, custom headers only. Ordered list of libraries used by header.
-
-
-
<singleInstance>
-
Optional, allow to run only a single instance of the application.
-
-
-
-
<mutexName>
-
Unique mutex name that will identify the application.
-
<windowTitle>
-
Optional, recognized by GUI header only. Title or title part of a window - to bring up instead of running a new instance. -
-
-
-
-
<jre>
-
Required element that groups JRE settings.
-
-
-
-
<path>, <minVersion>, <maxVersion>
-
The <path> property is used - to specify the absolute or relative path (to the executable) of a bundled JRE, it - does not rely on the current directory or <chdir>. - Note that this path is not checked until the actual application execution. - If you'd like the wrapper to search for a JRE (public or SDK private) - use the <minVersion> property, you may also specify - the <maxVersion> to prevent it from using higher Java versions. - Launch4j will always use the highest version available (in the min/max range of course). - If an Oracle's JRE is not available or does not satisfy the search criteria, - the search will be repeated on IBM runtimes. - You can also combine these properties to change the startup process... -
-
-
-
-
<path>
-
Run if bundled JRE and javaw.exe are present, otherwise stop with error.
-
<path> + <minVersion>  [+ <maxVersion>]
-
Use bundled JRE first, if it cannot be located search for Java, - if that fails display error message and open the Java download page. -
-
<minVersion>  [+ <maxVersion>]
-
Search for Java, if an appropriate version cannot be found display - error message and open the Java download page. -
-
-
-
-
-
-
<minVersion>, <maxVersion> format - Java < 9
-
The traditional version scheme supported by launch4j is 1.x.x[_xxx] and requires at least 3 parts, for example: -
-1.6.0
-1.7.0_51
-1.8.0_121
-
-
-
-
-
-
-
<minVersion>, <maxVersion> format - Java >= 9
-
The new version format is xxx[.xxx[.xxx]] where only 1 part is required and the update version after the underscore is not allowed. -
-1.6
-9
-10.0.1
-
-
-
-
-
-
-
<bundledJre64Bit>
-
Optional, defaults to false which limits the calculated heap size to the 32-bit maximum. - Set to true in order to use the available memory without this limit. This option works - in combination with the HeapSize and HeapPercent options only if the found JRE is a bundled one. - In the standard JRE search based on registry the wrapper detects the type of JRE itself - and uses the 32-bit heap limit when needed. -
-
-
-
-
-
<bundledJreAsFallback>
-
Optional, defaults to false which treats the bundled JRE as the primary runtime. - When set to true, the bundled JRE will only be used in case the mix/max version search fails. - This can be used as a fallback option if the user does not have the required Java installed - and the bundled JRE is provided on a CD or shared network location. -
-
-
-
-
-
<jdkPreference>
-
Optional, defaults to preferJre; Allows you to specify a preference - for a public JRE or a private JDK runtime. Valid values are: -
-
-
-
-
jreOnly
-
Always use a public JRE (equivalent to the - old option dontUsePrivateJres=true)
-
preferJre
-
Prefer a public JRE, but use a JDK private - runtime if it is newer than the public - JRE (equivalent to the old option - dontUsePrivateJres=false)
-
preferJdk
-
Prefer a JDK private runtime, but use a - public JRE if it is newer than the JDK -
-
jdkOnly
-
Always use a private JDK runtime (fails - if there is no JDK installed) -
-
-
-
-
<runtimeBits>
-
Optional, defaults to 64/32; Allows to select between 64-bit and 32-bit runtimes. - Valid values are: -
-
-
-
-
64
-
Use only 64-bit runtimes
-
64/32
-
Use 64-bit runtimes if available, otherwise use 32-bit
-
32/64
-
Use 32-bit runtimes if available, otherwise use 64-bit
-
32
-
Use only 32-bit runtimes
-
-
-
-
HeapSize, HeapPercent
-
If size and percent are specified, then the setting which yields - more memory will be chosen at runtime. In other words, setting both values - means: percent of available memory no less than size in MB. -
-
-
-
-
<initialHeapSize>
-
Optional, initial heap size in MB.
-
-
-
<initialHeapPercent>
-
Optional, initial heap size in % of available memory.
-
-
-
<maxHeapSize>
-
Optional, max heap size in MB.
-
-
-
<maxHeapPercent>
-
Optional, max heap size in % of available memory.
-
-
-
-
<opt>
-
Optional, accepts everything you would normally pass to - java/javaw launcher: assertion options, system properties and X options. - Here you can map environment and special variables EXEDIR - (exe's runtime directory), EXEFILE (exe's runtime full file path) - to system properties. All variable references must be surrounded with - percentage signs and quoted. -
-<opt>-Dlaunch4j.exedir="%EXEDIR%"</opt>
-<opt>-Dlaunch4j.exefile="%EXEFILE%"</opt>
-<opt>-Denv.path="%Path%"</opt>
-<opt>-Dsettings="%HomeDrive%%HomePath%\\settings.ini"</opt>
-
-
-
-
- -
-
<splash>
-
Optional, groups the splash screen settings. Allowed only in GUI header.
-
-
-
-
<file>
-
Splash screen image in BMP format.
-
-
-
<waitForWindow>
-
Optional, defaults to true. Close the splash screen when an application - window or Java error message box appears. If set to false, - the splash screen will be closed on timeout. -
-
-
-
<timeout>
-
Optional, defaults to 60. Number of seconds after which the splash screen - must be closed. Splash timeout may cause an error depending on - <timeoutErr>. -
-
-
-
<timeoutErr>
-
Optional, defaults to true. True signals an error on splash timeout, - false closes the splash screen quietly. -
-
-
- -
-
<versionInfo>
-
Optional, version information - to be displayed by the Windows Explorer.
-
-
-
-
<fileVersion>
-
Version number 'x.x.x.x'
-
-
-
<txtFileVersion>
-
Free form file version, for example '1.20.RC1'.
-
-
-
<fileDescription>
-
File description presented to the user.
-
-
-
<copyright>
-
Legal copyright.
-
-
-
<productVersion>
-
Version number 'x.x.x.x'
-
-
-
<txtProductVersion>
-
Free form file version, for example '1.20.RC1'.
-
-
-
<productName>
-
Text.
-
-
-
<companyName>
-
Optional text.
-
-
-
<internalName>
-
Internal name without extension, original filename or module name for example.
-
-
-
<originalFilename>
-
Original name of the file without the path. Allows to determine - whether a file has been renamed by a user. -
-
-
-
<trademarks>
-
Trademarks that apply to the file.
-
-
-
<language>
-
One of the language codes.
-
-
- -

Importing 1.x configuration

-It's possible to import a 1.x configuration file using the GUI -interface. Open the file, correct the paths and save it as a new xml -configuration. - -

Ant task

-You may set a launch4j directory property or change the task definition. - -
<property name="launch4j.dir" location="/opt/launch4j" />
- -Define the task in your Ant build script. - -
-<taskdef name="launch4j"
-    classname="net.sf.launch4j.ant.Launch4jTask"
-    classpath="${launch4j.dir}/launch4j.jar
-        :${launch4j.dir}/lib/xstream.jar" />
-
- -Execute the task! - -
<launch4j configFile="./l4j/demo.xml" />
- -You can set or override the following configuration properties... -

- jar="absolute path or relative to basedir"
- jarPath="relative path"
- outfile
- fileVersion
- txtFileVersion
- productVersion
- txtProductVersion
- bindir="alternate bin directory..."
- tmpdir="alternate working directory..." -

- -
-<launch4j configFile="./l4j/demo.xml" outfile="mydemo.exe"
-    fileVersion="1.0.0.0" txtFileVersion="1.0 RC2" />
-
- -You can also define the entire configuration in the task, but it will -not be possible to edit such a file in the GUI mode. All paths except -for <chdir>, <jre><path> and jarPath -are calculated using the basedir project attribute. - -
-<launch4j>
-  <config headerType="gui" outfile="demo.exe"
-      dontWrapJar="true" jarPath="demo.jar" >
-    <var>SETTINGS="%HomeDrive%%HomePath%\\settings.ini"</var>
-    <classPath mainClass="org.demo.DemoApp">
-        <cp>./lib/looks.jar</cp>
-        <cp>%USER_LIBS%/*.jar</cp>
-    </classPath>
-    <jre minVersion="1.4.0">
-        <opt>-Dlaunch4j.exedir="%EXEDIR%"</opt>
-        <opt>-Dlaunch4j.exefile="%EXEFILE%"</opt>
-    </jre>
-  </config>
-</launch4j>
-
- -

Additional JVM options at runtime

-When you create a wrapper or launcher all configuration details are compiled into the -executable and cannot be changed without recreating it or hacking with a resource editor. -Launch4j 2.1.2 introduces a new feature that allows to pass additional JVM options -at runtime from an .l4j.ini file. Now you can specify the options in the configuration file, -ini file or in both, but you cannot override them. The ini file's name must correspond -to the executable's (myapp.exe : myapp.l4j.ini). -The arguments should be separated with spaces or new lines, environment variable -expansion is supported, for example: -
-# Launch4j runtime config
--Dswing.aatext=true
--Dsomevar="%SOMEVAR%"
--Xms16m
-
- -

Environemnt variables

-The following variables can be used in the configuration file (elements which contain %VAR%). -They are substitued during runtime, so for example the EXEDIR is the directory where the user installed the wrapped application. -
-
%VAR%
-
- Any environment variable, for example %HOMEPATH%. -
- -
%EXEDIR%
-
- Wrapper directory path. -
- -
%EXEFILE%
-
- Wrapper executable file path. -
- -
%PWD%
-
- Current directory, after chdir was applied. -
- -
%OLDPWD%
-
- Directory before chdir was applied. -
- -
%JREHOMEDIR%
-
- Path to the JRE which was selected for executing the application. -
- -
%HKEY_...\...%
-
- Registry key value, e.g.
- %HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MemoryDiagnostic\LastScanTime% -
-
- -

Runtime options

-
-
--l4j-debug
-
- To make sure the output executable is configured correctly you can use the - debug launching mode to log various information to the launch4j.log file. - Environment variable can also be used...
- SET Launch4j=debug -
- -
--l4j-debug-all
-
- Same as above, but additionally log loaded resources (options stored during wrapper creation). - Environment variable can also be used...
- SET Launch4j=debug-all -
- -
--l4j-dont-wait
-
- Disable the "stay alive" function. -
- -
--l4j-no-splash
-
- Disable the splash screen. -
- -
--l4j-no-splash-err
-
- Disable splash screen error on timeout, might be useful on very slow computers. -
-
- -

Settings

-These settings are only used during building of the launcher or wrapper, not during their execution. -
-
Alternate bin directory: launch4j.bindir
-
- It's possible to override the default bin directory location which contains windres and ld - tools using the launch4j.bindir system property. The property can have two forms: - a path relative to Launch4j's directory (altbin for example) or an absolute path. -
- -
Working directory: launch4j.tmpdir
-
Change the working directory if the default path contains spaces which windres cannot handle.
-
-
- -
- - + + + + Launch4j - Cross-platform Java executable wrapper + + + + + + + +
+
+ launch4j 3.50 +
+ +
+Running launch4j
+Configuration file
+Importing 1.x configuration
+Ant Task
+Additional JVM options at runtime
+Runtime options
+Settings
+ +

Running launch4j

+Run launch4j.exe or launch4j script without command +line arguments to enter the GUI mode. + +
launch4j.exe
+ +To wrap a jar in console mode use launch4jc.exe and +specify the configuration file. + +
launch4jc.exe config.xml
+ +On Linux use the launch4j script. + +
launch4j ./demo/l4j/config.xml
+ +

Configuration file

+Launch4j requires an xml configuration file for each output executable. +You can create and edit it conveniently using the graphic user +interface or your favorite editor. Alternatively it's possible to pass +all of the configuration parameters through the Ant task. All files +may be absolute paths or relative to the configuration file path.
+Launch4j 3.50 Configuration changes: +
    +
  • Removed <bundledJreAsFallback>, path search is always first and registry search second + in order to improve compatibility with modern runtimes.
  • +
  • Replaced <bundledJre64Bit> and <runtimeBits> with <requires64Bit> + which works during path and registry search.
  • +
  • Replaced <jdkPreference> with <requiresJdk> which works during path and registry search.
  • +
  • Replaced <bundledJreErr> with <jreNotFoundErr>. +
  • <minVersion> and <maxVersion> are now used during path and registry search, previously + they were only checked during registry search.
  • +
+ +
+<!--
+  Bold elements are required.
+  Underlined values are the default when the element is not specified.
+  %VAR% expands environment/special variables and registry keys.
+-->
+<launch4jConfig>
+  <headerType>gui|console|jniGui32|jniConsole32</headerType>
+  <outfile>file.exe</outfile>
+  <jar>file</jar>
+  <dontWrapJar>true|false</dontWrapJar>
+  <errTitle>application name</errTitle>
+  <downloadUrl>http://java.com/download</downloadUrl>
+  <supportUrl>url</supportUrl>
+  <cmdLine>text</cmdLine>
+  <chdir>path</chdir>
+  <priority>normal|idle|high</priority>
+  <stayAlive>true|false</stayAlive>
+  <restartOnCrash>true|false</restartOnCrash>
+  <icon>file</icon>
+  <obj>header object file</obj>
+  ...
+  <lib>w32api lib</lib>
+  ...
+  <var>var=text (%VAR%)</var>
+  ...
+  <classPath>
+    <mainClass>main class</mainClass>
+    <cp>classpath (%VAR%)</cp>
+    ...
+  </classPath>
+  <singleInstance>
+    <mutexName>text</mutexName>
+    <windowTitle>text</windowTitle>
+  </singleInstance> 
+  <jre>
+    <path>JRE path (%VAR%)</path>
+    <requiresJdk>true|false</requiresJdk>
+    <requires64Bit>true|false</requires64Bit>
+    <minVersion>1.x.x[_xxx]|xxx[.xxx[.xxx]]</minVersion>
+    <maxVersion>1.x.x[_xxx]|xxx[.xxx[.xxx]]</maxVersion>
+    <!-- Heap sizes in MB and % of available memory. -->
+    <initialHeapSize>MB</initialHeapSize>
+    <initialHeapPercent>%</initialHeapPercent>
+    <maxHeapSize>MB</maxHeapSize>
+    <maxHeapPercent>%</maxHeapPercent>
+    <opt>text (%VAR%)</opt>
+    ...
+  </jre>
+  <splash>
+    <file>file</file>
+    <waitForWindow>true|false</waitForWindow>
+    <timeout>seconds [60]</timeout>
+    <timeoutErr>true|false</timeoutErr>
+  </splash>
+  <versionInfo>
+    <fileVersion>x.x.x.x</fileVersion>
+    <txtFileVersion>text</txtFileVersion>
+    <fileDescription>text</fileDescription>
+    <copyright>text</copyright>
+    <productVersion>x.x.x.x</productVersion>
+    <txtProductVersion>text</txtProductVersion>
+    <productName>text</productName>
+    <companyName>text</companyName>
+    <internalName>filename</internalName>
+    <originalFilename>filename.exe</originalFilename>
+    <trademarks>text</trademarks>
+    <language>
+      ALBANIAN|ARABIC|BAHASA|DUTCH_BELGIAN|FRENCH_BELGIAN|BULGARIAN|
+      FRENCH_CANADIAN|CASTILIAN_SPANISH|CATALAN|CROATO_SERBIAN_LATIN|
+      CZECH|DANISH|DUTCH|ENGLISH_UK|ENGLISH_US|FINNISH|FRENCH|GERMAN|
+      GREEK|HEBREW|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|
+      NORWEGIAN_BOKMAL|NORWEGIAN_NYNORSK|POLISH|PORTUGUESE_BRAZIL|
+      PORTUGUESE_PORTUGAL|RHAETO_ROMANIC|ROMANIAN|RUSSIAN|
+      SERBO_CROATIAN_CYRILLIC|SIMPLIFIED_CHINESE|SLOVAK|SPANISH_MEXICO|
+      SWEDISH|FRENCH_SWISS|GERMAN_SWISS|ITALIAN_SWISS|THAI|
+      TRADITIONAL_CHINESE|TURKISH|URDU
+    </language>
+  </versionInfo>
+  <messages>
+    <startupErr>text</startupErr>
+    <jreNotFoundErr>text</jreNotFoundErr>
+    <jreVersionErr>text</jreVersionErr>
+    <launcherErr>text</launcherErr>
+    <!-- Used by console header only. -->
+    <instanceAlreadyExistsMsg>text</instanceAlreadyExistsMsg>
+  </messages>
+</launch4jConfig>
+
+ +
+
<headerType>
+
+ Type of the header used to wrap the application. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Header typeLauncherSplash screenWait for the application to close
guijavawyeswrapper waits only if stayAlive is set to true, + otherwise it terminates immediately or after closing + the splash screen. +
consolejavanoalways waits and returns application's exit code.
jniGui32 (beta)launch4jyesalways waits and returns application's exit code.
jniConsole32 (beta)launch4jnoalways waits and returns application's exit code.
+
+ When JNI headers are used the JVM is created directly by the launch4j wrapper executable instead of running java/javaw launchers. + The process name will be the same as the wrapper. The JNI headers are in BETA and some features are not available which is signaled + during wrapper build based on the configuration. + For production use consider the classic gui/console headers. +
+ Missing features: +
    +
  • Only '.' is allowed in change directory (chdir).
  • +
  • Command line arguments cannot be passed to the executable.
  • +
  • Constant command line arguments (cmdLine).
  • +
  • stayAlive should be ignored by JNI headers.
  • +
  • Restart of appplication based on exit code (restartOnCrash).
  • +
  • Process priority - only normal is supported (priority).
  • +
  • Jar manifest is ignored, mainclass and classpath must be defined.
  • +
  • 64-bit JRE are not supported.
  • +
+
+
+
+
<outfile>
+
Output executable file.
+
+
+
<jar>
+
+ Optional, by default specifies the jar to wrap. To launch a jar without + wrapping it enter the runtime path of the jar relative to + the executable and set <dontWrapJar> to true. + For example, if the executable launcher and the application jar named + calc.exe and calc.jar are in the same directory + then you would use <jar>calc.jar</jar> + and <dontWrapJar>true</dontWrapJar>. +
+
+
+
<dontWrapJar>
+
+ Optional, defaults to false. Launch4j by default wraps jars in native + executables, you can prevent this by setting <dontWrapJar> to true. + The exe acts then as a launcher and starts the application specified in + <jar> or <classPath><mainClass> +
+
+
+
<errTitle>
+
+ Optional, sets the title of the error message box that's displayed if Java cannot + be found for instance. This usually should contain the name of your + application. The console header prefixes error messages with this + property (myapp: error...) +
+
+
+
<cmdLine>
+
Optional, constant command line arguments.
+
+
+
<chdir>
+
Optional. Change current directory to an arbitrary path relative to the executable. + If you omit this property or leave it blank it will have no effect. + Setting it to . will change the current dir to the same directory + as the executable. .. will change it to the parent directory, and so on. +
+
+
<chdir>.</chdir>
+
+
+
<chdir>../somedir</chdir>
+
+
+
+
<stayAlive>
+
Optional, defaults to false in GUI header, always true in console header. + When enabled the launcher waits for the Java application + to finish and returns it's exit code. +
+
+
+
<restartOnCrash>
+
Optional, defaults to false. + When the application exits, any exit code other than 0 is considered a crash and the application will be started again. +
+
+
+
<icon>
+
Application icon in ICO format. May contain multiple color depths/resolutions.
+
+
+
<obj>
+
Optional, custom headers only. Ordered list of header object files.
+
+
+
<lib>
+
Optional, custom headers only. Ordered list of libraries used by header.
+
+
+
<singleInstance>
+
Optional, allow to run only a single instance of the application.
+
+
+
+
<mutexName>
+
Unique mutex name that will identify the application.
+
<windowTitle>
+
Optional, recognized by GUI header only. Title or title part of a window + to bring up instead of running a new instance. +
+
+
+
+
<jre>
+
Required element that groups JRE settings.
+
+
+
+
<path>, <minVersion>, <maxVersion>
+
The <path> property is used + to specify absolute or relative JRE paths, it + does not rely on the current directory or <chdir>. + Note that this path is not checked until the actual application execution.
+ Launch4j 3.50 <path> is now required and + always used for searching before the registry in order to ensure compatibility + with latest runtimes which by default do not add registry keys during installation.
+ Launch4j 3.50 <minVersion> and <maxVersion> + are now considered during path and registry search, previously the version was checked only + during registry search. The first runtime version matching the given range will be used. +
+
+
+
+
<path> alone
+
Search for JREs using specified paths, if not found stop with error.

+ Default: <path>%JAVA_HOME%;%PATH%</path>
+ Bundled: <path>jre</path>
+ Advanced: <path>%HKEY_LOCAL_MACHINE\SOFTWARE\UnusualJavaVendor\JavaHome%;%JAVA_HOME%;%PATH%</path> +
+
<path> + <minVersion>  [+ <maxVersion>]
+
Use path search first, if Java cannot be located then perform a registry search. + If that fails display an error message and optionally open the Java download page. +
+
+
+
+
+
+
<minVersion>, <maxVersion> format - Java < 9
+
The traditional version scheme supported by launch4j is 1.x.x[_xxx] and requires at least 3 parts, for example: +
+1.6.0
+1.7.0_51
+1.8.0_121
+
+
+
+
+
+
+
<minVersion>, <maxVersion> format - Java >= 9
+
The new version format is xxx[.xxx[.xxx]] where only 1 part is required and the update version after the underscore is not allowed. +
+1.6
+9
+10.0.1
+
+
+
+
+
+
+
<requiresJdk>
+
Optional, defaults to false. When true only a JDK will be used for execution.
+ Launch4j 3.50 An additional check will be performed if javac is available + during path and registry search. +
+
+
+
+
+
<requires64Bit>
+
Optional, defaults to false. True limits the runtimes to 64-Bit only, false will use + 64-Bit or 32-Bit depending on which is found.
+ Launch4j 3.50 This option works with path and registry search. +
+
+
+
+
+
HeapSize, HeapPercent
+
If size and percent are specified, then the setting which yields + more memory will be chosen at runtime. In other words, setting both values + means: percent of available memory no less than size in MB.
+ Launch4j 3.50 If the runtime is 32-Bit then a 32-Bit limit + will be imposed even if more memory is available during path and registry search. +
+
+
+
+
<initialHeapSize>
+
Optional, initial heap size in MB.
+
+
+
<initialHeapPercent>
+
Optional, initial heap size in % of available memory.
+
+
+
<maxHeapSize>
+
Optional, max heap size in MB.
+
+
+
<maxHeapPercent>
+
Optional, max heap size in % of available memory.
+
+
+
+
<opt>
+
Optional, accepts everything you would normally pass to + java/javaw launcher: assertion options, system properties and X options. + Here you can map environment and special variables EXEDIR + (exe's runtime directory), EXEFILE (exe's runtime full file path) + to system properties. All variable references must be surrounded with + percentage signs and quoted. +
+<opt>-Dlaunch4j.exedir="%EXEDIR%"</opt>
+<opt>-Dlaunch4j.exefile="%EXEFILE%"</opt>
+<opt>-Denv.path="%Path%"</opt>
+<opt>-Dsettings="%HomeDrive%%HomePath%\\settings.ini"</opt>
+
+
+
+
+ +
+
<splash>
+
Optional, groups the splash screen settings. Allowed only in GUI header.
+
+
+
+
<file>
+
Splash screen image in BMP format.
+
+
+
<waitForWindow>
+
Optional, defaults to true. Close the splash screen when an application + window or Java error message box appears. If set to false, + the splash screen will be closed on timeout. +
+
+
+
<timeout>
+
Optional, defaults to 60. Number of seconds after which the splash screen + must be closed. Splash timeout may cause an error depending on + <timeoutErr>. +
+
+
+
<timeoutErr>
+
Optional, defaults to true. True signals an error on splash timeout, + false closes the splash screen quietly. +
+
+
+ +
+
<versionInfo>
+
Optional, version information + to be displayed by the Windows Explorer.
+
+
+
+
<fileVersion>
+
Version number 'x.x.x.x'
+
+
+
<txtFileVersion>
+
Free form file version, for example '1.20.RC1'.
+
+
+
<fileDescription>
+
File description presented to the user.
+
+
+
<copyright>
+
Legal copyright.
+
+
+
<productVersion>
+
Version number 'x.x.x.x'
+
+
+
<txtProductVersion>
+
Free form file version, for example '1.20.RC1'.
+
+
+
<productName>
+
Text.
+
+
+
<companyName>
+
Optional text.
+
+
+
<internalName>
+
Internal name without extension, original filename or module name for example.
+
+
+
<originalFilename>
+
Original name of the file without the path. Allows to determine + whether a file has been renamed by a user. +
+
+
+
<trademarks>
+
Trademarks that apply to the file.
+
+
+
<language>
+
One of the language codes.
+
+
+ +

Importing 1.x configuration

+1.x configuration is no longer supported by launch4j 3.50. You can convert it to 3.14 and then to 3.50. + +

Importing 2.x/3.x configuration to 3.50

+It's possible to import a 2.x/3.x configuration file using the GUI interface. +Open the file, review all settings carefully as some of them cannot always +be imported automatically and the search algorithm has changed in version 3.50. + +

Ant task

+You may set a launch4j directory property or change the task definition. + +
<property name="launch4j.dir" location="/opt/launch4j" />
+ +Define the task in your Ant build script. + +
+<taskdef name="launch4j"
+    classname="net.sf.launch4j.ant.Launch4jTask"
+    classpath="${launch4j.dir}/launch4j.jar
+        :${launch4j.dir}/lib/xstream.jar" />
+
+ +Execute the task! + +
<launch4j configFile="./l4j/demo.xml" />
+ +You can set or override the following configuration properties... +

+ jar="absolute path or relative to basedir"
+ jarPath="relative path"
+ outfile
+ fileVersion
+ txtFileVersion
+ productVersion
+ txtProductVersion
+ bindir="alternate bin directory..."
+ tmpdir="alternate working directory..." +

+ +
+<launch4j configFile="./l4j/demo.xml" outfile="mydemo.exe"
+    fileVersion="1.0.0.0" txtFileVersion="1.0 RC2" />
+
+ +You can also define the entire configuration in the task, but it will +not be possible to edit such a file in the GUI mode. All paths except +for <chdir>, <jre><path> and jarPath +are calculated using the basedir project attribute. + +
+<launch4j>
+  <config headerType="gui" outfile="demo.exe"
+      dontWrapJar="true" jarPath="demo.jar" >
+    <var>SETTINGS="%HomeDrive%%HomePath%\\settings.ini"</var>
+    <classPath mainClass="org.demo.DemoApp">
+        <cp>./lib/looks.jar</cp>
+        <cp>%USER_LIBS%/*.jar</cp>
+    </classPath>
+    <jre path="%JAVA_HOME%;%PATH%" minVersion="1.8.0">
+        <opt>-Dlaunch4j.exedir="%EXEDIR%"</opt>
+        <opt>-Dlaunch4j.exefile="%EXEFILE%"</opt>
+    </jre>
+  </config>
+</launch4j>
+
+ +

Additional JVM options at runtime

+When you create a wrapper or launcher all configuration details are compiled into the +executable and cannot be changed without recreating it or hacking with a resource editor. +Launch4j 2.1.2 introduces a new feature that allows to pass additional JVM options +at runtime from an .l4j.ini file. Now you can specify the options in the configuration file, +ini file or in both, but you cannot override them. The ini file's name must correspond +to the executable's (myapp.exe : myapp.l4j.ini). +The arguments should be separated with spaces or new lines, environment variable +expansion is supported, for example: +
+# Launch4j runtime config
+-Dswing.aatext=true
+-Dsomevar="%SOMEVAR%"
+-Xms16m
+
+ +

Environemnt variables

+The following variables can be used in the configuration file (elements which contain %VAR%). +They are substitued during runtime, so for example the EXEDIR is the directory where the user installed the wrapped application. +
+
%VAR%
+
+ Any environment variable, for example %HOMEPATH%. +
+ +
%EXEDIR%
+
+ Wrapper directory path. +
+ +
%EXEFILE%
+
+ Wrapper executable file path. +
+ +
%PWD%
+
+ Current directory, after chdir was applied. +
+ +
%OLDPWD%
+
+ Directory before chdir was applied. +
+ +
%JREHOMEDIR%
+
+ Path to the JRE which was selected for executing the application. +
+ +
%HKEY_...\...%
+
+ Registry key value, e.g.
+ %HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MemoryDiagnostic\LastScanTime% +
+
+ +

Runtime options

+
+
--l4j-debug
+
+ To make sure the output executable is configured correctly you can use the + debug launching mode to log various information to the launch4j.log file. + Environment variable can also be used...
+ SET Launch4j=debug +
+ +
--l4j-debug-all
+
+ Same as above, but additionally log loaded resources (options stored during wrapper creation). + Environment variable can also be used...
+ SET Launch4j=debug-all +
+ +
--l4j-dont-wait
+
+ Disable the "stay alive" function. +
+ +
--l4j-no-splash
+
+ Disable the splash screen. +
+ +
--l4j-no-splash-err
+
+ Disable splash screen error on timeout, might be useful on very slow computers. +
+
+ +

Settings

+These settings are only used during building of the launcher or wrapper, not during their execution. +
+
Alternate bin directory: launch4j.bindir
+
+ It's possible to override the default bin directory location which contains windres and ld + tools using the launch4j.bindir system property. The property can have two forms: + a path relative to Launch4j's directory (altbin for example) or an absolute path. +
+ +
Working directory: launch4j.tmpdir
+
Change the working directory if the default path contains spaces which windres cannot handle.
+
+
+ +
+ + diff --git a/launch4j/web/index.html b/launch4j/web/index.html index ac3a0b9..940ee44 100644 --- a/launch4j/web/index.html +++ b/launch4j/web/index.html @@ -1,122 +1,130 @@ - - - - Launch4j - Cross-platform Java executable wrapper - - - - - - - -
-
- launch4j 3.12 -
- -
-

Cross-platform Java executable wrapper

-

- Launch4j is a cross-platform tool for wrapping - Java applications distributed as jars in lightweight Windows - native executables. The executable can be - configured to search for a certain JRE version or - use a bundled one, and it's possible to set - runtime options, like the initial/max heap size. - The wrapper also provides better user experience - through an application icon, a native pre-JRE - splash screen, and a Java download page in case - the appropriate JRE cannot be found. -

-How to use Launch4 -

Features

-
    -
  • Launch4j wraps jars in Windows native executables and allows to run them - like a regular Windows program. It's possible to wrap applications - on Windows, Linux and Mac OS X! -
  • -
  • Also creates launchers for jars and class files without wrapping.
  • -
  • - Supports executable jars and dynamic classpath resolution using - environment variables and wildcards. -
  • -
  • Doesn't extract the jar from the executable.
  • -
  • Custom application icon with multiple resolutions and color depths.
  • -
  • Native pre-JRE splash screen in BMP format shown until - the Java application starts. -
  • -
  • Initial priority and single application instance features. -
  • -
  • Works with a bundled JRE or searches for newest Sun or IBM JRE / JDK in given - version range and type (64-bit or 32-bit).
  • -
  • Opens Java download page if an appropriate Java version cannot be - found or a support website in case of an error. -
  • -
  • Supports GUI and console apps.
  • -
  • Supports Windows application manifests.
  • -
  • Passes command line arguments, also supports constant arguments.
  • -
  • Allows to set the initial/max heap size also dynamically in percent of free memory.
  • -
  • JVM options: set system properties, tweak the garbage collection...
  • -
  • Runtime JVM options from an .l4j.ini file.
  • -
  • Runtime command line switches to change the compiled options.
  • -
  • Access to environment variables, the registry and executable file path through system properties.
  • -
  • Set environment variables.
  • -
  • Option to change current directory to the executable location.
  • -
  • The JRE's bin directory is appended to the Path environment variable.
  • -
  • Ability to restart the application based on exit code.
  • -
  • Custom version information shown by Windows Explorer.
  • -
  • Digital signing of the executable with sign4j.
  • -
  • Supports Windows Security Features of the Windows 8 certification kit.
  • -
  • GUI and command line interface.
  • -
  • Build integration through an Ant task and a Maven Plugin.
  • -
  • Lightweight: 35 KB!
  • -
  • It's free and may be used for commercial purposes.
  • -
  • Includes a sample application and Ant script - that automates the build process from Java sources to native executable. -
  • -
  • The wrapped program works on all Windows platforms, - Launch4j works on Windows, Linux and Mac OS X. -
  • -
-

License

-

- This program is free software licensed under the - BSD 3-Clause License, the head subproject - (the code which is attached to the wrapped jars) is licensed under the - MIT License. - Launch4j may be used for wrapping closed source, commercial applications. -

-

Info

-

- Running Launch4j on other Java enabled platforms is a matter of getting a binary version - of MinGW binutils 2.22 (windres and ld only) - for your system or compiling them. If you'll provide these, I'll be able to create a binary package - available for download. -

- -
- -
- - + + + + Launch4j - Cross-platform Java executable wrapper + + + + + + + +
+
+ launch4j 3.50 +
+ +
+

Cross-platform Java executable wrapper

+

+ Launch4j is a cross-platform tool for wrapping + Java applications distributed as jars in lightweight Windows + native executables. The executable can be + configured to search for a certain JRE version or + use a bundled one, and it's possible to set + runtime options, like the initial/max heap size. + The wrapper also provides better user experience + through an application icon, a native pre-JRE + splash screen, and a Java download page in case + the appropriate JRE cannot be found. +

+ +

Features

+
    +
  • Launch4j wraps jars in Windows native executables and allows to run them + like a regular Windows program. It's possible to wrap applications + on Windows, Linux and Mac OS X! +
  • +
  • Also creates launchers for jars and class files without wrapping.
  • +
  • + Supports executable jars and dynamic classpath resolution using + environment variables and wildcards. +
  • +
  • Doesn't extract the jar from the executable.
  • +
  • Custom application icon with multiple resolutions and color depths.
  • +
  • Native pre-JRE splash screen in BMP format shown until + the Java application starts. +
  • +
  • Initial priority and single application instance features. +
  • +
  • Searches for Java using paths, environment variables and registry supporting latest Java runtimes.
  • +
  • Opens Java download page if an appropriate Java version cannot be + found or a support website in case of an error. +
  • +
  • Supports GUI and console apps.
  • +
  • Supports Windows application manifests.
  • +
  • Passes command line arguments, also supports constant arguments.
  • +
  • Allows to set the initial/max heap size also dynamically in percent of free memory.
  • +
  • JVM options: set system properties, tweak the garbage collection...
  • +
  • Runtime JVM options from an .l4j.ini file.
  • +
  • Runtime command line switches to change the compiled options.
  • +
  • Access to environment variables, the registry and executable file path through system properties.
  • +
  • Set environment variables.
  • +
  • Option to change current directory to the executable location.
  • +
  • The JRE's bin directory is appended to the Path environment variable.
  • +
  • Ability to restart the application based on exit code.
  • +
  • Custom version information shown by Windows Explorer.
  • +
  • Digital signing of the executable with sign4j.
  • +
  • Supports Windows Security Features of the Windows 8 certification kit.
  • +
  • GUI and command line interface.
  • +
  • Build integration through an Ant task and a Maven Plugin.
  • +
  • Lightweight: 62 KB
  • +
  • It's free and may be used for commercial purposes.
  • +
  • Includes a sample application and Ant script + that automates the build process from Java sources to native executable. +
  • +
  • The wrapped program works on all Windows platforms, + Launch4j works on Windows, Linux and Mac OS X. +
  • +
+

License

+

+ This program is free software licensed under the + BSD 3-Clause License, the head subproject + (the code which is attached to the wrapped jars) is licensed under the + MIT License. + Launch4j may be used for wrapping closed source, commercial applications. +

+

Info

+

+ Running Launch4j on other Java enabled platforms is a matter of getting a binary version + of MinGW binutils 2.22 (windres and ld only) + for your system or compiling them. If you'll provide these, I'll be able to create a binary package + available for download. +

+ +
+ +
+ + diff --git a/launch4j/web/links.html b/launch4j/web/links.html index 8aa9c4e..d5b89f5 100644 --- a/launch4j/web/links.html +++ b/launch4j/web/links.html @@ -1,60 +1,70 @@ - - - - Launch4j - Cross-platform Java executable wrapper - - - - - - - -
-
- launch4j 3.12 -
- -
-

Links

-

- Maven plugin by Lukasz Lenart
-
Maven Central Repository
- Bloodshed Dev-C++
- MinGW
- Commons BeanUtils
- Commons Logging
- XStream
- JGoodies
- Eclipse
-

-

Windows native installers

-

- NSIS (cross-platform, targets Windows)
- Inno Setup
-

-
- -
- - + + + + Launch4j - Cross-platform Java executable wrapper + + + + + + + +
+
+ launch4j 3.50 +
+ + + +
+ + diff --git a/launch4j/web/style.css b/launch4j/web/style-13112022.css similarity index 91% rename from launch4j/web/style.css rename to launch4j/web/style-13112022.css index 4ad6bcf..0754975 100644 --- a/launch4j/web/style.css +++ b/launch4j/web/style-13112022.css @@ -23,6 +23,9 @@ pre { .attrib { color: #404040; } +.warn { + color: red; +} .option { font-family: "Courier New", Courier, monospace; font-weight: bold; @@ -83,14 +86,14 @@ table td { padding: 0; } - -#leftnav { +.sidebar { float: left; width: 170px; margin: 0; padding: 0.5em; background-color: #ffffff; } + #leftnav ul { margin: 0; padding: 0;