Compare commits

...

22 Commits

Author SHA1 Message Date
432eff3e10 Added GitHub Actions workflow for building Launch5j.
Some checks failed
CI/CD / Build Launch5j (x64, MINGW64, x86_64) (push) Has been cancelled
CI/CD / Build Launch5j (x86, MINGW32, i686) (push) Has been cancelled
CI/CD / Generate Docs (push) Has been cancelled
CI/CD / Build Example (push) Has been cancelled
CI/CD / Generate Release Package (push) Has been cancelled
2024-10-01 16:11:55 +02:00
0a36344f49 Bump version. 2024-09-29 18:10:59 +02:00
02931280d0 Added runtime option for *not* setting the current working directory to the executable directory. 2024-09-29 16:23:11 +02:00
9d27eb5a98 Limit the Java heap size to 1024 MB when 32-Bit JVM was detected. 2023-03-28 22:14:45 +02:00
2d5b01092b Allow options 'ID_STR_HEAPMIN' and 'ID_STR_HEAPMAX' to be set independently. 2023-03-26 20:50:13 +02:00
656d4145c1 Added configuration options to set the minimum/maximum JVM heap size as percentage of the total physical memory. 2023-03-26 18:28:19 +02:00
735a0839ee Added detection of Eclipse Adoptium JRE/JDK (supersedes AdoptOpenJDK). 2023-03-26 16:19:00 +02:00
548787d7b2 Fixed build with latest version of MSYS2/Mingw-w64. 2023-03-26 15:52:00 +02:00
60916768ac Improved generation of the manifest + small tweak to Makefile generator code. 2020-10-06 13:14:30 +02:00
bee745b199 Updated README file. 2020-10-05 19:51:45 +02:00
928887d979 Small Makefile improvement. 2020-10-05 19:35:32 +02:00
d95313cd98 Improved error handling + updated README file. 2020-10-05 18:48:01 +02:00
9e73dfa2c5 Make sure that dependency on Common Control v6.0 is only included in GUI versions. 2020-10-05 14:15:02 +02:00
26ac902313 Print messages directly to console in non-GUI mode. 2020-10-05 00:04:27 +02:00
2a5e624757 Added support for "windows" (GUI) and "console" mode. 2020-10-04 22:10:58 +02:00
77c12f0c54 Small update to screenshot. 2020-10-04 18:40:04 +02:00
6a577cdbc2 Small Makefile improvement. 2020-10-04 17:49:25 +02:00
be6304d758 Some code refactoring and clean-up. 2020-10-04 17:14:21 +02:00
2b17c7d53d Small improvement to deployment script. 2020-10-03 23:18:50 +02:00
39a158bd4f Improved generation of the Manifest. 2020-10-03 20:56:45 +02:00
c9f6f428ef Refactored path parameters into a separate configuration file. 2020-10-03 19:53:14 +02:00
bf4172cd14 Added about screen + some other minor improvements. 2020-10-03 18:22:26 +02:00
24 changed files with 1414 additions and 449 deletions

113
.github/workflows/build-l5j.yml vendored Normal file
View File

