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

Don't specify jar or classpath #322

Open
io7m opened this issue Nov 9, 2023 · 5 comments
Open

Don't specify jar or classpath #322

io7m opened this issue Nov 9, 2023 · 5 comments

Comments

@io7m
Copy link

io7m commented Nov 9, 2023

Hello!

I'm trying to package up a modular (in the Java 9 modules sense) command-line application. The application is run like this:

java -p lib -m com.io7m.northpike.agent.main/com.io7m.northpike.agent.main.NPAgentMain

That is, the lib directory is set as the application's module path (not class path), and the -m option specifies the main class within a module. The lib directory contains all of the jar files that make up the application, and those go onto the module path (and the class path is entirely empty).

Unfortunately, if I put together a configuration like this:

          <plugin>
            <groupId>com.akathist.maven.plugins.launch4j</groupId>
            <artifactId>launch4j-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>launcher-windows-x86_64</id>
                <goals>
                  <goal>launch4j</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <headerType>console</headerType>
                  <outfile>${project.build.directory}/northpike-agent.exe</outfile>
                  <jre>
                    <path>jre</path>
                  </jre>
                  <dontWrapJar>true</dontWrapJar>
                  <cmdLine>
                    -p lib -m com.io7m.northpike.agent.main/com.io7m.northpike.agent.main.NPAgentMain
                  </cmdLine>
                </configuration>
              </execution>
            </executions>
          </plugin>

I get the error:

net.sf.launch4j.BuilderException: Specify runtime path of the jar relative to the executable.

It obviously expects me to be using a single executable jar, which I'm not. Is there some way I can trick launch4j into doing the right thing?

@lukaszlenart
Copy link
Collaborator

To be honest I don't know how to help you. I could ask directly on the Launch4j page

@io7m
Copy link
Author

io7m commented Nov 11, 2023

Thanks, but I suspect it's just not possible. Looking through the launch4j sources, it seems like it either expects an executable jar, or the classpath. The code seems to require picking one of those two.

@lukaszlenart
Copy link
Collaborator

Yet it's still worth mentioning such requirement, maybe it will be addressed in the future

@io7m
Copy link
Author

io7m commented Nov 13, 2023

Entirely up to you if you want to ask. I can't stop you 😄

@Lilianne-Blaze
Copy link
Contributor

Could you write and link a minimum hello world app with the same structure as you need? I'd like to check something

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

3 participants