fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 133 forks source link

How to troubleshoot cannot execute: required file not found when running universalJavaApplicationStub #275

Closed EasyG0ing1 closed 1 year ago

EasyG0ing1 commented 1 year ago

I'm submitting a…

I need to know how to track down the error thrown by universalJavaApplicationStub, which says: cannot execute: required file not found

Please tell us about your environment:

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

This is an app that I use personally, which gets launched from another app by calling universalJavaApplicationStub via its full path designation. When I do this, it only gives me the response of cannot execute: required file not found and I cannot seem to locate the source of this error. I even searched universalJavaApplicationStub.sh for the error to no avail

Here are the relevant portions of my POM file if that helps at all, but I'm not looking for the answer specifically more than I'm wanting to learn how to track such errors down so that I can be a little more self reliant in these situations:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>19</maven.compiler.source>
    <maven.compiler.target>19</maven.compiler.target>
    <javafx.version>19</javafx.version>
    <packaging>jar</packaging>
    <exec.mainClass>com.simtechdata.mikesutilities.Launcher</exec.mainClass>
</properties>
<build>
    <plugin>
        <plugin>
            <groupId>io.github.fvarrui</groupId>
            <artifactId>javapackager</artifactId>
            <version>1.6.7</version>
            <configuration>
                <mainClass>${exec.mainClass}</mainClass>
                <generateInstaller>false</generateInstaller>
                <administratorRequired>false</administratorRequired>
                <copyDependencies>true</copyDependencies>
                <jdkPath>/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home</jdkPath>
                <packagingJdk>/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home</packagingJdk>
            </configuration>
            <executions>
                <execution>
                    <id>mac</id>
                    <phase>package</phase>
                    <goals>
                        <goal>package</goal>
                    </goals>
                    <configuration>
                        <platform>mac</platform>
                        <additionalModulePaths>
                            <additionalModulePath>/Library/Java/JavaVirtualMachines/JavaFX/19/javafx-jmods-19</additionalModulePath>
                        </additionalModulePaths>
                        <additionalResources>
                            <additionalResource>/Library/Java/JavaVirtualMachines/JavaFX/19/javafx-sdk-19/lib</additionalResource>
                        </additionalResources>
                        <vmArgs>
                            <vmArg>--enable-preview</vmArg>
                        </vmArgs>
                        <outputDirectory>/Users/michael/Java/BASH</outputDirectory>
                        <macConfig>
                            <generateDmg>false</generateDmg>
                            <generatePkg>false</generatePkg>
                            <volumeName>MikesUtilities</volumeName> <!-- Maybe not necessary -->
                            <entitlements>entitlements.plist</entitlements> <!-- Maybe not necessary -->
                        </macConfig>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
fvarrui commented 1 year ago

Hi @EasyG0ing1! There's a bug in 1.6.7 with EOL, since CRLF chars have to be replaced with LF chars on MacOS and Linux. I think this could be the problem. It's fixed in 1.7.0-SNAPSHOT, but I'm trying to finish several things before releasing it ... Maybe should I patch just this issue and release version 1.6.8? Try it and give some feedback, please.

EasyG0ing1 commented 1 year ago

@fvarrui So I did this

git clone https://github.com/fvarrui/JavaPackager.git --branch 1.7.0
cd JavaPackager
./gradlew publishToMavenLocal

And I got this:

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/michael/Java/Downloads/JavaPackager/settings.gradle'

