launch4j-maven-plugin icon indicating copy to clipboard operation
launch4j-maven-plugin copied to clipboard

How to provide main argument

Open aruffie opened this issue 2 years ago • 1 comments

Dear,

I have a jar which can be launch like this following command:

java -jar server.jar -conf c:\conf\default.json

And I try to make an executable with this following maven plugin:

<plugin>
						<groupId>com.akathist.maven.plugins.launch4j</groupId>
						<artifactId>launch4j-maven-plugin</artifactId>
						<version>2.4.1</version>
						<executions>
							<execution>
								<id>l4j-clui</id>
								<phase>install</phase>
								<goals><goal>launch4j</goal></goals>
								<configuration>
									<headerType>console</headerType>
									<outfile>target/server-${project.version}.exe</outfile>
									<jar>target/${project.artifactId}-${server.version}-fat.jar</jar>
									<errTitle>server-${project.version}</errTitle>
									<classPath>
										<mainClass>com.server.core.CsLauncher</mainClass>
									</classPath>
									<cmdLine>-conf conf/dev.json</cmdLine>
									<jre>
										<path>${java.home</path>
										<bundledJre64Bit>false</bundledJre64Bit>
										<bundledJreAsFallback>false</bundledJreAsFallback>
										<minVersion>1.8.0</minVersion>
										<jdkPreference>preferJre</jdkPreference>
										<runtimeBits>32</runtimeBits>
									</jre>
									<versionInfo>
										<fileVersion>${project.version}.0</fileVersion>
										<txtFileVersion>Crimson Server ${project.version}</txtFileVersion>
										<fileDescription>The Crimson Server executable</fileDescription>
										<productVersion>${project.version}.0</productVersion>
										<txtProductVersion>The Crimson Server executable</txtProductVersion>
										<productName>Server</productName>
										<internalName>server</internalName>
										<originalFilename>server-${project.version}.exe</originalFilename>
									</versionInfo>
								</configuration>
							</execution>
						</executions>
					</plugin>

Can you help me for provide the -conf and the value to the main class but byt providing it to the exe command ? Because I don't need a static value, when I launch for example: I need to make --> server.exe -conf conf\default.json

and that realise a argument providing like that: java -jar server.jar -conf c:\conf\default.json

because I want the conf value path can change

Thank for helping Adrien

aruffie avatar Aug 03 '23 13:08 aruffie

The only option you have is to use Additional JVM options at runtime

lukaszlenart avatar Aug 07 '23 19:08 lukaszlenart