diff --git a/JavaLaunch2.sln b/JavaLaunch.sln similarity index 100% rename from JavaLaunch2.sln rename to JavaLaunch.sln 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.) 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, 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