Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to provide main argument #301

Open
aruffie opened this issue Aug 3, 2023 · 1 comment
Open

How to provide main argument #301

aruffie opened this issue Aug 3, 2023 · 1 comment

Comments

@aruffie
Copy link

aruffie commented Aug 3, 2023

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

@lukaszlenart
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants