JavaPackager icon indicating copy to clipboard operation
JavaPackager copied to clipboard

Ubuntu run failure without wrapjar set to false

Open akhilmanikandan opened this issue 2 years ago • 6 comments

I'm submitting a…

  • [x] bug report

Short description of the issue/suggestion:

DEB package for ubuntu not working when <wrapJar>true</wrapJar>

Steps to reproduce the issue/enhancement:

  1. Create DEB package for ubuntu without Wrapjar or wrapjar set to true
  2. Install the package in ubuntu 3.running the executable yields following error

Error: An unexpected error occurred while trying to open file ##########

What is the expected behavior?

The deb file works with wrapjar set to true

What is the current behavior?

The package is not working with wrapped jar in executable

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?

<plugin>
                <groupId>io.github.fvarrui</groupId>
                <artifactId>javapackager</artifactId>
                <version>1.7.5</version>
                <executions>
                    <execution>
                        <id>bundling-for-linux</id>
                        <phase>package</phase>
                        <goals>
                            <goal>package</goal>
                        </goals>
                        <configuration>
                            <mainClass>com.test.Main</mainClass>
                            <bundleJre>true</bundleJre>
                            <jrePath>./jre</jrePath>
                            <runnableJar>${project.build.directory}/${project.artifactId}-${project.version}-jar-with-dependencies.jar</runnableJar>

                            <linuxConfig>
                              **<wrapJar>false</wrapJar>**
                                <generateRpm>false</generateRpm>
                            </linuxConfig>
                            <platform>linux</platform>
                            <createTarball>true</createTarball>
                        </configuration>
                    </execution>
            </plugin>

What is the motivation / use case for changing the behavior?

want to package the jar inside the executable to hide the jar file from the user

Please tell us about your environment:

  • JavaPackager version: 1.7.5
  • OS version: ubuntu 22.04 jammy
  • JDK version: openjdk-11
  • Build tool:
    • [x] Maven

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

akhilmanikandan avatar Dec 04 '23 23:12 akhilmanikandan

Hi @akhilmanikandan!

I've been doing some tests with DEB package generation, trying with linuxConfig.wrapJar=true and false, and in both cases it worked like a charm.

So, do you mean that it fails when setting linuxConfig.wrapJar=true and only when is installed from DEB package? Have you tried to run your app directly from the generated app folder in target.

fvarrui avatar Dec 13 '23 12:12 fvarrui

The only thing I've not tried yet is using a customized fat jar. Maybe this could be the problem.

fvarrui avatar Dec 13 '23 12:12 fvarrui

I've just tested it using a fat jar without problems. If you are bundling all your dependencies in a fat jar, you should set copyDependencies=false.

fvarrui avatar Dec 13 '23 13:12 fvarrui

the problem seems to be size, if the fat jar is small it works, looks like exisiting issues with big jars in launch4j

https://sourceforge.net/p/launch4j/bugs/169/

akhilmanikandan avatar Dec 13 '23 22:12 akhilmanikandan

But your problem wasn't in Ubuntu?

Anyway, JP supports other kind of EXE files for Windows

fvarrui avatar Dec 13 '23 22:12 fvarrui

issue is across ubuntu and windows , its the same issue, something to do with packaging, it works if i create a small fat jar and class not found when i create a fat jar above 120mb

akhilmanikandan avatar Dec 13 '23 23:12 akhilmanikandan