@ -0,0 +1,113 @@
name: "CI/CD"
on:
push:
branches: ['**']
pull_request:
release:
types: [published]
jobs:
build:
name: Build Launch5j
runs-on: windows-2019
strategy:
matrix:
include:
- flavor: "x86"
msystem: "MINGW32"
toolchain: "i686"
- flavor: "x64"
msystem: "MINGW64"
toolchain: "x86_64"
steps:
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
update: true
install: mingw-w64-${{ matrix.toolchain }}-toolchain base-devel git
- uses: actions/checkout@v4
- shell: msys2 {0}
run: make -B
- uses: actions/upload-artifact@v4
with:
name: launch5j-bin-${{ matrix.flavor }}
path: bin/*.exe
example:
name: Build Example
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/setup-java@v4
with:
java-version: "8"
distribution: "temurin"
architecture: x64
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: launch5j-bin-x86
path: bin
- run: |
ant -noinput -buildfile src/example/build.xml
mkdir -p /var/tmp/launch5j-example
cp -f bin/launch5j_x86_wrapped_registry.exe /var/tmp/launch5j-example/example.exe
dd if=src/example/dist/example.jar of=/var/tmp/launch5j-example/example.exe oflag=append conv=notrunc
- uses: actions/upload-artifact@v4
with:
name: launch5j-example
path: /var/tmp/launch5j-example/*
docs:
name: Generate Docs
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: docker://pandoc/core:2.9
with:
args: >-
-f markdown-implicit_figures -t html5
--standalone --ascii --toc --toc-depth=2
--css="etc/css/gh-pandoc.css"
-o "./README.html" "./README.yaml" "./README.md"
- uses: actions/upload-artifact@v4
with:
name: launch5j-doc
path: |
LICENSE.txt
README.html
etc/img/*.png
etc/css/*.css
release:
name: Generate Release Package
needs: [build, example, docs]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
name: launch5j-doc
- uses: actions/download-artifact@v4
with:
name: launch5j-bin-x86
- uses: actions/download-artifact@v4
with:
name: launch5j-bin-x64
path: x64
- uses: actions/download-artifact@v4
with:
name: launch5j-example
path: example
- run: |
mkdir -p /var/tmp/launch5j-release
tar -czvf /var/tmp/launch5j-release/launch5j-bin.$(date +"%Y-%m-%d").tar.gz *
- uses: actions/upload-artifact@v4
with:
name: launch5j-release
path: /var/tmp/launch5j-release/*
- if: ${{ github.event_name == 'release' }}
uses: Roang-zero1/github-upload-release-artifacts-action@v2
with:
args: /var/tmp/launch5j-release/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

2
.gitignore vendored
View File

@ -1,4 +1,6 @@
/*.html
/bin
/build.cfg
/obj
/out
/tmp

View File

@ -1,4 +1,4 @@
Copyright 2020 LoRd_MuldeR <mulder2@gmx.de>
Copyright 2024 LoRd_MuldeR <mulder2@gmx.de>
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

422
Makefile
View File

@ -12,12 +12,17 @@
############################################################
MACHINE := $(patsubst %-w64-mingw32,[%],$(shell $(CXX) -dumpmachine))
BUILDNO := $(shell git rev-list --count HEAD 2>&- || echo 0)
VERSION_MAJOR := $(shell grep -Po '#define[[:space:]]+L5J_VERSION_MAJOR[[:space:]]+\K[[:digit:]]+' src/resource.h)
VERSION_MINOR := $(shell grep -Po '#define[[:space:]]+L5J_VERSION_MINOR[[:space:]]+\K[[:digit:]]+' src/resource.h)
VERSION_PATCH := $(shell grep -Po '#define[[:space:]]+L5J_VERSION_PATCH[[:space:]]+\K[[:digit:]]+' src/resource.h)
ifeq ($(MACHINE),[i686])
CPU_ARCH := x86
MARCH ?= i586
else ifeq ($(MACHINE),[x86_64])
CPU_ARCH := x64
CPU_ARCH := amd64
MARCH ?= x86-64
else
$(error Unknown target machine "$(MACHINE)" encountered!)
@ -34,8 +39,7 @@ else
SUFFIX = g.exe
endif
CFLAGS += -municode -mwindows -march=$(MARCH) -mtune=$(MTUNE)
LDFLAGS = -lcomctl32
CFLAGS += -municode -march=$(MARCH) -mtune=$(MTUNE)
# ==========================================================
# Targets
@ -44,286 +48,424 @@ LDFLAGS = -lcomctl32
.PHONY: default
default: all
.PHONY: init
init:
.PHONY: initialize
initialize:
mkdir -p bin
mkdir -p obj
mkdir -p tmp
.PHONY: manifests
manifests: initialize
@mkdir -p tmp/assets
sed -e 's/$${{version}}/$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH).$(BUILDNO)/g' -e 's/$${{processorArchitecture}}/$(CPU_ARCH)/g' res/assets/manifest-console.xml > tmp/assets/manifest-console.$(CPU_ARCH).xml
sed -e 's/$${{version}}/$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH).$(BUILDNO)/g' -e 's/$${{processorArchitecture}}/$(CPU_ARCH)/g' res/assets/manifest-windows.xml > tmp/assets/manifest-windows.$(CPU_ARCH).xml
.PHONY: resources
resources: init
windres -o obj/common.$(CPU_ARCH).o res/common.rc
windres -o obj/splash_screen.$(CPU_ARCH).o res/splash_screen.rc
windres -o obj/registry.$(CPU_ARCH).o res/registry.rc
resources: manifests
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/common.$(CPU_ARCH).o res/common.rc
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/manifest-console.$(CPU_ARCH).o res/manifest-console.rc
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/manifest-windows.$(CPU_ARCH).o res/manifest-windows.rc
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/registry.$(CPU_ARCH).o res/registry.rc
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/splash_screen.$(CPU_ARCH).o res/splash_screen.rc
.PHONY: clean
clean: init
$(RM) bin/*.$(SUFFIX)
$(RM) obj/*.o
clean: initialize
find bin -type f -delete
find obj -type f -delete
find tmp -type f -delete
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Binaries
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.PHONY: l5j
l5j: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH).exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_B855
launch5j_B855: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH).exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH).exe
endif
.PHONY: l5j_noenc
l5j_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_A2FE
launch5j_A2FE: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_noenc.exe
endif
.PHONY: l5j_nosplash
l5j_nosplash: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_D99E
launch5j_D99E: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nosplash.exe
endif
.PHONY: l5j_nosplash_noenc
l5j_nosplash_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_6DCE
launch5j_6DCE: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nosplash_noenc.exe
endif
.PHONY: l5j_nowait
l5j_nowait: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_9E54
launch5j_9E54: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nowait.exe
endif
.PHONY: l5j_nowait_noenc
l5j_nowait_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_1CDC
launch5j_1CDC: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nowait_noenc.exe
endif
.PHONY: l5j_nowait_nosplash
l5j_nowait_nosplash: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_459A
launch5j_459A: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nowait_nosplash.exe
endif
.PHONY: l5j_nowait_nosplash_noenc
l5j_nowait_nosplash_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nowait_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_AA99
launch5j_AA99: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nowait_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nowait_nosplash_noenc.exe
endif
.PHONY: l5j_registry
l5j_registry: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_registry.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_2F4C
launch5j_2F4C: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_registry.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_registry.exe
endif
.PHONY: l5j_registry_noenc
l5j_registry_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_registry_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_1A0D
launch5j_1A0D: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_registry_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_registry_noenc.exe
endif
.PHONY: l5j_registry_nosplash
l5j_registry_nosplash: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_registry_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_9AA2
launch5j_9AA2: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_registry_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_registry_nosplash.exe
endif
.PHONY: l5j_registry_nosplash_noenc
l5j_registry_nosplash_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_registry_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_7178
launch5j_7178: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_registry_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_registry_nosplash_noenc.exe
endif
.PHONY: l5j_registry_nowait
l5j_registry_nowait: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_registry_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_A25D
launch5j_A25D: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_registry_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_registry_nowait.exe
endif
.PHONY: l5j_registry_nowait_noenc
l5j_registry_nowait_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_registry_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_20DF
launch5j_20DF: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_registry_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_registry_nowait_noenc.exe
endif
.PHONY: l5j_registry_nowait_nosplash
l5j_registry_nowait_nosplash: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_8568
launch5j_8568: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash.exe
endif
.PHONY: l5j_registry_nowait_nosplash_noenc
l5j_registry_nowait_nosplash_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_2BCA
launch5j_2BCA: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_registry_nowait_nosplash_noenc.exe
endif
.PHONY: l5j_wrapped
l5j_wrapped: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_7B70
launch5j_7B70: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped.exe
endif
.PHONY: l5j_wrapped_noenc
l5j_wrapped_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_91AC
launch5j_91AC: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_noenc.exe
endif
.PHONY: l5j_wrapped_nosplash
l5j_wrapped_nosplash: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_FA0C
launch5j_FA0C: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_nosplash.exe
endif
.PHONY: l5j_wrapped_nosplash_noenc
l5j_wrapped_nosplash_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_2559
launch5j_2559: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_nosplash_noenc.exe
endif
.PHONY: l5j_wrapped_nowait
l5j_wrapped_nowait: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_2EFE
launch5j_2EFE: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_nowait.exe
endif
.PHONY: l5j_wrapped_nowait_noenc
l5j_wrapped_nowait_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_8F9C
launch5j_8F9C: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_nowait_noenc.exe
endif
.PHONY: l5j_wrapped_nowait_nosplash
l5j_wrapped_nowait_nosplash: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_3478
launch5j_3478: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash.exe
endif
.PHONY: l5j_wrapped_nowait_nosplash_noenc
l5j_wrapped_nowait_nosplash_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_4F5B
launch5j_4F5B: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_nowait_nosplash_noenc.exe
endif
.PHONY: l5j_wrapped_registry
l5j_wrapped_registry: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_2A1E
launch5j_2A1E: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry.exe
endif
.PHONY: l5j_wrapped_registry_noenc
l5j_wrapped_registry_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_FE04
launch5j_FE04: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_noenc.exe
endif
.PHONY: l5j_wrapped_registry_nosplash
l5j_wrapped_registry_nosplash: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_2BCE
launch5j_2BCE: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash.exe
endif
.PHONY: l5j_wrapped_registry_nosplash_noenc
l5j_wrapped_registry_nosplash_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_9D63
launch5j_9D63: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nosplash_noenc.exe
endif
.PHONY: l5j_wrapped_registry_nowait
l5j_wrapped_registry_nowait: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_F5D7
launch5j_F5D7: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait.exe
endif
.PHONY: l5j_wrapped_registry_nowait_noenc
l5j_wrapped_registry_nowait_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_33A4
launch5j_33A4: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=1 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/splash_screen.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_noenc.exe
endif
.PHONY: l5j_wrapped_registry_nowait_nosplash
l5j_wrapped_registry_nowait_nosplash: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_D3FD
launch5j_D3FD: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash.exe
endif
.PHONY: l5j_wrapped_registry_nowait_nosplash_noenc
l5j_wrapped_registry_nowait_nosplash_noenc: resources
$(CC) $(CFLAGS) -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o $(LDFLAGS)
.PHONY: launch5j_D36F
launch5j_D36F: resources
$(CC) $(CFLAGS) -mwindows -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=1 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-windows.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o -lcomctl32
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_wrapped_registry_nowait_nosplash_noenc.exe
endif
.PHONY: launch5j_F945
launch5j_F945: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nogui.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui.exe
endif
.PHONY: launch5j_4745
launch5j_4745: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nogui_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_noenc.exe
endif
.PHONY: launch5j_01E0
launch5j_01E0: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nogui_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_nowait.exe
endif
.PHONY: launch5j_78AA
launch5j_78AA: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nogui_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_nowait_noenc.exe
endif
.PHONY: launch5j_B8C6
launch5j_B8C6: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nogui_registry.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_registry.exe
endif
.PHONY: launch5j_3848
launch5j_3848: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nogui_registry_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_registry_noenc.exe
endif
.PHONY: launch5j_778B
launch5j_778B: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nogui_registry_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_registry_nowait.exe
endif
.PHONY: launch5j_627C
launch5j_627C: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=0 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nogui_registry_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_registry_nowait_noenc.exe
endif
.PHONY: launch5j_66EE
launch5j_66EE: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nogui_wrapped.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_wrapped.exe
endif
.PHONY: launch5j_9FFA
launch5j_9FFA: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nogui_wrapped_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_wrapped_noenc.exe
endif
.PHONY: launch5j_7C79
launch5j_7C79: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nogui_wrapped_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_wrapped_nowait.exe
endif
.PHONY: launch5j_2928
launch5j_2928: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=0 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nogui_wrapped_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_wrapped_nowait_noenc.exe
endif
.PHONY: launch5j_8EFD
launch5j_8EFD: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nogui_wrapped_registry.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_wrapped_registry.exe
endif
.PHONY: launch5j_59FE
launch5j_59FE: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=1 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nogui_wrapped_registry_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_wrapped_registry_noenc.exe
endif
.PHONY: launch5j_C25B
launch5j_C25B: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=1 -o bin/launch5j_$(CPU_ARCH)_nogui_wrapped_registry_nowait.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_wrapped_registry_nowait.exe
endif
.PHONY: launch5j_DAFA
launch5j_DAFA: resources
$(CC) $(CFLAGS) -mconsole -DL5J_BUILDNO=$(BUILDNO) -DL5J_ENABLE_GUI=0 -DL5J_JAR_FILE_WRAPPED=1 -DL5J_DETECT_REGISTRY=1 -DL5J_STAY_ALIVE=0 -DL5J_ENABLE_SPLASH=0 -DL5J_ENCODE_ARGS=0 -o bin/launch5j_$(CPU_ARCH)_nogui_wrapped_registry_nowait_noenc.exe src/head.c obj/common.$(CPU_ARCH).o obj/manifest-console.$(CPU_ARCH).o obj/registry.$(CPU_ARCH).o
ifeq ($(DEBUG),0)
strip bin/launch5j_$(CPU_ARCH)_nogui_wrapped_registry_nowait_noenc.exe
endif
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ALL
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.PHONY: all
all: \
l5j \
l5j_noenc \
l5j_nosplash \
l5j_nosplash_noenc \
l5j_nowait \
l5j_nowait_noenc \
l5j_nowait_nosplash \
l5j_nowait_nosplash_noenc \
l5j_registry \
l5j_registry_noenc \
l5j_registry_nosplash \
l5j_registry_nosplash_noenc \
l5j_registry_nowait \
l5j_registry_nowait_noenc \
l5j_registry_nowait_nosplash \
l5j_registry_nowait_nosplash_noenc \
l5j_wrapped \
l5j_wrapped_noenc \
l5j_wrapped_nosplash \
l5j_wrapped_nosplash_noenc \
l5j_wrapped_nowait \
l5j_wrapped_nowait_noenc \
l5j_wrapped_nowait_nosplash \
l5j_wrapped_nowait_nosplash_noenc \
l5j_wrapped_registry \
l5j_wrapped_registry_noenc \
l5j_wrapped_registry_nosplash \
l5j_wrapped_registry_nosplash_noenc \
l5j_wrapped_registry_nowait \
l5j_wrapped_registry_nowait_noenc \
l5j_wrapped_registry_nowait_nosplash \
l5j_wrapped_registry_nowait_nosplash_noenc
launch5j_B855 \
launch5j_A2FE \
launch5j_D99E \
launch5j_6DCE \
launch5j_9E54 \
launch5j_1CDC \
launch5j_459A \
launch5j_AA99 \
launch5j_2F4C \
launch5j_1A0D \
launch5j_9AA2 \
launch5j_7178 \
launch5j_A25D \
launch5j_20DF \
launch5j_8568 \
launch5j_2BCA \
launch5j_7B70 \
launch5j_91AC \
launch5j_FA0C \
launch5j_2559 \
launch5j_2EFE \
launch5j_8F9C \
launch5j_3478 \
launch5j_4F5B \
launch5j_2A1E \
launch5j_FE04 \
launch5j_2BCE \
launch5j_9D63 \
launch5j_F5D7 \
launch5j_33A4 \
launch5j_D3FD \
launch5j_D36F \
launch5j_F945 \
launch5j_4745 \
launch5j_01E0 \
launch5j_78AA \
launch5j_B8C6 \
launch5j_3848 \
launch5j_778B \
launch5j_627C \
launch5j_66EE \
launch5j_9FFA \
launch5j_7C79 \
launch5j_2928 \
launch5j_8EFD \
launch5j_59FE \
launch5j_C25B \
launch5j_DAFA

177
README.md
View File

@ -1,54 +1,85 @@
![Launch5j](etc/img/logo.png)
**Java JAR file wrapper for creating Windows native executables**
**Java JAR file wrapper for creating Windows&trade; native executables**
# Introduction
**Launch5j** is a reimagination of “Launch4j”, *with full Unicode support*. This is a 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. 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.
**Launch5j** is a reimagination of “Launch4j”, *with full Unicode support*. This is a tool for wrapping Java applications distributed as JARs in lightweight Windows&trade; native executables. The executable can be configured to search for a certain JRE version or use a bundled one. 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.
# Usage
There currently are two different ways to use Launch5j with your application code:
* ***Use the launcher executable with a separate JAR file***
* **Use the launcher executable with a separate JAR file**
Simply put the launcher executable (`launch5j.exe`) and your JAR file into the same directory. Launch5j will automatically detect the path of the JAR file based on the location of the executable file. More specifically, Launch5j detects the full path of the executable file and then replaces the `.exe` file extension with a `.jar` file extension. Of course, you can rename the `launch5j.exe` executable to whatever you prefer.
*For example:* If you application's JAR file is called `bazinga.jar`, pick the Launch5j variant of your choice, rename the Launch5j executable to `bazinga.exe`, and put these two files (JAR + EXE) into the “install”directory.
***For example:*** Assuming your application's JAR file is called `thingamabob.jar`, pick the Launch5j launcher variant of your choice (**no** `wrapped` variant though!), rename the launcher executable to `thingamabob.exe`, and put these two files into the “install” directory. Also, the Java runtime should be located in the `runtime` sub-directory within the “install” directory &ndash; unless you are using the `registry` variant of Launch5j.
* ***Combine the launcher executable and the JAR file (“wrapping”)***
```
install_dir
├── thingamabob.exe
├── thingamabob.jar
├── runtime
│ └── bin
│ ├── java.exe
│ ├── javaw.exe
│ └── [...]
└── [...]
```
* **Combine the launcher executable and the JAR file (“wrapping”)**
In order to combine the launcher executable (`launch5j_wrapped.exe`) and the JAR file to a *single* file, you can simply concatenate these files. The executable launcher must go before the JAR file content. There are many ways to achieve this, but one method is by running the following **copy** command-line in the terminal:
In order to combine the Launch5j launcher executable and the JAR file to a ***single*** file, you can simply *concatenate* these two files. For this purpose, you have to choose one of the `wrapped` variants of Launch5j. Also, the executable launcher code must go before the JAR file content. There are many ways to achieve this, but probably the most simple method is running the following **copy** command-line in the terminal:
copy /B launch5j_wrapped.exe + bazinga.jar bazinga.exe
copy /B launch5j_wrapped.exe + thingamabob.jar thingamabob.exe
If you are building you application with [**Apache Ant**](https://ant.apache.org/), consider using the `concat` task like this:
If you are building your application with [**Apache Ant**](https://ant.apache.org/), consider using the `concat` task like this:
<concat destfile="bazinga.exe" binary="true">
<concat destfile="thingamabob.exe" binary="true">
<fileset file="launch5j_wrapped.exe"/>
<fileset file="bazinga.jar"/>
<fileset file="thingamabob.jar"/>
</concat>
The resulting `bazinga.exe` will be fully self-contained and is the only file you'll need to ship.
The resulting `thingamabob.exe` is fully self-contained, **no** separate JAR file needs to be shipped. Still, a Java runtime is required to run the application! The Java runtime should be located in the `runtime` sub-directory within the “install” directory &ndash; unless you are using the `registry` variant of Launch5j.
```
install_dir
├── thingamabob.exe
├── runtime
│ └── bin
│ ├── java.exe
│ ├── javaw.exe
│ └── [...]
└── [...]
```
**Warning:** Code signing, as with Microsoft&reg;'s `SignTool`, probably does **not** work with the “wrapped” executable file! If code signing is a requirement, please use a *separate* JAR file and just sing the launcher executable.
# Variants
Launch5j executables come in a number of variants, allowing you to pick the most suitable one for you project:
Launch5j executables come in a number of variants, allowing you to pick the most suitable one for your project:
* **`nogui`**
No graphical user interface is created and the Java application is launched via the `java.exe` (console mode) program; default variant launches the Java application via the `javaw.exe` (windowed mode) program.
*Note:* If using this variant, the program should be called from within a terminal window!
* **`wrapped`**
Expects that the JAR file and the executable launcher have been combined to a *single* file; default variant expects that a separate JAR file is present in the same directory where the executable launcher resides.
* **`registry`**
Tries to automatically detect the install path of the JRE from the Windows registry; default variant expects the JRE to be located in the `/runtime` path relative to the location of the executable launcher.
Tries to automatically detect the install path of the JRE from the Windows&trade; registry; default variant expects the JRE to be located in the `runtime` path relative to the location of the executable launcher.
At this time, the following Java distributions can be detected from the registry:
- [Oracle JDK (JavaSoft)](https://www.oracle.com/java/technologies/javase-downloads.html)
- [AdoptOpenJDK](https://adoptopenjdk.net/)
- [Eclipse Adoptium](https://adoptium.net/)
- [Liberica OpenJDK](https://bell-sw.com/)
- [Zulu OpenJDK](https://www.azul.com/downloads/zulu-community/)
Regarding the different available distributions of Java, please refer to this document:
[***Java Is Still Free***](https://docs.google.com/document/d/1nFGazvrCvHMZJgFstlbzoHjpAVwv5DEdnaBr_5pKuHo/preview)
* **`nowait`**
Does **not** keep the launcher executable alive while the application is running; default variant keeps the launcher executable alive until the application terminates and then forwards the application's exit code.
@ -59,11 +90,11 @@ Launch5j executables come in a number of variants, allowing you to pick the most
* **`noenc`**
Does **not** apply [URL encoding](https://en.wikipedia.org/wiki/Percent-encoding) to the given command-line arguments; default variant *does* apply URL encoding to all given command-line arguments in order to work around a long standing bug in Java.
## Platforms
## Supported platforms
All of the above Launch5j variants are available as `x86` (32-Bit) and `x64` (64-Bit) executables. The `x86` (32-Bit) executables can run on *32-Bit* and *64-Bit* versions of Microsoft&reg; Windows&trade;, whereas the `x64` (64-Bit) executables require a *64-Bit* version of Microsoft&reg; Windows&trade;. Consequently, it is generally recommended to distribute the `x86` (32-Bit) launcher executable. Please note that this does **not** restrict the “bitness” of the JRE that can be used. Even the `x86` (32-Bit) launcher executable is perfectly able to detect and launch a *64-Bit* JRE &ndash; if it is available.
All of the above Launch5j variants are available as `x86` (32-Bit) and `amd64` (64-Bit) executables. The `x86` (32-Bit) executables can run on *32-Bit* and *64-Bit* versions of Microsoft&reg; Windows&trade;, whereas the `amd64` (64-Bit) executables require a *64-Bit* version of Microsoft&reg; Windows&trade;. Consequently, it is generally recommended to distribute the `x86` (32-Bit) launcher executable. Please note that this does **not** restrict the “bitness” of the JRE that can be used. Even the `x86` (32-Bit) launcher executable is perfectly able to detect and launch a *64-Bit* JRE &ndash; if it is available.
*Note:* Launch5j has been tested to work correctly on Windows XP (Service Pack 2), or a compatible newer version.
*Note:* Launch5j has been tested to work correctly on Windows XP with Service Pack 3, or a compatible newer version.
# Customizations
@ -78,24 +109,24 @@ It is ***not*** necessary to re-build the executable files for that purpose. Ins
Some options can be configured via the launcher executable's [STRINGTABLE](https://docs.microsoft.com/en-us/windows/win32/menurc/stringtable-resource) resource:
* **`ID_STR_HEADING` (#1)**
* **`ID_STR_HEADING` (0x1)**
Specifies a custom application title that will be used, e.g., as the heading of message boxes.
* **`ID_STR_JVMARGS` (#2)**
* **`ID_STR_JVMARGS` (0x2)**
Specifies *additional* options JVM options to be passed, such as `-Xmx2g` or `-Dproperty=value`.
See here for a list of available options:
<https://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html>
* **`ID_STR_CMDARGS` (#3)**
* **`ID_STR_CMDARGS` (0x3)**
Specifies *additional* fixed command-line parameters to be passed to the Java application.
* **`ID_STR_JREPATH` (#4)**
* **`ID_STR_JREPATH` (0x4)**
Specifies the path to the Java runtime (`javaw.exe`) relative to the launcher executable location.
If not specified, then the *default* runtime path `runtime\\bin\\javaw.exe` is assumed.
(This option does **not** apply to the “registry” variant of Launch5j)
* **`ID_STR_MUTEXID` (#5)**
* **`ID_STR_MUTEXID` (0x5)**
Specifies the application ID to be used when creating the [*single-instance*](http://www.bcbjournal.org/articles/vol3/9911/Single-instance_applications.htm) mutex.
The ID **must** be at least 5 characters in length and **should** be a *unique* string for each application!
If not specified, then **no** mutex will be created and thus *multiple* instances will be allowed.
@ -104,7 +135,24 @@ Some options can be configured via the launcher executable's [STRINGTABLE](https
(This option does **not** apply to the “nowait” variant of Launch5j)
* **`ID_STR_JAVAMIN` (#6)**
* **`ID_STR_HEAPMIN` (0x6)**
Specifies the the ***minimum*** Java heap size (i.e. JVM option `-Xms`), as percentage of the total physical memory.
This value must be an integral value in the `1` to `100` range.
(If `ID_STR_HEAPMAX` is specified too, then this value **must** be less than or equal to `ID_STR_HEAPMAX`).
* **`ID_STR_HEAPMAX` (0x7)**
Specifies the the ***maximum*** Java heap size (i.e. JVM option `-Xmx`), as percentage of the total physical memory.
This value must be an integral value in the `1` to `100` range.
(If `ID_STR_HEAPMIN` is specified too, then this value **must** be greater than or equal to `ID_STR_HEAPMIN`).
* **`ID_STR_NSETCWD` (0x8)**
If set to a non-zero value, do ***not*** change the current working directory.
(By default, the current working directory is set to the directory where the executable file is located)
* **`ID_STR_JAVAMIN` (0x9)**
Specifies the ***minimum*** supported JRE version, in the **`w.x.y.z`** format (e.g. `11.0.0.0`).
This values is *inclusive*, i.e. the specified JRE version or any newer JRE version will be accepted.
If not specified, then the *default* minimum supported JRE version `8.0.0.0` applies.
@ -113,7 +161,7 @@ Some options can be configured via the launcher executable's [STRINGTABLE](https
(This option only applies to the “registry” variant of Launch5j)
* **`ID_STR_JAVAMAX` (#7)**
* **`ID_STR_JAVAMAX` (0xA)**
Specifies the ***maximum*** supported JRE version, in the **`w.x.y.z`** format (e.g. `12.0.0.0`).
This values is *exclusive*, i.e. only JRE versions *older* than the specified JRE version will be accepted.
If not specified, then there is **no** upper limit on the supported JRE version.
@ -122,15 +170,15 @@ Some options can be configured via the launcher executable's [STRINGTABLE](https
(This option only applies to the “registry” variant of Launch5j)
* **`ID_STR_BITNESS` (#8)**
* **`ID_STR_BITNESS` (0xB)**
Specifies the required ***bitness*** of the JRE. This can be either **`32`** (x86, aka i586) or **`64`** (x86-64).
If not specified, then 32-Bit *and* 64-Bit JREs are accepted, with a preference to 64-Bit.
(This option only applies to the “registry” variant of Launch5j)
* **`ID_STR_JAVAURL` (#9)**
* **`ID_STR_JAVAURL` (0xC)**
The Java download URL that will ne suggested, if **no** suitable JRE could be detected on the machine.
If not specified, wes suggest downloading OpenJDK as provided by the [AdoptOpenJDK](https://adoptopenjdk.net/) project.
If not specified, wes suggest downloading OpenJDK, as provided by the [Eclipse Adoptium](https://adoptium.net/) project.
*Hint:* The URL must begin with a `http://` or `https://` prefix; otherwise the URL will be ignored!
@ -147,28 +195,27 @@ More specifically, Java replaces any characters in the given command-line argume
As a workaround for the current situation in Java, Launch5j will (by default) convert the given Unicode command-line arguments to the [UTF-8](https://en.wikipedia.org/wiki/UTF-8) format and then apply the [URL encoding](https://en.wikipedia.org/wiki/Percent-encoding) scheme. This ensures that *only* pure ASCII characters need to be passed to the Java executable, thus preventing the command-line arguments from being “mangled”. Still the original Unicode command-line arguments are preserved and *can* be reconstructed in the Java code.
The only downside is that additional processing is required in the application code:
The only downside is that a bit of additional processing is required in the application code. The command-line arguments can be decoded by using the `URLDecoder.decode()` method with the **UTF-8** charset. Also, applications should check the `l5j.encargs` system property before decoding the command-line arguments:
```java
public class YourMainClass {
public static void main(final String[] args) {
initCommandlineArgs(args);
/* your application code goes here! */
}
private static void initCommandlineArgs(final String[] argv) {
if (System.getProperty("l5j.pid") == null) {
return; /*nothing to do*/
public class MainClass {
public static void main(final String[] args) {
initCommandlineArgs(args);
/* Your application code goes here! */
}
final String utf8enc = StandardCharsets.UTF_8.name();
for (int i = 0; i < argv.length; ++i) {
try {
argv[i] = URLDecoder.decode(argv[i], utf8enc);
} catch (Exception e) { }
}
}
/* ... */
private static void initCommandlineArgs(final String[] argv) {
if (boolify(System.getProperty("l5j.encargs"))) {
final String enc = StandardCharsets.UTF_8.name();
for (int i = 0; i < argv.length; ++i) {
try {
argv[i] = URLDecoder.decode(argv[i], enc);
} catch (Exception e) { }
}
}
}
/* ... */
}
```
@ -176,16 +223,40 @@ public class YourMainClass {
![Unicode command-line arguments](etc/img/unicode-args.png)
Please refer to the file **`example/example.java`** for the *complete* example code!
## JAR file name
Be aware that the same problem of “mangled” Unicode characters applies when the path of the JAR file is passed to the Java executable. In other words, the Java runtime *fails* to execute any JAR files whose path &ndash; file name or directory name anywhere in the path &ndash; contains any Unicode characters that cannot be represented in the computer's *local* ANSI codepage! Unfortunately, we can **not** encode the path of the JAR file as we do with the other command-line arguments, because the Jave executable requires the path of the JAR file to be passed in a non-encoded form.
Be aware that the same problem of “mangled” Unicode characters applies when the path of the JAR file is passed to the Java executable. In other words, the Java runtime *fails* to execute any JAR files whose path &ndash; file name or any directory name in the path &ndash; contains any Unicode characters that cannot be represented in the computer's *local* ANSI codepage! Unfortunately, we can **not** encode the path of the JAR file as we do with the other command-line arguments, because the Java executable requires the path of the JAR file to be passed in a non-encoded form.
Therefore, it is recommended to ***only*** use ASCII characters in the name of your JAR file and in the “install” path !!!
# Command-line options
# Source code
The launcher executable recognizes the following “special” command-line options:
The source code of **Launch5j** is available from the official Git mirrors at:
* **`--l5j-about`**:
Display Launch5j about dialogue; includes version information and build configuration
* **`--l5j-slunk`**:
Enable experimental “slunk” mode; this is for experts only!
# Downloads
Official **Launch5j** download mirrors:
* <https://github.com/lordmulder/Launch5j/releases>
* <https://sourceforge.net/projects/muldersoft/files/Launch5j/>
* <https://bitbucket.org/muldersoft/launch5j/downloads/>
It is *highly recommended* to download Launch5j only from one of the mirrors listed above. We are **not** responsible for the integrity and trustworthiness of Launch5j downloads you may have received from other locations!
## Source code
**Launch5j** source code is available via [Git](https://git-scm.com/):
* `git clone https://github.com/lordmulder/Launch5j.git`
@ -196,13 +267,13 @@ The source code of **Launch5j** is available from the official Git mirrors at:
# Build instructions
In order to build **Launch5j** from the sources, it is recommended to use the [*GNU C Compiler* (GCC)](https://gcc.gnu.org/) for Windows, as provided by the [*Mingw-w64*](http://mingw-w64.org/) project. Other C compilers may work, but are **not** officially supported.
In order to build **Launch5j** from the sources, it is recommended to use the [*GNU C Compiler* (GCC)](https://gcc.gnu.org/) for Windows&trade;, as provided by the [*Mingw-w64*](http://mingw-w64.org/) project. Other C compilers may work, but are **not** officially supported.
Probably the most simple way to set up the required build environment is by installing the [**MSYS2**](https://www.msys2.org/) distribution, which includes *GCC* (Mingw-w64) as well as all the required build tools, such as *Bash* and *GNU make*.
Probably the most simple way to set up the required build environment is by installing the [**MSYS2**](https://www.msys2.org/) distribution, which includes *GCC* (Mingw-w64) as well as all the required build tools, such as *Bash*, *GNU make* and *Git*.
Please make sure that the essential development tools and the MinGW-w64 toolchains are installed:
$ pacman -S base-devel
$ pacman -S base-devel git
$ pacman -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain
Once the build environment has been set up, just run the provided Makefile:
@ -230,7 +301,7 @@ This project is partly inspired by the “Launch4j” project, even though it ha
This work has been released under the MIT license:
Copyright 2020 LoRd_MuldeR <mulder2@gmx.de>
Copyright 2024 LoRd_MuldeR <mulder2@gmx.de>
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

View File

@ -1,3 +1,4 @@
---
title: "Launch5j &ndash; README"
lang: en
---

4
build.EXAMPLE.cfg Normal file
View File

@ -0,0 +1,4 @@
MSYS2_DIR=C:\msys64
JAVA_HOME=C:\Program Files\BellSoft\LibericaJDK-8
ANT_HOME=C:\Program Files (x86)\Ant
PANDOC_DIR=C:\Program Files (x86)\Pandoc

View File

@ -2,9 +2,28 @@
setlocal enabledelayedexpansion
cd /d "%~dp0"
set "MSYS2_DIR=C:\msys64"
set "JAVA_HOME=C:\Java\jdk-8.0.265.01-hotspot"
set "ANT_HOME=C:\Program Files (x86)\Ant"
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Read configuration
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set MSYS2_DIR=
set JAVA_HOME=
set ANT_HOME=
set PANDOC_DIR=
if not exist "%~dp0.\build.cfg" (
echo Configuration file "build.cfg" not found. Please create^^!
pause
goto:eof
)
for /F "usebackq tokens=1,* delims==" %%a in ("%~dp0.\build.cfg") do (
set "%%~a=%%~b"
)
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Verify paths
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if not exist "%MSYS2_DIR%\msys2_shell.cmd" (
echo MSYS2 SHELL not found. Please check MSYS2_DIR and try again^^!
@ -24,6 +43,12 @@ if not exist "%ANT_HOME%\bin\ant.bat" (
goto:eof
)
if not exist "%PANDOC_DIR%\pandoc.exe" (
echo Pandoc not found. Please check PANDOC_DIR and try again^^!
pause
goto:eof
)
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Build!
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -40,7 +65,7 @@ for %%m in (32,64) do (
echo Build %%m-Bit
echo ========================================================================
echo.
call "%MSYS2_DIR%\msys2_shell.cmd" -mingw%%m -no-start -defterm -where "%~dp0" -c "make -B -j8"
call "%MSYS2_DIR%\msys2_shell.cmd" -mingw%%m -no-start -defterm -where "%~dp0" -c "make -B"
if not "!ERRORLEVEL!"=="0" goto:BuildHasFailed
echo.
)
@ -51,6 +76,15 @@ echo ========================================================================
echo.
set "PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin;%PATH%"
call "%ANT_HOME%\bin\ant.bat" -f "%~dp0.\src\example\build.xml"
echo.
echo ========================================================================
echo Generate docs
echo ========================================================================
echo.
echo "%~dp0.\README.md" --^> "%~dp0.\README.html"
"%PANDOC_DIR%\pandoc.exe" --verbose -f markdown-implicit_figures -t html5 --standalone --ascii --toc --toc-depth=2 --css="etc/css/gh-pandoc.css" -o "%~dp0.\README.html" "%~dp0.\README.yaml" "%~dp0.\README.md"
echo.
echo.
echo BUILD COMPLETED.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 41 KiB

BIN
etc/utils/7-zip/7za.exe Normal file

Binary file not shown.

View File

@ -0,0 +1,31 @@
7-Zip Extra
~~~~~~~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copyright (C) 1999-2019 Igor Pavlov.
7-Zip Extra files are under the GNU LGPL license.
Notes:
You can use 7-Zip Extra on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.
GNU LGPL information
--------------------
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 can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/

124
etc/utils/7-zip/readme.txt Normal file
View File

@ -0,0 +1,124 @@
7-Zip Extra 19.00
-----------------
7-Zip Extra is package of extra modules of 7-Zip.
7-Zip Copyright (C) 1999-2019 Igor Pavlov.
7-Zip is free software. Read License.txt for more information about license.
Source code of binaries can be found at:
http://www.7-zip.org/
This package contains the following files:
7za.exe - standalone console version of 7-Zip with reduced formats support.
7za.dll - library for working with 7z archives
7zxa.dll - library for extracting from 7z archives
License.txt - license information
readme.txt - this file
Far\ - plugin for Far Manager
x64\ - binaries for x64
All 32-bit binaries can work in:
Windows 2000 / 2003 / 2008 / XP / Vista / 7 / 8 / 10
and in any Windows x64 version with WoW64 support.
All x64 binaries can work in any Windows x64 version.
All binaries use msvcrt.dll.
7za.exe
-------
7za.exe - is a standalone console version of 7-Zip with reduced formats support.
Extra: 7za.exe : support for only some formats of 7-Zip.
7-Zip: 7z.exe with 7z.dll : support for all formats of 7-Zip.
7za.exe and 7z.exe from 7-Zip have same command line interface.
7za.exe doesn't use external DLL files.
You can read Help File (7-zip.chm) from 7-Zip package for description
of all commands and switches for 7za.exe and 7z.exe.
7za.exe features:
- High compression ratio in 7z format
- Supported formats:
- Packing / unpacking: 7z, xz, ZIP, GZIP, BZIP2 and TAR
- Unpacking only: Z, lzma, CAB.
- Highest compression ratio for ZIP and GZIP formats.
- Fast compression and decompression
- Strong AES-256 encryption in 7z and ZIP formats.
Note: LZMA SDK contains 7zr.exe - more reduced version of 7za.exe.
But you can use 7zr.exe as "public domain" code.
DLL files
---------
7za.dll and 7zxa.dll are reduced versions of 7z.dll from 7-Zip.
7za.dll and 7zxa.dll support only 7z format.
Note: 7z.dll is main DLL file that works with all archive types in 7-Zip.
7za.dll and 7zxa.dll support the following decoding methods:
- LZMA, LZMA2, PPMD, BCJ, BCJ2, COPY, 7zAES, BZip2, Deflate.
7za.dll also supports 7z encoding with the following encoding methods:
- LZMA, LZMA2, PPMD, BCJ, BCJ2, COPY, 7zAES.
7za.dll and 7zxa.dll work via COM interfaces.
But these DLLs don't use standard COM interfaces for objects creating.
Look also example code that calls DLL functions (in source code of 7-Zip):
7zip\UI\Client7z
Another example of binary that uses these interface is 7-Zip itself.
The following binaries from 7-Zip use 7z.dll:
- 7z.exe (console version)
- 7zG.exe (GUI version)
- 7zFM.exe (7-Zip File Manager)
Note: The source code of LZMA SDK also contains the code for similar DLLs
(DLLs without BZip2, Deflate support). And these files from LZMA SDK can be
used as "public domain" code. If you use LZMA SDK files, you don't need to
follow GNU LGPL rules, if you want to change the code.
License FAQ
-----------
Can I use the EXE or DLL files from 7-Zip in a commercial application?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Yes, but you are required to specify in documentation for your application:
(1) that you used parts of the 7-Zip program,
(2) that 7-Zip is licensed under the GNU LGPL license and
(3) you must give a link to www.7-zip.org, where the source code can be found.
Can I use the source code of 7-Zip in a commercial application?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Since 7-Zip is licensed under the GNU LGPL you must follow the rules of that license.
In brief, it means that any LGPL'ed code must remain licensed under the LGPL.
For instance, you can change the code from 7-Zip or write a wrapper for some
code from 7-Zip and compile it into a DLL; but, the source code of that DLL
(including your modifications / additions / wrapper) must be licensed under
the LGPL or GPL.
Any other code in your application can be licensed as you wish. This scheme allows
users and developers to change LGPL'ed code and recompile that DLL. That is the
idea of free software. Read more here: http://www.gnu.org/.
Note: You can look also LZMA SDK, which is available under a more liberal license.
---
End of document

View File

@ -2,19 +2,11 @@
setlocal enabledelayedexpansion
cd /d "%~dp0"
set "PANDOC_DIR=C:\Program Files (x86)\Pandoc"
if not exist "%PANDOC_DIR%\pandoc.exe" (
echo Pandoc not found. Please check PANDOC_DIR and try again^^!
pause
goto:eof
)
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Get current date
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set "ISO_DATE="
set ISO_DATE=
for /F "usebackq tokens=1" %%a in (`start /WAIT /B "" "%~dp0.\etc\utils\core-utils\date.exe" +"%%Y-%%m-%%d"`) do (
set "ISO_DATE=%%a"
@ -26,29 +18,6 @@ if "%ISO_DATE%"=="" (
goto:eof
)
set "OUTFILE=%~dp0.\out\launch5j-bin.%ISO_DATE%.zip"
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Clean-up
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkdir "%~dp0.\out" 2> NUL
del /F "%OUTFILE%" 2> NUL
if exist "%OUTFILE%" (
echo Failed to delete existing "%OUTFILE%" file!
pause
goto:eof
)
rmdir /Q /S "%~dp0.\out\~package" 2> NUL
if exist "%~dp0.\out\~package" (
echo Failed to delete existing "%~dp0.\out\~package" directory!
pause
goto:eof
)
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Build!
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -66,56 +35,95 @@ REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Copy binaries
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkdir "%~dp0.\out\~package"
mkdir "%~dp0.\out\~package\x64"
set "PACK_PATH=%~dp0.\out\~pkg%RANDOM%"
rmdir /Q /S "%PACK_PATH%" 2> NUL
copy /Y "%~dp0.\*.txt" "%~dp0.\out\~package"
copy /Y "%~dp0.\bin\launch5j_x86*.exe" "%~dp0.\out\~package"
copy /Y "%~dp0.\bin\launch5j_x64*.exe" "%~dp0.\out\~package\x64"
mkdir "%PACK_PATH%"
mkdir "%PACK_PATH%\x64"
mkdir "%PACK_PATH%\etc"
mkdir "%PACK_PATH%\etc\img"
mkdir "%PACK_PATH%\etc\css"
mkdir "%PACK_PATH%\example"
copy /Y "%~dp0.\*.txt" "%PACK_PATH%"
copy /Y "%~dp0.\*.html" "%PACK_PATH%"
copy /Y "%~dp0.\bin\launch5j_x86*.exe" "%PACK_PATH%"
copy /Y "%~dp0.\bin\launch5j_amd64*.exe" "%PACK_PATH%\x64"
copy /Y "%~dp0.\etc\img\*.png" "%PACK_PATH%\etc\img"
copy /Y "%~dp0.\etc\css\*.css" "%PACK_PATH%\etc\css"
mkdir "%~dp0.\out\~package\etc"
mkdir "%~dp0.\out\~package\etc\img"
mkdir "%~dp0.\out\~package\etc\style"
mkdir "%~dp0.\out\~package\example"
copy /Y /B "%~dp0.\bin\launch5j_x86_wrapped_registry.exe" + "%~dp0.\src\example\dist\example.jar" "%PACK_PATH%\example\example.exe"
copy /Y "%~dp0.\src\example\src\com\muldersoft\l5j\example\Main.java" "%PACK_PATH%\example\example.java"
copy /Y "%~dp0.\etc\img\*.png" "%~dp0.\out\~package\etc\img"
copy /Y "%~dp0.\etc\style\*.css" "%~dp0.\out\~package\etc\style"
attrib +R "%PACK_PATH%\*.*" /S
copy /Y /B "%~dp0.\bin\launch5j_x86_wrapped_registry.exe" + "%~dp0.\src\example\dist\example.jar" "%~dp0.\out\~package\example\example.exe"
copy /Y "%~dp0.\src\example\src\com\muldersoft\l5j\example\Main.java" "%~dp0.\out\~package\example\example.java"
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Output file
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"%PANDOC_DIR%\pandoc.exe" -f markdown-implicit_figures -t html5 --standalone --ascii --toc --toc-depth=2 --css="etc/style/gh-pandoc.css" "%~dp0.\README.yaml" "%~dp0.\README.md" > "%~dp0.\out\~package\README.html"
mkdir "%~dp0.\out" 2> NUL
attrib +R "%~dp0.\out\~package\*.*" /S
set /A COUNT=1
set "OUTFILE=%~dp0.\out\launch5j-bin.%ISO_DATE%"
:outfile_loop
if exist "%OUTFILE%.zip" goto:outfile_next
if exist "%OUTFILE%.7z" goto:outfile_next
goto:outfile_done
:outfile_next
set /A COUNT=%COUNT%+1
set "OUTFILE=%~dp0.\out\launch5j-bin.%ISO_DATE%.r%COUNT%"
goto:outfile_loop
:outfile_done
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Create ZIP package
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pushd "%~dp0.\out\~package"
pushd "%PACK_PATH%"
if not "%ERRORLEVEL%"=="0" (
pause
goto:eof
)
echo.
echo ========================================================================
echo Creating ZIP
echo ========================================================================
echo.
"%~dp0.\etc\utils\info-zip\zip.exe" -r -9 "%OUTFILE%" "*.*"
"%~dp0.\etc\utils\info-zip\zip.exe" -r -9 "%OUTFILE%.zip" "*.*"
if not "%ERRORLEVEL%"=="0" (
pause
goto:eof
)
attrib +R "%OUTFILE%.zip"
echo.
echo ========================================================================
echo Creating 7z
echo ========================================================================
echo.
"%~dp0.\etc\utils\7-zip\7za.exe" a -t7z -r "%OUTFILE%.7z" "*.*"
if not "%ERRORLEVEL%"=="0" (
pause
goto:eof
)
attrib +R "%OUTFILE%.7z"
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
REM Clean up
REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
popd
rmdir /Q /S "%~dp0.\out\~package" 2> NUL
attrib +R "%OUTFILE%"
rmdir /Q /S "%PACK_PATH%" 2> NUL
echo.
echo PACKAGE COMPLETED.

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="com.muldersoft.launch5j" version="${{version}}" processorArchitecture="${{processorArchitecture}}"/>
<description>Launch5j</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker"/>
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<asmv3:application>
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="com.muldersoft.launch5j" version="${{version}}" processorArchitecture="${{processorArchitecture}}"/>
<description>Launch5j</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
@ -9,21 +11,21 @@
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!--The ID below indicates application support for Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!--The ID below indicates application support for Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!--The ID below indicates application support for Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!--The ID below indicates application support for Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!--The ID below indicates application support for Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="${{processorArchitecture}}" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<asmv3:application>
<asmv3:windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

View File

@ -42,15 +42,22 @@ BEGIN
ID_STR_CMDARGS L"?" /*additional command-line args*/
ID_STR_JREPATH L"?" /*relative path to JRE*/
ID_STR_MUTEXID L"?" /*single instance mutex ID*/
ID_STR_HEAPMIN L"?" /*min. heap size, in percent of phys. memory*/
ID_STR_HEAPMAX L"?" /*max. heap size, in percent of phys. memory*/
ID_STR_NSETCWD L"?" /*do not set current working directory*/
END
/////////////////////////////////////////////////////////////////////////////
// Version
/////////////////////////////////////////////////////////////////////////////
#define L5J_VERSION_GLUE1(W,X,Y,Z) #W "." #X "." #Y " [build " #Z "]"
#define L5J_VERSION_GLUE2(W,X,Y,Z) L5J_VERSION_GLUE1(W,X,Y,Z)
#define L5J_VERSION_STR L5J_VERSION_GLUE2(L5J_VERSION_MAJOR,L5J_VERSION_MINOR,L5J_VERSION_PATCH,L5J_BUILDNO)
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,6,0,0
PRODUCTVERSION 0,6,0,0
FILEVERSION L5J_VERSION_MAJOR,L5J_VERSION_MINOR,L5J_VERSION_PATCH,L5J_BUILDNO
PRODUCTVERSION L5J_VERSION_MAJOR,L5J_VERSION_MINOR,L5J_VERSION_PATCH,L5J_BUILDNO
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x3L
@ -67,8 +74,8 @@ BEGIN
BEGIN
VALUE "ProductName", "Launch5j"
VALUE "FileDescription", "Launch5j"
VALUE "ProductVersion", "0.6.0"
VALUE "FileVersion", "0.6.0"
VALUE "ProductVersion", L5J_VERSION_STR
VALUE "FileVersion", L5J_VERSION_STR
VALUE "InternalName", "Launch5j"
VALUE "OriginalFilename", "launch5j.exe"
VALUE "LegalCopyright", "Created by LoRd_MuldeR <MuldeR2@GMX.de>"
@ -82,9 +89,3 @@ BEGIN
VALUE "Translation", 0x0, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
// Manifest
/////////////////////////////////////////////////////////////////////////////
1 RT_MANIFEST "assets/manifest.xml"

33
res/manifest-console.rc Normal file
View File

@ -0,0 +1,33 @@
/************************************************************/
/* Launch5j, by LoRd_MuldeR <MuldeR2@GMX.de> */
/* Java JAR wrapper for creating Windows native executables */
/* https://github.com/lordmulder/ */
/* */
/* This work has been released under the MIT license. */
/* Please see LICENSE.TXT for details! */
/* */
/* ACKNOWLEDGEMENT */
/* This project is partly inspired by the Launch4j project: */
/* https://sourceforge.net/p/launch4j/ */
/************************************************************/
#define APSTUDIO_READONLY_SYMBOLS
#include "WinResrc.h"
#undef APSTUDIO_READONLY_SYMBOLS
#include "../src/resource.h"
#ifndef L5J_CPU_ARCH
#error L5J_CPU_ARCH is not defined!
#endif
/////////////////////////////////////////////////////////////////////////////
// Manifest
/////////////////////////////////////////////////////////////////////////////
#define L5J_MANIFEST_GLUE1(X) #X
#define L5J_MANIFEST_GLUE2(X,Y,Z) L5J_MANIFEST_GLUE1(X.Y.Z)
#define L5J_MANIFEST_GLUE3(X,Y,Z) L5J_MANIFEST_GLUE2(X,Y,Z)
#define L5J_MANIFEST_STR L5J_MANIFEST_GLUE3(../tmp/assets/manifest-console,L5J_CPU_ARCH,xml)
1 RT_MANIFEST L5J_MANIFEST_STR

33
res/manifest-windows.rc Normal file
View File

@ -0,0 +1,33 @@
/************************************************************/
/* Launch5j, by LoRd_MuldeR <MuldeR2@GMX.de> */
/* Java JAR wrapper for creating Windows native executables */
/* https://github.com/lordmulder/ */
/* */
/* This work has been released under the MIT license. */
/* Please see LICENSE.TXT for details! */
/* */
/* ACKNOWLEDGEMENT */
/* This project is partly inspired by the Launch4j project: */
/* https://sourceforge.net/p/launch4j/ */
/************************************************************/
#define APSTUDIO_READONLY_SYMBOLS
#include "WinResrc.h"
#undef APSTUDIO_READONLY_SYMBOLS
#include "../src/resource.h"
#ifndef L5J_CPU_ARCH
#error L5J_CPU_ARCH is not defined!
#endif
/////////////////////////////////////////////////////////////////////////////
// Manifest
/////////////////////////////////////////////////////////////////////////////
#define L5J_MANIFEST_GLUE1(X) #X
#define L5J_MANIFEST_GLUE2(X,Y,Z) L5J_MANIFEST_GLUE1(X.Y.Z)
#define L5J_MANIFEST_GLUE3(X,Y,Z) L5J_MANIFEST_GLUE2(X,Y,Z)
#define L5J_MANIFEST_STR L5J_MANIFEST_GLUE3(../tmp/assets/manifest-windows,L5J_CPU_ARCH,xml)
1 RT_MANIFEST L5J_MANIFEST_STR

View File

@ -27,15 +27,27 @@ public class Main {
}
private static void initCommandlineArgs(final String[] argv) {
if (System.getProperty("l5j.pid") == null) {
return; /*nothing to do*/
if (boolify(System.getProperty("l5j.encargs"))) {
final String enc = StandardCharsets.UTF_8.name();
for (int i = 0; i < argv.length; ++i) {
try {
argv[i] = URLDecoder.decode(argv[i], enc);
} catch (Exception e) { }
}
}
final String enc = StandardCharsets.UTF_8.name();
for (int i = 0; i < argv.length; ++i) {
}
private static boolean boolify(final String string) {
if(string != null) {
final String value = string.trim();
if(value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes")) {
return true;
}
try {
argv[i] = URLDecoder.decode(argv[i], enc);
} catch (Exception e) { }
return (Integer.parseInt(value) > 0);
} catch(Exception e) { }
}
return false;
}
private static String dumpCommandLine(final String[] argv) {

View File

@ -11,6 +11,7 @@
/* https://sourceforge.net/p/launch4j/ */
/************************************************************/
#define UNICODE 1
#define WIN32_LEAN_AND_MEAN 1
// CRT
@ -20,6 +21,8 @@
#include <sys/stat.h>
#include <errno.h>
#include <direct.h>
#include <fcntl.h>
#include <mbctype.h>
// Win32 API
#include <Windows.h>
@ -30,6 +33,9 @@
#include "resource.h"
// Options
#ifndef L5J_ENABLE_GUI
#error L5J_ENABLE_GUI flag is *not* defined!
#endif
#ifndef L5J_JAR_FILE_WRAPPED
#error L5J_JAR_FILE_WRAPPED flag is *not* defined!
#endif
@ -49,16 +55,47 @@
#define L5J_WAIT_FOR_WINDOW 1
#endif
// Checks
#if L5J_ENABLE_SPLASH && (!L5J_ENABLE_GUI)
#error L5J_ENABLE_SPLASH requires L5J_ENABLE_GUI to be enabled!
#endif
// Const
static const wchar_t *const JRE_DOWNLOAD_LINK_DEFAULT = L"https://adoptopenjdk.net/";
static const wchar_t *const JRE_RELATIVE_PATH_DEFAULT = L"runtime\\bin\\javaw.exe";
static const wchar_t *const JRE_DOWNLOAD_LINK_DEFAULT = L"https://adoptium.net/";
static const wchar_t *const JRE_RELATIVE_PATH_DEFAULT = L"runtime\\bin";
static const wchar_t *const JRE_EXECUTABLE_NAME = L5J_ENABLE_GUI ? L"javaw.exe" : L"java.exe";
static const size_t MIN_MUTEXID_LENGTH = 5U;
static const size_t BYTES_PER_MEGABYTE = 1024U * 1024U;
static const DWORD SPLASH_SCREEN_TIMEOUT = 30000U;
// Check platform
#if !defined(_M_X64) && !defined(_M_IX86)
#error Unknown target platform!
#endif
/* ======================================================================== */
/* Miscellaneous */
/* ======================================================================== */
#define BOOLIFY(X) ((X) ? TRUE : FALSE)
#define PERCENT(X) (bound_value(1U, (X), 100U) / 100.0)
static DWORD bound_value(const DWORD min_value, const DWORD value, const DWORD max_value)
{
return max(min_value, min(max_value, value));
}
static ULONGLONG div_ceil(const ULONGLONG value, const ULONGLONG divisor)
{
return (!(value % divisor)) ? (value / divisor) : ((value / divisor) + 1ULL);
}
/* ======================================================================== */
/* String routines */
/* ======================================================================== */
static const wchar_t SPACE_CHAR = L'\x20';
#define XSTR(S) STR(S)
#define STR(S) #S
@ -126,6 +163,28 @@ static wchar_t *wcsndup (const wchar_t *const str, const size_t n)
return result;
}
static const wchar_t *skip_leading_spaces(const wchar_t *str)
{
if (NOT_EMPTY(str))
{
for (; (*str) && (*str <= SPACE_CHAR); ++str);
}
return str;
}
static BOOL starts_with(const wchar_t *const str, const wchar_t *const prefix)
{
const size_t prefix_len = wcslen(prefix);
if (wcsnicmp(skip_leading_spaces(str), prefix, prefix_len) == 0)
{
if ((!str[prefix_len]) || iswspace(str[prefix_len]))
{
return TRUE;
}
}
return FALSE;
}
static wchar_t *wcstrim(wchar_t *const str)
{
if (NOT_EMPTY(str))
@ -251,43 +310,46 @@ static const wchar_t *url_encode_str(const CHAR *const input)
return buffer;
}
static const wchar_t *url_encode_wcs(const wchar_t *const input, const UINT code_page)
{
const CHAR *byte_string = utf16_to_bytes(input, code_page);
if (!byte_string)
{
return NULL;
}
const wchar_t *encoded = url_encode_str(byte_string);
free((void*)byte_string);
return encoded;
}
/* ======================================================================== */
/* System information */
/* ======================================================================== */
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE hProcess, PBOOL wow64Process);
static BOOL running_on_64bit(void)
{
#ifndef _M_X64
BOOL is_wow64_flag = FALSE;
const LPFN_ISWOW64PROCESS is_wow64_process = (LPFN_ISWOW64PROCESS) GetProcAddress(GetModuleHandleW(L"kernel32"),"IsWow64Process");
if (is_wow64_process)
const HMODULE kernel32 = GetModuleHandleW(L"kernel32");
if (kernel32)
{
if (!is_wow64_process(GetCurrentProcess(), &is_wow64_flag))
const LPFN_ISWOW64PROCESS ptr_is_wow64_process = (LPFN_ISWOW64PROCESS) GetProcAddress(kernel32,"IsWow64Process");
if (ptr_is_wow64_process)
{
is_wow64_flag = FALSE;
BOOL is_wow64_flag = FALSE;
if (ptr_is_wow64_process(GetCurrentProcess(), &is_wow64_flag))
{
return is_wow64_flag;
}
}
}
return is_wow64_flag;
return FALSE;
#else
return TRUE;
#endif
}
static ULONGLONG get_physical_memory_size()
{
MEMORYSTATUSEX memory_status;
SecureZeroMemory(&memory_status, sizeof(MEMORYSTATUSEX));
memory_status.dwLength = sizeof(MEMORYSTATUSEX);
if (GlobalMemoryStatusEx(&memory_status))
{
return memory_status.ullTotalPhys;
}
return 0L;
}
/* ======================================================================== */
/* File name routines */
/* ======================================================================== */
@ -486,7 +548,7 @@ static DWORD load_uint32(const HINSTANCE hinstance, const UINT id, const DWORD f
{
DWORD value = fallback;
const wchar_t *const str = load_string(hinstance, id);
if(NOT_EMPTY(str))
if(AVAILABLE(str))
{
value = wcstoul(str, NULL, 10);
}
@ -832,7 +894,7 @@ static ULONGLONG parse_java_version(const wchar_t *const version_str)
static DWORD detect_java_runtime_verify(const wchar_t **const executable_path_out, const HKEY root_key, const wchar_t *const full_reg_path, const BOOL reg_view_64bit)
{
static const wchar_t *const JAVA_REG_NAMES[] = { L"JavaHome", L"Path", L"InstallationPath", NULL };
static const wchar_t *const JAVA_EXE_PATHS[] = { L"%s\\jre\\bin\\javaw.exe", L"%s\\bin\\javaw.exe", NULL };
static const wchar_t *const JAVA_EXE_PATHS[] = { L"%s\\jre\\bin\\%s", L"%s\\bin\\%s", NULL };
*executable_path_out = NULL;
DWORD result = 0U;
@ -847,10 +909,10 @@ static DWORD detect_java_runtime_verify(const wchar_t **const executable_path_ou
{
for (size_t j = 0U; JAVA_EXE_PATHS[j] && (!result); ++j)
{
const wchar_t *const javaw_executable_path = aswprintf(JAVA_EXE_PATHS[j], java_home_path);
if (javaw_executable_path)
const wchar_t *const java_executable_path = aswprintf(JAVA_EXE_PATHS[j], java_home_path, JRE_EXECUTABLE_NAME);
if (java_executable_path)
{
const wchar_t *const absolute_executable_path = get_absolute_path(javaw_executable_path);
const wchar_t *const absolute_executable_path = get_absolute_path(java_executable_path);
if (absolute_executable_path)
{
const DWORD bitness = file_is_executable(absolute_executable_path);
@ -864,7 +926,7 @@ static DWORD detect_java_runtime_verify(const wchar_t **const executable_path_ou
free((void*)absolute_executable_path);
}
}
free((void*)javaw_executable_path);
free((void*)java_executable_path);
}
}
}
@ -907,7 +969,7 @@ static BOOL detect_java_runtime_scan_javasoft(const wchar_t *const key_name, con
return TRUE;
}
static BOOL detect_java_runtime_scan_adoptjdk(const wchar_t *const key_name, const ULONG_PTR user_data)
static BOOL detect_java_runtime_scan_adoptium(const wchar_t *const key_name, const ULONG_PTR user_data)
{
static const wchar_t *const JVM_NATURE[] = { L"hotspot", L"openj9", NULL };
@ -982,20 +1044,22 @@ static BOOL detect_java_runtime_scan_liberica(const wchar_t *const key_name, con
return TRUE;
}
static const wchar_t *detect_java_runtime(const DWORD required_bitness, const ULONGLONG required_ver_min, const ULONGLONG required_ver_max)
static const wchar_t *detect_java_runtime(const DWORD required_bitness, const ULONGLONG required_ver_min, const ULONGLONG required_ver_max, DWORD *const bitness_out, ULONGLONG *const version_out)
{
typedef struct { UINT mode; const wchar_t *path; } reg_key_t;
static const reg_key_t REG_KEYS[] =
{
{ 1U, L"SOFTWARE\\JavaSoft\\Java Runtime Environment" }, { 1U, L"SOFTWARE\\JavaSoft\\JRE" }, { 2U, L"SOFTWARE\\AdoptOpenJDK\\JRE" },
{ 1U, L"SOFTWARE\\JavaSoft\\Java Development Kit" }, { 1U, L"SOFTWARE\\JavaSoft\\JDK" }, { 2U, L"SOFTWARE\\AdoptOpenJDK\\JDK" },
{ 3U, L"SOFTWARE\\BellSoft\\Liberica"},
{ 0U, NULL }
{ 1U, L"SOFTWARE\\Eclipse Adoptium\\JRE" }, { 1U, L"SOFTWARE\\AdoptOpenJDK\\JRE" },
{ 1U, L"SOFTWARE\\Eclipse Adoptium\\JDK" }, { 1U, L"SOFTWARE\\AdoptOpenJDK\\JDK" },
{ 2U, L"SOFTWARE\\JavaSoft\\Java Runtime Environment" }, { 2U, L"SOFTWARE\\JavaSoft\\JRE" },
{ 2U, L"SOFTWARE\\JavaSoft\\Java Development Kit" }, { 2U, L"SOFTWARE\\JavaSoft\\JDK" },
{ 3U, L"SOFTWARE\\BellSoft\\Liberica" },
{ 3U, L"SOFTWARE\\Azul Systems\\Zulu" }, { 0U, NULL }
};
const wchar_t *runtime_path = NULL;
DWORD bitness = 0U;
ULONGLONG version = 0U;
*bitness_out = 0U;
*version_out = 0U;
for (UINT i = running_on_64bit() ? 0U : 1U; i < 2U; ++i)
{
@ -1006,15 +1070,15 @@ static const wchar_t *detect_java_runtime(const DWORD required_bitness, const UL
{
{ required_bitness, required_ver_min, required_ver_max },
{ HKEY_LOCAL_MACHINE, REG_KEYS[j].path, reg_view_64bit },
{ bitness, version, NULL }
{ *bitness_out, *version_out, NULL }
};
switch(REG_KEYS[j].mode)
{
case 1U:
reg_enum_subkeys(HKEY_LOCAL_MACHINE, REG_KEYS[j].path, reg_view_64bit, detect_java_runtime_scan_javasoft, (ULONG_PTR)&search_state);
reg_enum_subkeys(HKEY_LOCAL_MACHINE, REG_KEYS[j].path, reg_view_64bit, detect_java_runtime_scan_adoptium, (ULONG_PTR)&search_state);
break;
case 2U:
reg_enum_subkeys(HKEY_LOCAL_MACHINE, REG_KEYS[j].path, reg_view_64bit, detect_java_runtime_scan_adoptjdk, (ULONG_PTR)&search_state);
reg_enum_subkeys(HKEY_LOCAL_MACHINE, REG_KEYS[j].path, reg_view_64bit, detect_java_runtime_scan_javasoft, (ULONG_PTR)&search_state);
break;
case 3U:
reg_enum_subkeys(HKEY_LOCAL_MACHINE, REG_KEYS[j].path, reg_view_64bit, detect_java_runtime_scan_liberica, (ULONG_PTR)&search_state);
@ -1022,14 +1086,14 @@ static const wchar_t *detect_java_runtime(const DWORD required_bitness, const UL
}
if(search_state.result.runtime_path)
{
bitness = search_state.result.bitness;
version = search_state.result.version;
*bitness_out = search_state.result.bitness;
*version_out = search_state.result.version;
SET_STRING(runtime_path, search_state.result.runtime_path);
}
}
}
if (((required_bitness == 0U) || (bitness == required_bitness)) && (version >= required_ver_min) && (version < required_ver_max) && runtime_path)
if (((required_bitness == 0U) || (*bitness_out == required_bitness)) && (*version_out >= required_ver_min) && (*version_out < required_ver_max) && runtime_path)
{
return runtime_path;
}
@ -1060,56 +1124,96 @@ static DWORD load_java_bitness(const HINSTANCE hinstance, const UINT id)
return ((value == 32U) || (value == 64U)) ? value : 0U;
}
static const wchar_t *get_java_full_path(const wchar_t *const jre_base_path, const wchar_t *const jre_relative_path)
{
const wchar_t *const relative_path_ptr = AVAILABLE(jre_relative_path) ? skip_leading_separator(jre_relative_path) : NULL;
return aswprintf(L"%s\\%s\\%s", jre_base_path, NOT_EMPTY(relative_path_ptr) ? relative_path_ptr: JRE_RELATIVE_PATH_DEFAULT, JRE_EXECUTABLE_NAME);
}
/* ======================================================================== */
/* Command-line */
/* ======================================================================== */
static const wchar_t *get_commandline_args(const wchar_t *cmd_line)
{
BOOL double_quote = FALSE;
if (NOT_EMPTY(cmd_line))
{
cmd_line = skip_leading_spaces(cmd_line);
for (; (*cmd_line) && ((*cmd_line > SPACE_CHAR) || double_quote); ++cmd_line)
{
if (*cmd_line == L'"') double_quote = (!double_quote);
if (_ismbblead(*cmd_line) && cmd_line[1U]) ++cmd_line;
}
return skip_leading_spaces(cmd_line);
}
else
{
return L""; /*no args*/
}
}
static wchar_t *encode_commandline_args(const int argc, const LPWSTR *const argv)
{
wchar_t *result_buffer = NULL;
if (argv && (argc > 0))
if (!(argv && (argc > 0)))
{
const wchar_t **encoded_argv = (const wchar_t**) malloc(sizeof(wchar_t*) * argc);
if (encoded_argv)
return NULL;
}
const CHAR **argv_utf8 = (const CHAR**) malloc(sizeof(CHAR*) * argc);
if(!argv_utf8)
{
return NULL;
}
size_t total_len = 0U;
for (int i = 0; i < argc; ++i)
{
argv_utf8[i] = utf16_to_bytes(argv[i], CP_UTF8);
if (argv_utf8[i])
{
size_t total_len = 0U;
for (int i = 0; i < argc; ++i)
{
if (NOT_EMPTY(encoded_argv[i] = url_encode_wcs(argv[i], CP_UTF8)))
{
total_len += (wcslen(encoded_argv[i]) + 1U);
}
}
if (total_len > 0U)
{
if ((result_buffer = (wchar_t*) calloc( total_len, sizeof(wchar_t))))
{
for(int i = 0; i < argc; ++i)
{
if (NOT_EMPTY(encoded_argv[i]))
{
if(result_buffer[0U])
{
wcscat(result_buffer, L" ");
}
wcscat(result_buffer, encoded_argv[i]);
}
}
}
}
for (int i = 0; i < argc; ++i)
{
free((void*)encoded_argv[i]);
}
free(encoded_argv);
total_len += argv_utf8[i][0U] ? url_encoded_length(argv_utf8[i]) : 3U;
}
}
wchar_t *result_buffer = NULL;
if (total_len > 0U)
{
if ((result_buffer = (wchar_t*) calloc(total_len, sizeof(wchar_t))))
{
for (int i = 0; i < argc; ++i)
{
if (argv_utf8[i])
{
if (result_buffer[0U])
{
wcscat(result_buffer, L" ");
}
if (argv_utf8[i][0U])
{
const wchar_t *const arg_encoded = url_encode_str(argv_utf8[i]);
if (arg_encoded)
{
wcscat(result_buffer, arg_encoded);
free((void*)arg_encoded);
}
}
else
{
wcscat(result_buffer, L"\"\"");
}
free((void*)argv_utf8[i]);
}
}
}
}
free(argv_utf8);
return result_buffer;
}
static const wchar_t *encode_commandline(const wchar_t *const command_line)
static const wchar_t *encode_commandline_str(const wchar_t *const command_line)
{
#if L5J_ENCODE_ARGS
const wchar_t * encoded = NULL;
if (NOT_EMPTY(command_line))
{
@ -1122,9 +1226,66 @@ static const wchar_t *encode_commandline(const wchar_t *const command_line)
}
}
return encoded;
}
const wchar_t *create_heap_size_parameters(const DWORD jvm_heap_percent_min, const DWORD jvm_heap_percent_max, const wchar_t *const jvm_extra_args, const DWORD heap_size_limit)
{
const ULONGLONG physical_memory_size = get_physical_memory_size();
if (physical_memory_size > 33554432ULL)
{
const DWORD heap_size_mbytes_min = jvm_heap_percent_min ? bound_value(16U, (DWORD)div_ceil((ULONGLONG)(PERCENT(jvm_heap_percent_min) * physical_memory_size), BYTES_PER_MEGABYTE), heap_size_limit) : 0U;
const DWORD heap_size_mbytes_max = jvm_heap_percent_max ? bound_value(16U, (DWORD)div_ceil((ULONGLONG)(PERCENT(jvm_heap_percent_max) * physical_memory_size), BYTES_PER_MEGABYTE), heap_size_limit) : 0U;
if ((heap_size_mbytes_min > 0U) && (heap_size_mbytes_max >= heap_size_mbytes_min))
{
return AVAILABLE(jvm_extra_args)
? aswprintf(L"-Xms%um -Xmx%um %s", heap_size_mbytes_min, heap_size_mbytes_max, jvm_extra_args)
: aswprintf(L"-Xms%um -Xmx%um", heap_size_mbytes_min, heap_size_mbytes_max);
}
else if ((heap_size_mbytes_min > 0U) || (heap_size_mbytes_max > 0U))
{
return AVAILABLE(jvm_extra_args)
? aswprintf(L"-Xm%c%um %s", (heap_size_mbytes_max > 0U) ? L'x' : L's', (heap_size_mbytes_max > 0U) ? heap_size_mbytes_max : heap_size_mbytes_min, jvm_extra_args)
: aswprintf(L"-Xm%c%um", (heap_size_mbytes_max > 0U) ? L'x' : L's', (heap_size_mbytes_max > 0U) ? heap_size_mbytes_max : heap_size_mbytes_min);
}
}
return NULL;
}
static const wchar_t *build_commandline(const DWORD pid, const wchar_t *const java_runtime_path, const wchar_t *const jar_file_path, const wchar_t *const jvm_extra_args, const wchar_t *const cmd_extra_args, const wchar_t *const cmd_input_args)
{
const wchar_t *command_line;
const wchar_t *const jarfile_short_path = get_short_path(jar_file_path);
const wchar_t *const jarfile_ptr = NOT_EMPTY(jarfile_short_path) ? jarfile_short_path : jar_file_path;
#if L5J_ENCODE_ARGS
const wchar_t *const ext_args_encoded = AVAILABLE(cmd_extra_args) ? encode_commandline_str(cmd_extra_args) : NULL;
const wchar_t *const cmd_args_encoded = NOT_EMPTY(cmd_input_args) ? encode_commandline_str(cmd_input_args) : NULL;
#else
return wcsdup(command_line);
const wchar_t *const ext_args_encoded = AVAILABLE(cmd_extra_args) ? skip_leading_spaces(cmd_extra_args) : NULL;
const wchar_t *const cmd_args_encoded = NOT_EMPTY(cmd_input_args) ? skip_leading_spaces(cmd_input_args) : NULL;
#endif
if (NOT_EMPTY(ext_args_encoded))
{
command_line = AVAILABLE(jvm_extra_args)
? aswprintf(NOT_EMPTY(cmd_args_encoded) ? L"\"%s\" %s -Dl5j.pid=%u -Dl5j.encargs=%u -jar \"%s\" %s %s" : L"\"%s\" %s -Dl5j.pid=%u -Dl5j.encargs=%u -jar \"%s\" %s", java_runtime_path, jvm_extra_args, pid, BOOLIFY(L5J_ENCODE_ARGS), jarfile_ptr, ext_args_encoded, cmd_args_encoded)
: aswprintf(NOT_EMPTY(cmd_args_encoded) ? L"\"%s\" -Dl5j.pid=%u -Dl5j.encargs=%u -jar \"%s\" %s %s" : L"\"%s\" -Dl5j.pid=%u -Dl5j.encargs=%u -jar \"%s\" %s", java_runtime_path, pid, BOOLIFY(L5J_ENCODE_ARGS), jarfile_ptr, ext_args_encoded, cmd_args_encoded);
}
else
{
command_line = AVAILABLE(jvm_extra_args)
? aswprintf(NOT_EMPTY(cmd_args_encoded) ? L"\"%s\" %s -Dl5j.pid=%u -Dl5j.encargs=%u -jar \"%s\" %s" : L"\"%s\" %s -Dl5j.pid=%u -Dl5j.encargs=%u -jar \"%s\"", java_runtime_path, jvm_extra_args, pid, BOOLIFY(L5J_ENCODE_ARGS), jarfile_ptr, cmd_args_encoded)
: aswprintf(NOT_EMPTY(cmd_args_encoded) ? L"\"%s\" -Dl5j.pid=%u -Dl5j.encargs=%u -jar \"%s\" %s" : L"\"%s\" -Dl5j.pid=%u -Dl5j.encargs=%u -jar \"%s\"", java_runtime_path, pid, BOOLIFY(L5J_ENCODE_ARGS), jarfile_ptr, cmd_args_encoded);
}
#if L5J_ENCODE_ARGS
free((void*)ext_args_encoded);
free((void*)cmd_args_encoded);
#endif
free((void*)jarfile_short_path);
return command_line;
}
/* ======================================================================== */
@ -1265,7 +1426,11 @@ static const wchar_t *describe_system_error(const DWORD error_code)
return error_test;
}
#if L5J_ENABLE_GUI
#define show_message(HWND, FLAGS, TITLE, TEXT) MessageBoxW((HWND), (TEXT), (TITLE), (FLAGS))
#else
#define show_message(HWND, FLAGS, TITLE, TEXT) ({ __ms_fwprintf(stderr, L"[%s]\n\n%s\n", (TITLE), (TEXT)); fflush(stderr); IDCANCEL; })
#endif
static int show_message_format(HWND hwnd, const DWORD flags, const wchar_t *const title, const wchar_t *const format, ...)
{
@ -1276,7 +1441,7 @@ static int show_message_format(HWND hwnd, const DWORD flags, const wchar_t *cons
const wchar_t *const text = vaswprintf(format, ap );
if(NOT_EMPTY(text))
{
result = MessageBoxW(hwnd, text, title, flags);
result = show_message(hwnd, flags, title, text);
}
free((void*)text);
@ -1317,29 +1482,74 @@ static void show_jre_download_notice(const HINSTANCE hinstance, const HWND hwnd,
free(jre_download_link);
}
static void show_about_dialogue(const HWND hwnd)
{
#ifdef _M_X64
const wchar_t *const CPU_ARCH = L"x64";
#else
const wchar_t *const CPU_ARCH = L"x86";
#endif
show_message_format(hwnd, MB_ICONINFORMATION, L"About Launch5j",
L"Launch5j, by LoRd_MuldeR <MuldeR2@GMX.de>\n"
L"Version: %u.%u.%u (%s), Build: #%u, %s\n\n"
L"This work has been released under the MIT license.\n"
L"For details, please see:\n"
L"https://opensource.org/licenses/MIT\n\n"
L"Check the project website for news and updates:\n"
L"https://github.com/lordmulder/\n\n"
L"Build options:\n"
L"L5J_ENABLE_GUI=%d, JAR_FILE_WRAPPED=%d, DETECT_REGISTRY=%d, ENABLE_SPLASH=%d, STAY_ALIVE=%d, ENCODE_ARGS=%d, WAIT_FOR_WINDOW=%d",
L5J_VERSION_MAJOR, L5J_VERSION_MINOR, L5J_VERSION_PATCH, CPU_ARCH, L5J_BUILDNO, TEXT(__DATE__),
L5J_ENABLE_GUI, L5J_JAR_FILE_WRAPPED, L5J_DETECT_REGISTRY, L5J_ENABLE_SPLASH, L5J_STAY_ALIVE, L5J_ENCODE_ARGS, L5J_WAIT_FOR_WINDOW);
}
static void enable_slunk_mode(const HWND hwnd)
{
const WORD DATA[45U] =
{
0x1924, 0x82AB, 0x5252, 0xC021, 0xE1A3, 0x3969, 0xFEE5, 0x4A4A, 0x93E3, 0x3470, 0xDED9, 0x3A97, 0x12E1, 0xC694, 0xF5A7,
0x8539, 0x82A9, 0x864D, 0x8853, 0x5E0F, 0x4803, 0x45CC, 0x19B7, 0x391A, 0x0753, 0x1936, 0x6ECA, 0xCAEA, 0xA340, 0x5574,
0x8A94, 0x0620, 0x405A, 0x8D0B, 0xB221, 0x1FC5, 0x42A4, 0x95BB, 0x689A, 0x8C61, 0x4EEC, 0x82CA, 0x728B, 0xFE59, 0x47B8
};
UINT32 mask = 0xB499E87D;
wchar_t slunk[45U];
for(size_t i = 0; i < 45U; ++i)
{
mask = mask * 214013U + 2531011U;
slunk[i] = (wchar_t) ((DATA[i] ^ mask) & 0xFFFF);
}
ShellExecute(hwnd, NULL, slunk, NULL, NULL, SW_SHOW);
}
/* ======================================================================== */
/* Single instance */
/* ======================================================================== */
static ULONGLONG hash_code(const BYTE *const message, const size_t message_len)
static void hash_update(ULONGLONG *const hash, const BYTE *const data, const size_t length)
{
for (size_t iter = 0U; iter < length; ++iter)
{
*hash ^= data[iter];
*hash *= 0x00000100000001B3ull;
}
}
static ULONGLONG hash_code(const DWORD salt, const BYTE *const message, const size_t message_len)
{
ULONGLONG hash = 0xCBF29CE484222325ull;
for (size_t iter = 0U; iter < message_len; ++iter)
{
hash ^= message[iter];
hash *= 0x00000100000001B3ull;
}
hash_update(&hash, (BYTE*)&salt, sizeof(DWORD));
hash_update(&hash, message, message_len);
return hash;
}
static BOOL initialize_mutex(HANDLE *const handle, const wchar_t *const mutex_name)
{
static const char *const BUILD_TIME = __DATE__ " " __TIME__;
const size_t name_length = sizeof(wchar_t) * wcslen(mutex_name);
const ULONGLONG hashcode_0 = hash_code((const BYTE*)BUILD_TIME, sizeof(wchar_t) * strlen(BUILD_TIME));
const ULONGLONG hashcode_1 = hash_code((const BYTE*)mutex_name, sizeof(wchar_t) * wcslen(mutex_name));
const ULONGLONG hash_0 = hash_code(0x6CAD7ECA, (const BYTE*)mutex_name, name_length);
const ULONGLONG hash_1 = hash_code(0xE2503816, (const BYTE*)mutex_name, name_length);
const wchar_t *const mutex_uuid = aswprintf(L"l5j.%016llX%016llX", hashcode_0, hashcode_1);
const wchar_t *const mutex_uuid = aswprintf(L"l5j.%016I64x%016I64x", hash_0, hash_1);
if (!mutex_uuid)
{
return TRUE; /*better safe than sorry*/
@ -1396,21 +1606,23 @@ static void destroy_window(HWND *const hwnd)
static wchar_t *const DEFAULT_HEADING = L"Launch5j";
#define APP_HEADING (AVAILABLE(app_heading) ? app_heading : DEFAULT_HEADING)
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE _hPrevInstance, PWSTR pCmdLine, int _nCmdShow)
static int launch5j_main(const HINSTANCE hinstance, const wchar_t *const cmd_line_args)
{
int result = -1;
const wchar_t *app_heading = NULL, *mutex_name = NULL, *executable_path = NULL, *executable_directory = NULL, *jarfile_path = NULL, * jarfile_short_path = NULL,
*java_runtime_path = NULL, *jre_relative_path = NULL, *jvm_extra_args = NULL, *cmd_extra_args = NULL, *cmd_args_encoded = NULL, *ext_args_encoded = NULL, *command_line = NULL;
const wchar_t *app_heading = NULL, *mutex_name = NULL, *executable_path = NULL, *executable_directory = NULL, *jarfile_path = NULL,
*java_runtime_path = NULL, *jre_relative_path = NULL, *jvm_extra_args = NULL, *cmd_extra_args = NULL, *command_line = NULL;
HANDLE mutex_handle = NULL;
DWORD java_required_bitness = 0U;
ULONGLONG java_required_ver_min = 0ULL, java_required_ver_max = 0ULL;
DWORD java_required_bitness = 0U, jvm_heap_percent_min = 0U, jvm_heap_percent_max = 0U, jvm_bitness = 0U;
ULONGLONG java_required_ver_min = 0ULL, java_required_ver_max = 0ULL, jvm_version = 0ULL;
HGDIOBJ splash_image = NULL;
BOOL have_screen_created = FALSE;
BOOL have_screen_created = FALSE, set_current_directory_enabled = TRUE;
PROCESS_INFORMATION process_info;
STARTUPINFOW startup_info;
// Ensure that the ComCtl32 DLL is loaded
#if L5J_ENABLE_GUI
InitCommonControls();
#endif
// Initialize
SecureZeroMemory(&startup_info, sizeof(STARTUPINFOW));
@ -1420,14 +1632,26 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE _hPrevInstance, PWSTR pCmdLin
const DWORD pid = GetCurrentProcessId();
// Load title
app_heading = load_string(hInstance, ID_STR_HEADING);
app_heading = load_string(hinstance, ID_STR_HEADING);
// Create the window
HWND hwnd = CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, L"STATIC", APP_HEADING, WS_POPUP | SS_BITMAP, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);
HWND hwnd = L5J_ENABLE_GUI ? CreateWindowExW(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, L"STATIC", APP_HEADING, WS_POPUP | SS_BITMAP, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hinstance, NULL) : NULL;
// Show about screen?
if (starts_with(cmd_line_args, L"--l5j-about"))
{
show_about_dialogue(hwnd);
return 0;
}
if (starts_with(cmd_line_args, L"--l5j-slunk"))
{
enable_slunk_mode(hwnd);
return 0;
}
// Single instance
#if L5J_STAY_ALIVE
mutex_name = load_string(hInstance, ID_STR_MUTEXID);
mutex_name = load_string(hinstance, ID_STR_MUTEXID);
if (AVAILABLE(mutex_name) && (wcslen(mutex_name) >= MIN_MUTEXID_LENGTH + ((mutex_name[0U] == L'@') ? 0U : 1U)))
{
if(!initialize_mutex(&mutex_handle, (mutex_name[0U] == L'@') ? mutex_name + 1U : mutex_name))
@ -1444,7 +1668,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE _hPrevInstance, PWSTR pCmdLin
// Show the splash screen
#if L5J_ENABLE_SPLASH
if ((splash_image = LoadImage(hInstance, MAKEINTRESOURCE(ID_BITMAP_SPLASH), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE)))
if ((splash_image = LoadImage(hinstance, MAKEINTRESOURCE(ID_BITMAP_SPLASH), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE)))
{
if (create_splash_screen(hwnd, splash_image))
{
@ -1469,7 +1693,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE _hPrevInstance, PWSTR pCmdLin
}
// Set the current directory
if (_wcsicmp(executable_directory, L".") != 0)
if (set_current_directory_enabled = (!BOOLIFY(load_uint32(hinstance, ID_STR_NSETCWD, 0U))))
{
set_current_directory(executable_directory);
}
@ -1490,29 +1714,25 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE _hPrevInstance, PWSTR pCmdLin
}
#endif
// Convert JAR file path to short form
jarfile_short_path = get_short_path(jarfile_path);
// Find the Java runtime executable path (possibly from the registry)
#if L5J_DETECT_REGISTRY
java_required_ver_min = load_java_version(hInstance, ID_STR_JAVAMIN, (8ull << 48));
java_required_ver_max = load_java_version(hInstance, ID_STR_JAVAMAX, MAXULONGLONG);
java_required_bitness = load_java_bitness(hInstance, ID_STR_BITNESS);
if (!(java_runtime_path = detect_java_runtime(java_required_bitness, java_required_ver_min, java_required_ver_max)))
java_required_ver_min = load_java_version(hinstance, ID_STR_JAVAMIN, (8ull << 48));
java_required_ver_max = load_java_version(hinstance, ID_STR_JAVAMAX, MAXULONGLONG);
java_required_bitness = load_java_bitness(hinstance, ID_STR_BITNESS);
if (!(java_runtime_path = detect_java_runtime(java_required_bitness, java_required_ver_min, java_required_ver_max, &jvm_bitness, &jvm_version)))
{
show_message(hwnd, MB_ICONERROR | MB_TOPMOST, APP_HEADING, L"Java Runtime Environment (JRE) could not be found!");
show_jre_download_notice(hInstance, hwnd, APP_HEADING, java_required_bitness, java_required_ver_min);
show_jre_download_notice(hinstance, hwnd, APP_HEADING, java_required_bitness, java_required_ver_min);
goto cleanup;
}
#else
jre_relative_path = load_string(hInstance, ID_STR_JREPATH);
const wchar_t *const jre_relative_path_offset = AVAILABLE(jre_relative_path) ? skip_leading_separator(jre_relative_path) : NULL;
if (!(java_runtime_path = aswprintf(L"%s\\%s", executable_directory, NOT_EMPTY(jre_relative_path_offset) ? jre_relative_path_offset: JRE_RELATIVE_PATH_DEFAULT)))
jre_relative_path = load_string(hinstance, ID_STR_JREPATH);
if (!(java_runtime_path = get_java_full_path(executable_directory, jre_relative_path)))
{
show_message(hwnd, MB_ICONERROR | MB_TOPMOST, APP_HEADING, L"The path of the Java runtime could not be determined!");
goto cleanup;
}
if (!file_is_executable(java_runtime_path))
if (!BOOLIFY(jvm_bitness = file_is_executable(java_runtime_path)))
{
show_message_format(hwnd, MB_ICONERROR | MB_TOPMOST, APP_HEADING, L"The Java runtime could not be found or is invalid:\n\n%s\n\n\nRe-installing the application may fix the problem!", java_runtime_path);
goto cleanup;
@ -1520,29 +1740,24 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE _hPrevInstance, PWSTR pCmdLin
#endif
// Load additional options
jvm_extra_args = load_string(hInstance, ID_STR_JVMARGS);
cmd_extra_args = load_string(hInstance, ID_STR_CMDARGS);
jvm_extra_args = load_string(hinstance, ID_STR_JVMARGS);
cmd_extra_args = load_string(hinstance, ID_STR_CMDARGS);
// Get user-provided command-line args
cmd_args_encoded = encode_commandline(pCmdLine);
// Build command-line
if (AVAILABLE(cmd_extra_args) && (ext_args_encoded = encode_commandline(cmd_extra_args)))
// Set minimum/maximum Java heap size
jvm_heap_percent_min = bound_value(0U, load_uint32(hinstance, ID_STR_HEAPMIN, 0U), 100U);
jvm_heap_percent_max = bound_value(0U, load_uint32(hinstance, ID_STR_HEAPMAX, 0U), 100U);
if ((jvm_heap_percent_min > 0U) || (jvm_heap_percent_max > 0U))
{
const wchar_t *const jarfile_ptr = NOT_EMPTY(jarfile_short_path) ? jarfile_short_path : jarfile_path;
command_line = AVAILABLE(jvm_extra_args)
? aswprintf(NOT_EMPTY(cmd_args_encoded) ? L"\"%s\" %s -Dl5j.pid=%u -jar \"%s\" %s %s" : L"\"%s\" %s -Dl5j.pid=%u -jar \"%s\" %s", java_runtime_path, jvm_extra_args, pid, jarfile_ptr, ext_args_encoded, cmd_args_encoded)
: aswprintf(NOT_EMPTY(cmd_args_encoded) ? L"\"%s\" -Dl5j.pid=%u -jar \"%s\" %s %s" : L"\"%s\" -Dl5j.pid=%u -jar \"%s\" %s", java_runtime_path, pid, jarfile_ptr, ext_args_encoded, cmd_args_encoded);
}
else
{
const wchar_t *const jarfile_ptr = NOT_EMPTY(jarfile_short_path) ? jarfile_short_path : jarfile_path;
command_line = AVAILABLE(jvm_extra_args)
? aswprintf(NOT_EMPTY(cmd_args_encoded) ? L"\"%s\" %s -Dl5j.pid=%u -jar \"%s\" %s" : L"\"%s\" %s -Dl5j.pid=%u -jar \"%s\"", java_runtime_path, jvm_extra_args, pid, jarfile_ptr, cmd_args_encoded)
: aswprintf(NOT_EMPTY(cmd_args_encoded) ? L"\"%s\" -Dl5j.pid=%u -jar \"%s\" %s" : L"\"%s\" -Dl5j.pid=%u -jar \"%s\"", java_runtime_path, pid, jarfile_ptr, cmd_args_encoded);
const wchar_t *const jvm_heap_size_args = create_heap_size_parameters(jvm_heap_percent_min, jvm_heap_percent_max, jvm_extra_args, (jvm_bitness && (jvm_bitness < 64U)) ? 1024U : MAXDWORD);
if (jvm_heap_size_args)
{
free((void*)jvm_extra_args);
jvm_extra_args = jvm_heap_size_args;
}
}
// Make sure command-line was created
command_line = build_commandline(pid, java_runtime_path, jarfile_path, jvm_extra_args, cmd_extra_args, cmd_line_args);
if (!command_line)
{
show_message(hwnd, MB_ICONERROR | MB_TOPMOST, APP_HEADING, L"The Java command-line could not be generated!");
@ -1555,7 +1770,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE _hPrevInstance, PWSTR pCmdLin
#endif
// Now actually start the process!
if (!CreateProcessW(NULL, (LPWSTR)command_line, NULL, NULL, FALSE, 0U, NULL, executable_directory, &startup_info, &process_info))
if (!CreateProcessW(NULL, (LPWSTR)command_line, NULL, NULL, FALSE, 0U, NULL, set_current_directory_enabled ? executable_directory : NULL, &startup_info, &process_info))
{
const wchar_t *const error_text = describe_system_error(GetLastError());
if (error_text)
@ -1606,17 +1821,16 @@ cleanup:
close_handle(&process_info.hProcess);
close_handle(&mutex_handle);
#if L5J_ENABLE_GUI
destroy_window(&hwnd);
delete_object(&splash_image);
#endif
free((void*)jvm_extra_args);
free((void*)cmd_extra_args);
free((void*)ext_args_encoded);
free((void*)cmd_args_encoded);
free((void*)command_line);
free((void*)java_runtime_path);
free((void*)jarfile_path);
free((void*)jarfile_short_path);
free((void*)jre_relative_path);
free((void*)executable_directory);
free((void*)executable_path);
@ -1625,3 +1839,49 @@ cleanup:
return result;
}
/* ======================================================================== */
/* Entry points */
/* ======================================================================== */
extern IMAGE_DOS_HEADER __ImageBase;
extern LPWSTR _wcmdln;
#define UNHANDELED_EXCEPTION_ERROR 666
static LONG WINAPI unhandeled_exception(EXCEPTION_POINTERS *ExceptionInfo)
{
static const wchar_t *const ERROR_MESSAGE = L"\nUnhandeled exception error encountered. Exiting!";
#if L5J_ENABLE_GUI
FatalAppExitW(0U, ERROR_MESSAGE);
#else
DWORD chars_written;
WriteConsoleW(GetStdHandle(STD_ERROR_HANDLE), ERROR_MESSAGE, lstrlenW(ERROR_MESSAGE), &chars_written, NULL);
#endif
TerminateProcess(GetCurrentProcess(), UNHANDELED_EXCEPTION_ERROR);
return EXCEPTION_EXECUTE_HANDLER;
}
#if L5J_ENABLE_GUI
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
#ifdef NDEBUG
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
SetUnhandledExceptionFilter(unhandeled_exception);
#endif
return launch5j_main(hInstance, get_commandline_args(_wcmdln));
}
#else /*L5J_ENABLE_GUI*/
int wmain(int argc, wchar_t **argv, wchar_t **envp)
{
#ifdef NDEBUG
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
SetUnhandledExceptionFilter(unhandeled_exception);
#endif
_setmode(_fileno(stderr), _O_U8TEXT);
return launch5j_main((HINSTANCE) &__ImageBase, get_commandline_args(_wcmdln));
}
#endif /*L5J_ENABLE_GUI*/

View File

@ -12,12 +12,17 @@
############################################################
MACHINE := $(patsubst %-w64-mingw32,[%],$(shell $(CXX) -dumpmachine))
BUILDNO := $(shell git rev-list --count HEAD 2>&- || echo 0)
VERSION_MAJOR := $(shell grep -Po '#define[[:space:]]+L5J_VERSION_MAJOR[[:space:]]+\K[[:digit:]]+' src/resource.h)
VERSION_MINOR := $(shell grep -Po '#define[[:space:]]+L5J_VERSION_MINOR[[:space:]]+\K[[:digit:]]+' src/resource.h)
VERSION_PATCH := $(shell grep -Po '#define[[:space:]]+L5J_VERSION_PATCH[[:space:]]+\K[[:digit:]]+' src/resource.h)
ifeq ($(MACHINE),[i686])
CPU_ARCH := x86
MARCH ?= i586
else ifeq ($(MACHINE),[x86_64])
CPU_ARCH := x64
CPU_ARCH := amd64
MARCH ?= x86-64
else
$(error Unknown target machine "$(MACHINE)" encountered!)
@ -34,8 +39,7 @@ else
SUFFIX = g.exe
endif
CFLAGS += -municode -mwindows -march=$(MARCH) -mtune=$(MTUNE)
LDFLAGS = -lcomctl32
CFLAGS += -municode -march=$(MARCH) -mtune=$(MTUNE)
# ==========================================================
# Targets
@ -44,21 +48,31 @@ LDFLAGS = -lcomctl32
.PHONY: default
default: all
.PHONY: init
init:
.PHONY: initialize
initialize:
mkdir -p bin
mkdir -p obj
mkdir -p tmp
.PHONY: manifests
manifests: initialize
@mkdir -p tmp/assets
sed -e 's/$${{version}}/$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH).$(BUILDNO)/g' -e 's/$${{processorArchitecture}}/$(CPU_ARCH)/g' res/assets/manifest-console.xml > tmp/assets/manifest-console.$(CPU_ARCH).xml
sed -e 's/$${{version}}/$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH).$(BUILDNO)/g' -e 's/$${{processorArchitecture}}/$(CPU_ARCH)/g' res/assets/manifest-windows.xml > tmp/assets/manifest-windows.$(CPU_ARCH).xml
.PHONY: resources
resources: init
windres -o obj/common.$(CPU_ARCH).o res/common.rc
windres -o obj/splash_screen.$(CPU_ARCH).o res/splash_screen.rc
windres -o obj/registry.$(CPU_ARCH).o res/registry.rc
resources: manifests
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/common.$(CPU_ARCH).o res/common.rc
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/manifest-console.$(CPU_ARCH).o res/manifest-console.rc
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/manifest-windows.$(CPU_ARCH).o res/manifest-windows.rc
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/registry.$(CPU_ARCH).o res/registry.rc
windres -DL5J_CPU_ARCH=$(CPU_ARCH) -DL5J_BUILDNO=$(BUILDNO) -o obj/splash_screen.$(CPU_ARCH).o res/splash_screen.rc
.PHONY: clean
clean: init
$(RM) bin/*.$(SUFFIX)
$(RM) obj/*.o
clean: initialize
find bin -type f -delete
find obj -type f -delete
find tmp -type f -delete
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Binaries

View File

@ -19,8 +19,10 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.regex.Pattern;
/*
@ -28,21 +30,34 @@ import java.util.regex.Pattern;
*/
public class Generator {
private final static String EMPTY = "";
private final static Pattern RTRIM = Pattern.compile("\\s+$");
private static final String EMPTY = "";
private static final Pattern RTRIM = Pattern.compile("\\s+$");
private static final MessageDigest SHA256;
static {
try {
SHA256 = MessageDigest.getInstance("SHA-256");
} catch (final NoSuchAlgorithmException e) {
throw new Error(e);
}
}
public static void main(String[] args) throws IOException {
final List<String> targets = new ArrayList<String>();
final PrintStream out = new PrintStream(System.out, true, StandardCharsets.UTF_8.name());
outputTemplate(out, "header");
for (int wrapped = 0; wrapped < 2; ++wrapped) {
for (int registry = 0; registry < 2; ++registry) {
for (int stayAlive = 1; stayAlive > -1; --stayAlive) {
for (int enableSplash = 1; enableSplash > -1; --enableSplash) {
for (int encArgs = 1; encArgs > -1; --encArgs) {
out.println(generateCommand(targets, wrapped, registry, stayAlive, enableSplash, encArgs));
final LinkedHashSet<String> targets = new LinkedHashSet<String>();
for (int enableGui = 1; enableGui > -1; --enableGui) {
for (int wrapped = 0; wrapped < 2; ++wrapped) {
for (int registry = 0; registry < 2; ++registry) {
for (int stayAlive = 1; stayAlive > -1; --stayAlive) {
for (int enableSplash = 1; enableSplash > -1; --enableSplash) {
if((enableSplash > 0) && (enableGui == 0)) {
continue;
}
for (int encArgs = 1; encArgs > -1; --encArgs) {
out.println(generateCommand(targets, enableGui, wrapped, registry, stayAlive, enableSplash, encArgs));
}
}
}
}
@ -90,42 +105,59 @@ public class Generator {
out.println();
}
private static String generateCommand(final List<String> targets, final int wrapped, final int registry, final int stayAlive, final int enableSplash, final int encArgs) {
final String nameSuffix = generateNameSuffix(wrapped, registry, stayAlive, enableSplash, encArgs);
final String targetName = "l5j" + nameSuffix;
targets.add(targetName);
private static String generateCommand(final Set<String> targets, final int enableGui, final int wrapped, final int registry, final int stayAlive, final int enableSplash, final int encArgs) {
final String nameSuffix = generateNameSuffix(enableGui, wrapped, registry, stayAlive, enableSplash, encArgs);
final String targetName = "launch5j_" + hash(nameSuffix);
if(!targets.add(targetName)) {
throw new Error("Hash collision detected!");
}
final String exeType = (enableGui > 0) ? "windows" : "console";
final StringBuilder cmdLine = new StringBuilder();
cmdLine.append(String.format(".PHONY: %s\n", targetName));
cmdLine.append(String.format("%s: resources\n", targetName));
cmdLine.append(String.format("\t$(CC) $(CFLAGS) " +
"-m%s " +
"-DL5J_BUILDNO=$(BUILDNO) " +
"-DL5J_ENABLE_GUI=%d " +
"-DL5J_JAR_FILE_WRAPPED=%d " +
"-DL5J_DETECT_REGISTRY=%d " +
"-DL5J_STAY_ALIVE=%d " +
"-DL5J_ENABLE_SPLASH=%d " +
"-DL5J_ENCODE_ARGS=%d " +
"-o bin/launch5j_$(CPU_ARCH)%s.exe " +
"src/head.c obj/common.$(CPU_ARCH).o",
"src/head.c " +
"obj/common.$(CPU_ARCH).o " +
"obj/manifest-%s.$(CPU_ARCH).o",
exeType,
enableGui,
wrapped,
registry,
stayAlive,
enableSplash,
encArgs,
nameSuffix));
nameSuffix,
exeType));
if (enableSplash > 0) {
cmdLine.append(" obj/splash_screen.$(CPU_ARCH).o");
}
if (registry > 0) {
cmdLine.append(" obj/registry.$(CPU_ARCH).o");
}
cmdLine.append(" $(LDFLAGS)\n");
if (enableGui > 0) {
cmdLine.append(" -lcomctl32");
}
cmdLine.append('\n');
cmdLine.append("ifeq ($(DEBUG),0)\n");
cmdLine.append(String.format("\tstrip bin/launch5j_$(CPU_ARCH)%s.exe\n", nameSuffix));
cmdLine.append("endif\n");
return cmdLine.toString();
}
private static String generateNameSuffix(final int wrapped, final int registry, final int stayAlive, final int enableSplash, final int encArgs) {
private static String generateNameSuffix(final int enableGui, final int wrapped, final int registry, final int stayAlive, final int enableSplash, final int encArgs) {
final StringBuilder builder = new StringBuilder();
if (enableGui == 0) {
append(builder, '_', "nogui");
}
if (wrapped > 0) {
append(builder, '_', "wrapped");
}
@ -135,7 +167,7 @@ public class Generator {
if (stayAlive == 0) {
append(builder, '_', "nowait");
}
if (enableSplash == 0) {
if ((enableGui > 0) && (enableSplash == 0)) {
append(builder, '_', "nosplash");
}
if (encArgs == 0) {
@ -151,4 +183,8 @@ public class Generator {
builder.append(string);
}
private static String hash(final String str) {
final byte[] hash = SHA256.digest(str.getBytes(StandardCharsets.UTF_8));
return String.format("%02X%02X", hash[30], hash[31]);
}
}

View File

@ -11,6 +11,19 @@
/* https://sourceforge.net/p/launch4j/ */
/************************************************************/
#ifndef L5J_RESOURCE_H
#define L5J_RESOURCE_H
// BUILD NO
#ifndef L5J_BUILDNO
#error L5J_BUILDNO is not defined!
#endif
// VERSION
#define L5J_VERSION_MAJOR 0
#define L5J_VERSION_MINOR 8
#define L5J_VERSION_PATCH 1
// ICON
#define ID_ICON_MAIN 1
@ -18,12 +31,17 @@
#define ID_BITMAP_SPLASH 1
// STRINGS
#define ID_STR_HEADING 1
#define ID_STR_JVMARGS 2
#define ID_STR_CMDARGS 3
#define ID_STR_JREPATH 4
#define ID_STR_MUTEXID 5
#define ID_STR_JAVAMIN 6
#define ID_STR_JAVAMAX 7
#define ID_STR_BITNESS 8
#define ID_STR_JAVAURL 9
#define ID_STR_HEADING 0x1
#define ID_STR_JVMARGS 0x2
#define ID_STR_CMDARGS 0x3
#define ID_STR_JREPATH 0x4
#define ID_STR_MUTEXID 0x5
#define ID_STR_HEAPMIN 0x6
#define ID_STR_HEAPMAX 0x7
#define ID_STR_NSETCWD 0x8
#define ID_STR_JAVAMIN 0x9
#define ID_STR_JAVAMAX 0xA
#define ID_STR_BITNESS 0xB
#define ID_STR_JAVAURL 0xC
#endif