From 71fc0ddc3e0a65166c3a36c1c7eadc13947dab0e Mon Sep 17 00:00:00 2001 From: Michael Binz Date: Wed, 11 Mar 2020 21:22:45 +0100 Subject: [PATCH 1/4] Extended to handle dot-notation. Ensure that the target executable gets an .exe extension. --- jlgen/jlgen.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/jlgen/jlgen.cpp b/jlgen/jlgen.cpp index 219a8ab..3af8d89 100644 --- a/jlgen/jlgen.cpp +++ b/jlgen/jlgen.cpp @@ -112,26 +112,45 @@ namespace jlgen return EXIT_SUCCESS; } + /** + * Default extension of the generated executable. + */ + const auto exe_k = ".exe"; + /* * MakeLauncher C:\cygwin64\tmp\MMT.exe ..\mmt-icon-1024.png mmt.app de/michab/app/mmt/Mmt */ int MakeLauncher( - const path& targetFile, + path targetFile, const path& iconFile, const string& moduleName, const string& startClass ) { + // Ensure we have an .exe extension. + if (targetFile.extension() != exe_k) + targetFile.replace_extension(exe_k); + cerr << "Creating launcher: " << targetFile << endl; WriteLauncher(targetFile); ResourceMgr target{ targetFile }; mob::windows::RtString strings; - cerr << "Adding main class name: " << startClass << endl; + + // Covert dot-notation to invocation API conventions. + string actualStartClass{ startClass }; + std::replace( + actualStartClass.begin(), + actualStartClass.end(), + '.', + '/'); + + cerr << "Adding main class name: " << actualStartClass << endl; strings.Add( - IDS_JAVA_MAIN_CLASS, - startClass); + IDS_JAVA_MAIN_CLASS, + actualStartClass); + cerr << "Adding main module name: " << moduleName << endl; strings.Add( IDS_JAVA_MAIN_MODULE, From 0c6554f092b99aba4c8be1f138e78fbb88449699 Mon Sep 17 00:00:00 2001 From: Michael Binz Date: Wed, 11 Mar 2020 21:28:06 +0100 Subject: [PATCH 2/4] Adapted to auto .exe extension and dot-notation of class name. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cb7d43b..00d4654 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,14 @@ Get the latest version of the jlgen executable from the project's [release page] `jlgen.exe` is a command line application that supports different commands. The command *`MakeLauncher`* represents the central functionality of the software. It generates a native Windows launcher for a JLink-generated Java application image. The required parameters are: -* The name of the target file, e.g. 'Farboo.exe'. +* The name of the target file, e.g. 'Farboo.exe'. If the .exe extension is not specified then it is added. * The name of an icon file that is used to generate the required icon resources in the executable, e.g. 'farboo.png'. Note that a *.png* file is required, no hassle with generating an .ico file. It is recommended to offer a square, high resolution image, though all sizes and resolutions will do. This image gets scaled and resized for the resolutions 16, 32, 64, 128, 256 pixels. * The name of the target module. That is, the name of the module that holds the main Java application. For example `app.mmt`. -* Finally, the name of the Java class representing the entry point to the application. This class has to offer the Java-application's `public static void main( String[] argv )` operation. An example is `de/michab/app/mmt/Mmt`, note that you have to use `/` in this name instead of the `.`s used for example in `package` references. +* Finally, the name of the Java class representing the entry point to the application. This class has to offer the Java-application's `public static void main( String[] argv )` operation. An example is `de.michab.app.mmt.Mmt`. A complete sample call may look like - `jlgen MakeLauncher C:\cygwin64\tmp\Farboo.exe ..\mmt-icon-1024.png app.mmt de/michab/app/mmt/Mmt`. + `jlgen MakeLauncher C:\cygwin64\tmp\Farboo.exe ..\mmt-icon-1024.png app.mmt de.michab.app.mmt.Mmt`. ## I have the launcher executable, what now? Note that the generated launcher--in our example 'Farboo.exe'--has to be placed in the existing jlink image directory hierarchy at the same position where the file `jvm.dll` is located. This is currently `{jlink-app-root}/bin/server` but this may change in coming versions of the Jdk. (It is a deliberate decision not to look-up the jvm.dll dynamically to prevent to start the target application using a wrong Jdk/Jre that non-deterministically happened to be found.) From bffef0dbd263b5c3dafe663f2630e3f0eaa3ff16 Mon Sep 17 00:00:00 2001 From: Michael Binz Date: Sat, 14 Mar 2020 08:06:19 +0100 Subject: [PATCH 3/4] Issue 6: sln rename. --- JavaLaunch2.sln => JavaLaunch.sln | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename JavaLaunch2.sln => JavaLaunch.sln (100%) diff --git a/JavaLaunch2.sln b/JavaLaunch.sln similarity index 100% rename from JavaLaunch2.sln rename to JavaLaunch.sln From 086ef503608f9361a1d920fc755f2b946ce6a222 Mon Sep 17 00:00:00 2001 From: Michael Binz Date: Sat, 14 Mar 2020 08:23:40 +0100 Subject: [PATCH 4/4] Tests moved. --- felix.png => test/felix.png | Bin mmt-icon-1024.png => test/mmt-icon-1024.png | Bin sample-mmt.cmd => test/sample-mmt.cmd | 0 sample-sec.cmd => test/sample-sec.cmd | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename felix.png => test/felix.png (100%) rename mmt-icon-1024.png => test/mmt-icon-1024.png (100%) rename sample-mmt.cmd => test/sample-mmt.cmd (100%) rename sample-sec.cmd => test/sample-sec.cmd (100%) diff --git a/felix.png b/test/felix.png similarity index 100% rename from felix.png rename to test/felix.png diff --git a/mmt-icon-1024.png b/test/mmt-icon-1024.png similarity index 100% rename from mmt-icon-1024.png rename to test/mmt-icon-1024.png diff --git a/sample-mmt.cmd b/test/sample-mmt.cmd similarity index 100% rename from sample-mmt.cmd rename to test/sample-mmt.cmd diff --git a/sample-sec.cmd b/test/sample-sec.cmd similarity index 100% rename from sample-sec.cmd rename to test/sample-sec.cmd