如何为 maven 构建的 netbeans 平台应用程序生成安装程序?
How to generate instalator for netbeans platform application build by maven?
如何为maven 构建的netbeans 平台应用程序生成安装程序?在 maven netbeans 项目应用程序菜单项 "package as" 中丢失。
我正在使用命令 nbm:build-installers
执行 maven 目标,但遇到了异常。我是 Maven 的初学者,不知道如何修复它。我做错了什么?
异常堆栈跟踪
Failed to execute goal org.codehaus.mojo:nbm-maven-plugin:4.1:build-installers (default-cli) on project mavenproject0001-app: Installers creation failed: /home/x/NetBeansProjects/mavenproject0001/application/target/installer/nbi/stub/template.xml:145: Error starting Sun's native2ascii: sun.tools.native2ascii.Main -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:nbm-maven-plugin:4.1:build-installers (default-cli) on project mavenproject0001-app: Installers creation failed: /home/x/NetBeansProjects/mavenproject0001/application/target/installer/nbi/stub/template.xml:145: Error starting Sun's native2ascii:
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Installers creation failed: /home/x/NetBeansProjects/mavenproject0001/application/target/installer/nbi/stub/template.xml:145: Error starting Sun's native2ascii:
at org.codehaus.mojo.nbm.BuildInstallersMojo.execute(BuildInstallersMojo.java:305)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: /home/x/NetBeansProjects/mavenproject0001/application/target/installer/nbi/stub/template.xml:145: Error starting Sun's native2ascii:
at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.java:68)
at org.apache.tools.ant.taskdefs.optional.native2ascii.DefaultNative2Ascii.convert(DefaultNative2Ascii.java:55)
at org.apache.tools.ant.taskdefs.optional.Native2Ascii.convert(Native2Ascii.java:296)
at org.apache.tools.ant.taskdefs.optional.Native2Ascii.execute(Native2Ascii.java:252)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at jdk.internal.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.codehaus.mojo.nbm.BuildInstallersMojo.execute(BuildInstallersMojo.java:301)
... 22 more
Caused by: java.lang.ClassNotFoundException: sun.tools.native2ascii.Main
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:332)
at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.java:52)
... 36 more
听起来您使用的是 JRE 而不是 JDK。找不到 tools.jar 中的 native2ascii 工具。确保 tools.jar 在您的类路径中或使用 JDK。另见 https://grokbase.com/t/ant/user/149c9883t8/native2ascii-and-jdk-jre and http://wiki.netbeans.org/FaqRunningOnJre
如何为maven 构建的netbeans 平台应用程序生成安装程序?在 maven netbeans 项目应用程序菜单项 "package as" 中丢失。
我正在使用命令 nbm:build-installers
执行 maven 目标,但遇到了异常。我是 Maven 的初学者,不知道如何修复它。我做错了什么?
异常堆栈跟踪
Failed to execute goal org.codehaus.mojo:nbm-maven-plugin:4.1:build-installers (default-cli) on project mavenproject0001-app: Installers creation failed: /home/x/NetBeansProjects/mavenproject0001/application/target/installer/nbi/stub/template.xml:145: Error starting Sun's native2ascii: sun.tools.native2ascii.Main -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:nbm-maven-plugin:4.1:build-installers (default-cli) on project mavenproject0001-app: Installers creation failed: /home/x/NetBeansProjects/mavenproject0001/application/target/installer/nbi/stub/template.xml:145: Error starting Sun's native2ascii:
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Installers creation failed: /home/x/NetBeansProjects/mavenproject0001/application/target/installer/nbi/stub/template.xml:145: Error starting Sun's native2ascii:
at org.codehaus.mojo.nbm.BuildInstallersMojo.execute(BuildInstallersMojo.java:305)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: /home/x/NetBeansProjects/mavenproject0001/application/target/installer/nbi/stub/template.xml:145: Error starting Sun's native2ascii:
at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.java:68)
at org.apache.tools.ant.taskdefs.optional.native2ascii.DefaultNative2Ascii.convert(DefaultNative2Ascii.java:55)
at org.apache.tools.ant.taskdefs.optional.Native2Ascii.convert(Native2Ascii.java:296)
at org.apache.tools.ant.taskdefs.optional.Native2Ascii.execute(Native2Ascii.java:252)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at jdk.internal.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.codehaus.mojo.nbm.BuildInstallersMojo.execute(BuildInstallersMojo.java:301)
... 22 more
Caused by: java.lang.ClassNotFoundException: sun.tools.native2ascii.Main
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:332)
at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.java:52)
... 36 more
听起来您使用的是 JRE 而不是 JDK。找不到 tools.jar 中的 native2ascii 工具。确保 tools.jar 在您的类路径中或使用 JDK。另见 https://grokbase.com/t/ant/user/149c9883t8/native2ascii-and-jdk-jre and http://wiki.netbeans.org/FaqRunningOnJre