* What went wrong:
Could not compile settings file '/Users/michael/Java/Downloads/JavaPackager/settings.gradle'.
> startup failed:
  General error during semantic analysis: Unsupported class file major version 63

  java.lang.IllegalArgumentException: Unsupported class file major version 63
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:196)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:177)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:163)
        at groovyjarjarasm.asm.ClassReader.<init>(ClassReader.java:284)
        at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:81)
        at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:251)
        at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:189)
        at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:169)
        at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:125)
        at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClassNullable(AsmReferenceResolver.java:57)
        at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveClass(AsmReferenceResolver.java:44)
        at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveNonArrayType(AsmReferenceResolver.java:79)
        at org.codehaus.groovy.ast.decompiled.AsmReferenceResolver.resolveType(AsmReferenceResolver.java:70)
        at org.codehaus.groovy.ast.decompiled.MemberSignatureParser.createMethodNode(MemberSignatureParser.java:57)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode$2.get(DecompiledClassNode.java:234)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode$2.get(DecompiledClassNode.java:231)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.createMethodNode(DecompiledClassNode.java:242)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.lazyInitMembers(DecompiledClassNode.java:199)
        at org.codehaus.groovy.ast.decompiled.DecompiledClassNode.getDeclaredMethods(DecompiledClassNode.java:122)
        at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:912)
        at org.codehaus.groovy.ast.ClassNode.tryFindPossibleMethod(ClassNode.java:1280)
        at org.codehaus.groovy.control.StaticImportVisitor.transformMethodCallExpression(StaticImportVisitor.java:252)
        at org.codehaus.groovy.control.StaticImportVisitor.transform(StaticImportVisitor.java:113)
        at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:142)
        at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:110)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:121)
        at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:53)
        at org.codehaus.groovy.control.StaticImportVisitor.visitConstructorOrMethod(StaticImportVisitor.java:89)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructor(ClassCodeVisitorSupport.java:128)
        at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1099)
        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)
        at org.codehaus.groovy.control.StaticImportVisitor.visitClass(StaticImportVisitor.java:83)
        at org.codehaus.groovy.control.CompilationUnit$14.call(CompilationUnit.java:708)
        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1084)
        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:640)
        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:618)
        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:595)
        at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:401)
        at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
        at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:341)
        at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:338)
        at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:336)
        at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:139)
        at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileToDir(DefaultScriptCompilationHandler.java:95)
        at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler$2.run(BuildOperationBackedScriptCompilationHandler.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
        at org.gradle.groovy.scripts.internal.BuildOperationBackedScriptCompilationHandler.compileToDir(BuildOperationBackedScriptCompilationHandler.java:51)
        at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(FileCacheBackedScriptClassCompiler.java:190)
        at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$CompileToCrossBuildCacheAction.execute(FileCacheBackedScriptClassCompiler.java:170)
        at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:211)
        at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler$ProgressReportingInitializer.execute(FileCacheBackedScriptClassCompiler.java:194)
        at org.gradle.cache.internal.DefaultPersistentDirectoryCache$Initializer.initialize(DefaultPersistentDirectoryCache.java:100)
        at org.gradle.cache.internal.FixedSharedModeCrossProcessCacheAccess$1.run(FixedSharedModeCrossProcessCacheAccess.java:86)
        at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:215)
        at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:205)
        at org.gradle.cache.internal.FixedSharedModeCrossProcessCacheAccess.open(FixedSharedModeCrossProcessCacheAccess.java:83)
        at org.gradle.cache.internal.DefaultCacheAccess.open(DefaultCacheAccess.java:139)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:89)
        at org.gradle.cache.internal.DefaultPersistentDirectoryStore.open(DefaultPersistentDirectoryStore.java:43)
        at org.gradle.cache.internal.DefaultCacheFactory.doOpen(DefaultCacheFactory.java:103)
        at org.gradle.cache.internal.DefaultCacheFactory.open(DefaultCacheFactory.java:68)
        at org.gradle.cache.internal.DefaultCacheRepository$PersistentCacheBuilder.open(DefaultCacheRepository.java:126)
        at org.gradle.groovy.scripts.internal.FileCacheBackedScriptClassCompiler.compile(FileCacheBackedScriptClassCompiler.java:116)
        at org.gradle.groovy.scripts.internal.CrossBuildInMemoryCachingScriptClassCache.getOrCompile(CrossBuildInMemoryCachingScriptClassCache.java:50)
        at org.gradle.groovy.scripts.internal.BuildScopeInMemoryCachingScriptClassCompiler.compile(BuildScopeInMemoryCachingScriptClassCompiler.java:50)
        at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:49)
        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:125)
        at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
        at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62)
        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:43)
        at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62)
        at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.applySettingsScript(ScriptEvaluatingSettingsProcessor.java:74)
        at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.process(ScriptEvaluatingSettingsProcessor.java:67)
        at org.gradle.initialization.SettingsEvaluatedCallbackFiringSettingsProcessor.process(SettingsEvaluatedCallbackFiringSettingsProcessor.java:34)
        at org.gradle.initialization.RootBuildCacheControllerSettingsProcessor.process(RootBuildCacheControllerSettingsProcessor.java:47)
        at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:50)
        at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:47)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
        at org.gradle.initialization.BuildOperationSettingsProcessor.process(BuildOperationSettingsProcessor.java:47)
        at org.gradle.initialization.DefaultSettingsLoader.findSettingsAndLoadIfAppropriate(DefaultSettingsLoader.java:127)
        at org.gradle.initialization.DefaultSettingsLoader.findAndLoadSettings(DefaultSettingsLoader.java:65)
        at org.gradle.initialization.SettingsAttachingSettingsLoader.findAndLoadSettings(SettingsAttachingSettingsLoader.java:35)
        at org.gradle.internal.composite.CommandLineIncludedBuildSettingsLoader.findAndLoadSettings(CommandLineIncludedBuildSettingsLoader.java:34)
        at org.gradle.internal.composite.ChildBuildRegisteringSettingsLoader.findAndLoadSettings(ChildBuildRegisteringSettingsLoader.java:53)
        at org.gradle.internal.composite.CompositeBuildSettingsLoader.findAndLoadSettings(CompositeBuildSettingsLoader.java:35)
        at org.gradle.initialization.DefaultSettingsPreparer.prepareSettings(DefaultSettingsPreparer.java:36)
        at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.doLoadBuild(BuildOperationFiringSettingsPreparer.java:62)
        at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.run(BuildOperationFiringSettingsPreparer.java:57)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
        at org.gradle.initialization.BuildOperationFiringSettingsPreparer.prepareSettings(BuildOperationFiringSettingsPreparer.java:45)
        at org.gradle.initialization.DefaultGradleLauncher.prepareSettings(DefaultGradleLauncher.java:218)
        at org.gradle.initialization.DefaultGradleLauncher.doClassicBuildStages(DefaultGradleLauncher.java:159)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:148)
        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:124)
        at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:72)
        at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:67)
        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:213)
        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:67)
        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:56)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:31)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:63)
        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
        at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:77)
        at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:49)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:44)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
        at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.lambda$execute$0(InProcessBuildActionExecuter.java:54)
        at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:86)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:53)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:29)
        at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.lambda$execute$0(BuildTreeScopeLifecycleBuildActionExecuter.java:33)
        at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:49)
        at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.execute(BuildTreeScopeLifecycleBuildActionExecuter.java:32)
        at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.execute(BuildTreeScopeLifecycleBuildActionExecuter.java:27)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:104)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:55)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:64)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:37)
        at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.lambda$execute$0(SessionScopeLifecycleBuildActionExecuter.java:54)
        at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:67)
        at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.execute(SessionScopeLifecycleBuildActionExecuter.java:50)
        at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.execute(SessionScopeLifecycleBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.base/java.lang.Thread.run(Thread.java:1589)

  1 error

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

What am I doing wrong?

fvarrui commented 1 year ago

Use devel branch and build it with Java 11, not higher

EasyG0ing1 commented 1 year ago

@fvarrui

Do I have to compile my project in Java 11 as well? I got the devel branch successfully compiled with Java 11, but then when I created the package and ran it, I got this:

~/Java/JavaPackager $/Users/michael/Java/BASH/MikesUtilities/MikesUtilities.app/Contents/MacOS/universalJavaApplicationStub Error: LinkageError occurred while loading main class com.simtechdata.mikesutilities.Launcher java.lang.UnsupportedClassVersionError: com/simtechdata/mikesutilities/Launcher has been compiled by a more recent version of the Java Runtime (class file version 63.0), this version of the Java Runtime only recognizes class file versions up to 55.0

fvarrui commented 1 year ago

Hi @EasyG0ing!

Do I have to compile my project in Java 11 as well?

No, you can use any JDK in your project. Just Java 11 for compiling JavaPackager

I got the devel branch successfully compiled with Java 11, but then when I created the package and ran it, I got this:

~/Java/JavaPackager $/Users/michael/Java/BASH/MikesUtilities/MikesUtilities.app/Contents/MacOS/universalJavaApplicationStub Error: LinkageError occurred while loading main class com.simtechdata.mikesutilities.Launcher java.lang.UnsupportedClassVersionError: com/simtechdata/mikesutilities/Launcher has been compiled by a more recent version of the Java Runtime (class file version 63.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Are you bundling a JRE? It seems that your app is compiled with a higher version than your default one

EasyG0ing1 commented 1 year ago

@fvarrui

Here is the whole <build> section of my POM file:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-toolchains-plugin</artifactId>
            <version>3.0.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>toolchain</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <toolchains>
                    <jdk>
                        <version>19</version>
                        <vendor>sun</vendor>
                    </jdk>
                </toolchains>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.10.0</version>
            <configuration>
                <source>19</source>
                <target>19</target>
                <compilerArgs>--enable-preview</compilerArgs>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.2.2</version>
            <configuration>
                <skipIfEmpty>true</skipIfEmpty>
                <archive>
                    <manifestEntries>
                        <Main-Class>${exec.mainClass}</Main-Class>
                        <Automatic-Module-Name>com.simtechdata.prusapostprocessing</Automatic-Module-Name>
                        <Program-Version>${project.version}</Program-Version>
                        <Implementation-Version>${project.version}</Implementation-Version>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
        <plugin>
            <groupId>io.github.fvarrui</groupId>
            <artifactId>javapackager</artifactId>
            <version>1.7.0-SNAPSHOT</version>
            <executions>
                <execution>
                    <id>mac</id>
                    <phase>package</phase>
                    <goals>
                        <goal>package</goal>
                    </goals>
                    <configuration>
                        <platform>auto</platform>
                        <createZipball>false</createZipball>
                        <createTarball>false</createTarball>
                        <vmArgs>
                            <vmArg>--enable-preview</vmArg>
                        </vmArgs>
                        <mainClass>${exec.mainClass}</mainClass>
                        <bundleJre>true</bundleJre>
                        <version>19</version>
                        <customizedJre>false</customizedJre>
                        <jdkPath>/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home</jdkPath>
                        <packagingJdk>/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home</packagingJdk>
                        <generateInstaller>false</generateInstaller>
                        <administratorRequired>false</administratorRequired>
                        <copyDependencies>true</copyDependencies>
                        <macConfig>
                            <generateDmg>false</generateDmg>
                            <generatePkg>false</generatePkg>
                            <volumeName>PrusaPostProcessing</volumeName>
                            <entitlements>entitlements.plist</entitlements>
                        </macConfig>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
fvarrui commented 1 year ago

Can you share your project, so I can try it, or is it private?

EasyG0ing1 commented 1 year ago

@fvarrui I just now uploaded it to a private repository but I added you as a collaborator so you should have access to it. I believe GitHub sends you an invite to whatever email address is attached to your GitHub account.

The program won't actually do anything other than show the GUI unless you pass it a path to a valid gcode file as a program argument.

If you cancel or close the window, it will throw an error because this is how it communicates with Prusa Slicer to let it know that the user chose not to process the final gcode.

The only way I was able to get it to work was by creating a bash shell script that declares the JAVA_HOME environment variable. When Prusa runs the program it creates a private bash session that it calls it from. But I couldn't get it to run even from my own shell that has the JAVA_HOME variable correctly stated, and I thought that was not ever supposed to be an issue when you bundle the JRE in with the app ... I thought everything was supposed to be self-contained with no need to have any installations of Java elsewhere on the machine...

But anyways, you should have that invite to the repository so you can mess around with the program.

EasyG0ing1 commented 1 year ago

@fvarrui So I'm not sure what I did, but the version of the code as posted right now works without the shell script. It would be nice though to figure out why because I have other programs that need to run on their own. I'll have to go through POM files and see what made the difference.

edit: ok that's not true when I call it from Prusa Slicer ... I still need the shell script to make it work.

This is the shell script that makes it work, so clearly the bundled JRE is not being considered when executing universalJavaApplicationStub directly when there is no JAVA_HOME environment variable set for that shell.

export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home"
/Users/michael/Java/PrusaPostProcessing/PrusaPostProcessing.app/Contents/MacOS/universalJavaApplicationStub $1
fvarrui commented 1 year ago

EasyFXControls library is missing

image

EasyG0ing1 commented 1 year ago

@fvarrui I published the latest version but I only published it last night so you might have tried to compile it before the push was rolled out to central. It should be fine now.

fvarrui commented 1 year ago

Hi @EasyG0ing1! Ok, I'll test it again this evening

fvarrui commented 1 year ago

@fvarrui I published the latest version but I only published it last night so you might have tried to compile it before the push was rolled out to central. It should be fine now.

No, same problem 🤷‍♂️ ... I wonder if you meant that EasyFXControls should be released to Maven Central.

image

EasyG0ing1 commented 1 year ago

@fvarrui - My apologies, I was thinking of a different library.

If you pull down the repository again, in the root folder is EasyFXControls.zip. Unzip it and you'll find the library jar file and both a bat file and a bash script (wasn't sure which OS you use) which you can execute and it will add the library to your local Maven repository assuming mvn is in your PATH.

fvarrui commented 1 year ago

Ok, I'll test it this evening, because I only have a MacMini at home 😢

fvarrui commented 1 year ago

App built and running without any change:

image

fvarrui commented 1 year ago

Oh! Just removed ...

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-toolchains-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>toolchain</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <toolchains>
                        <jdk>
                            <version>19</version>
                            <vendor>sun</vendor>
                        </jdk>
                    </toolchains>
                </configuration>
            </plugin>
fvarrui commented 1 year ago

Maybe you are compiling with a JDK version and generating JRE with jlink using another JDK version?

EasyG0ing1 commented 1 year ago

Maybe you are compiling with a JDK version and generating JRE with jlink using another JDK version?

How would I be able to find that out? The toolchain from what I understand, just makes sure that maven uses a specific version of Java?

And did you compile it just by running mvn clean package?

EasyG0ing1 commented 1 year ago

@fvarrui - ok so heres the thing ... when I run it without any java environment setup in the OS ... no JAVA_HOME or anything, it won't run. Like its not relying on it's own built-in runtime library.

fvarrui commented 1 year ago

And did you compile it just by running mvn clean package?

Yes!!

ok so heres the thing ... when I run it without any java environment setup in the OS ... no JAVA_HOME or anything, it won't run. Like its not relying on it's own built-in runtime library.

Have you tried running directly from the command line by running the universalJavaApplicationStub script? Also note that this script logs all its output to the system log, which you can view through the Console application.

EasyG0ing1 commented 1 year ago

@fvarrui

Have you tried running directly from the command line by running the universalJavaApplicationStub script? Also note that this script logs all its output to the system log, which you can view through the Console application.

It's funny you ask that, because that is usually the first method I use to test an app before running the .app. When I saw you use the open command it caught me off guard because its been so long since I've used it I kinda forgot about it. lol

But YES ... so when I tell Prusa Slicer to use that app, it sends the path to the code as an argument when it starts the program. So naturally, I gave it the full path to universalJavaApplicationStub since you can't pass arguments in a .app call ... (well maybe with the open method not sure).

And somehow, Prusa, when it calls the program, it creates an environment that is littered with environment variables as the means of providing my program information about the gcode. But it does NOT seem to take my default Bash profile because I know for a fact that the JAVA_HOME variable is not set in its little mystery shell ...

However, when I have it call a bash script with only two lines in it:

export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home"
/Users/michael/Java/FinalGCode/FinalGCode.app/Contents/MacOS/universalJavaApplicationStub $1

It works perfectly (yes, I renamed the app ... lol).

Also, I can run the app just like you did without any problems, but I have a JAVA_HOME environment variable defined.

And no, I did not know that the script logged info to the system log, I'm going to go look at that now.

Mike

EasyG0ing1 commented 1 year ago

@fvarrui When I install the app onto a MacOS virtual machine that is a clean install of MacOS with no Java RE or SDK installed at all ... when I try to run the universal from the terminal, this is what I get

michael@Michaels-Mac MacOS % ./universalJavaApplicationStub ~/Downloads/PropaneTankStandCura.gcode
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Print: Entry, ":0:JVMVersion", Does Not Exist
Print: Entry, ":0:JVMHomePath", Does Not Exist
291:348: execution error: System Events got an error: A resource wasn’t found. (-192)

And I cannot seem to figure out how to find any of the universalJavaApplicationStub logs from within Console. But the error given after trying to launch the program from the terminal seems obvious.

And if I use open the program works fine, but I need to be able to launch it from a straight path while passing in an argument, and using open is not an option for this specific case which is calling the app from within Prusa Slicer because if I use open it simply won't work so I have to be able to call the universal directly and pass in an argument.

EasyG0ing1 commented 1 year ago

@fvarrui Also, when I compile the package with debugging enabled, I get this message, which seems to be related to the problem I'm having:

[WARNING] The POM for io.github.fvarrui:launch4j:jar:2.5.2 is invalid, transitive dependencies (if any) will not be available: 2 problems were encountered while building the effective model for io.github.fvarrui:launch4j:2.5.2
[ERROR] 'dependencies.dependency.version' for org.spockframework:spock-core:jar is missing. @ 
[ERROR] 'dependencies.dependency.version' for org.spockframework:spock-junit4:jar is missing. @ 

Also, I pushed the project to a new repository which you can find here after accepting the invite that would have been sent to your email.

fvarrui commented 1 year ago

@fvarrui When I install the app onto a MacOS virtual machine that is a clean install of MacOS with no Java RE or SDK installed at all ... when I try to run the universal from the terminal, this is what I get

michael@Michaels-Mac MacOS % ./universalJavaApplicationStub ~/Downloads/PropaneTankStandCura.gcode
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Print: Entry, ":0:JVMVersion", Does Not Exist
Print: Entry, ":0:JVMHomePath", Does Not Exist
291:348: execution error: System Events got an error: A resource wasn’t found. (-192)

And I cannot seem to figure out how to find any of the universalJavaApplicationStub logs from within Console. But the error given after trying to launch the program from the terminal seems obvious.

And if I use open the program works fine, but I need to be able to launch it from a straight path while passing in an argument, and using open is not an option for this specific case which is calling the app from within Prusa Slicer because if I use open it simply won't work so I have to be able to call the universal directly and pass in an argument.

Ok, I undestand what you mean

fvarrui commented 1 year ago

@fvarrui Also, when I compile the package with debugging enabled, I get this message, which seems to be related to the problem I'm having:

[WARNING] The POM for io.github.fvarrui:launch4j:jar:2.5.2 is invalid, transitive dependencies (if any) will not be available: 2 problems were encountered while building the effective model for io.github.fvarrui:launch4j:2.5.2
[ERROR] 'dependencies.dependency.version' for org.spockframework:spock-core:jar is missing. @ 
[ERROR] 'dependencies.dependency.version' for org.spockframework:spock-junit4:jar is missing. @ 

I know about the first line, and don't worry about it as it's just a warning

Also, I pushed the project to a new repository which you can find here after accepting the invite that would have been sent to your email.

Ok, I'll try your main app asap and tell you something.

EasyG0ing1 commented 1 year ago

@fvarrui So this is interesting, When I create this bash script:

export JAVA_HOME="/Users/michael/Java/FinalGCode/FinalGCode/FinalGCode.app/Contents/Resources/javafx-sdk-19.0.2.1"
/Users/michael/Java/FinalGCode/FinalGCode/FinalGCode.app/Contents/MacOS/universalJavaApplicationStub $1

So that JAVA_HOME is set to the SDK that is compiled inside of the .app ... it works.

So for whatever reason, when calling the universal Java Application, it's not picking up the packaged SDK, but when its run from the open command, it does ...

fvarrui commented 1 year ago

@fvarrui So this is interesting, When I create this bash script:

export JAVA_HOME="/Users/michael/Java/FinalGCode/FinalGCode/FinalGCode.app/Contents/Resources/javafx-sdk-19.0.2.1"
/Users/michael/Java/FinalGCode/FinalGCode/FinalGCode.app/Contents/MacOS/universalJavaApplicationStub $1

So that JAVA_HOME is set to the SDK that is compiled inside of the .app ... it works.

So for whatever reason, when calling the universal Java Application, it's not picking up the packaged SDK, but when its run from the open command, it does ...

Why don't you run you app using open command instead of calling universalJavaApplicationStub directly?

EasyG0ing1 commented 1 year ago

@fvarrui Because in this specific use case, having Prusa slicer call the program through the open command causes the program to spin off in its own thread so Prusa Slicer can't get the exit code from the program.

fvarrui commented 1 year ago

@EasyG0ing1 Yes, you are right. It's bit weird because javaApplicationStub should get Java runtime path from Info.plist, and is getting another path

EasyG0ing1 commented 1 year ago

@fvarrui

1) Is there a way to correct that somehow? Even if done post-compile manually? 2) I saw some talk flying through the issues here about you getting module support added to the library. How is that coming along? Or are there any snapshots yet with module support?

fvarrui commented 1 year ago

@fvarrui

  1. Is there a way to correct that somehow? Even if done post-compile manually?
  2. I saw some talk flying through the issues here about you getting module support added to the library. How is that coming along? Or are there any snapshots yet with module support?

Hi @EasyG0ing1! Sorry for my so late reply, I missed your comment. No support for JPMS yet. Did you manage to fix this issue?

EasyG0ing1 commented 1 year ago

@fvarrui Yes, thank you.