英文:
JavaFX Maven failed to execute goal
问题
这是我的pom.xml文件:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.Jan.Raspberry.Shell</groupId>
<artifactId>RaspberryShell</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>14</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.1</version>
<configuration>
<executable>C:\Program Files\Java\jdk-11.0.6\bin\java</executable>
<mainClass>de.Jan.Raspberry.Shell.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
这是完整的错误信息:
[INFO]
[INFO] ---------------< de.Jan.Raspberry.Shell:RaspberryShell >---------------
[INFO] Building RaspberryShell 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- javafx-maven-plugin:0.0.1:run (default-cli) @ RaspberryShell ---
[WARNING] Required filename-based automodules detected. Please don't publish this project to a public artifact repository!
[ERROR] Command execution failed.
java.io.IOException: Cannot run program "C:\Program Files\Java\jdk-11.0.6\bin\java" (in directory "C:\Users\jan\Desktop\Programmieren\Java\Other\RaspberryShell\RaspberryShell\RaspberryShell"): CreateProcess error=5, Access is denied
...
如果你遇到了问题,请检查可执行文件路径和文件权限。
英文:
I recentely created my JavaFX Maven Project with IntelliJ and JDK-11. But If I run mvn javafx:run I get this error:
> Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.1:run
> (default-cli) on project RaspberryShell: Error
I really searched the whole internet and found nothing. Any ideas?
This is my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.Jan.Raspberry.Shell</groupId>
<artifactId>RaspberryShell</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>14</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.1</version>
<configuration>
<executable>C:\Program Files\Java\jdk-11.0.6</executable>
<mainClass>de.Jan.Raspberry.Shell.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Edit:
This is the full error:
[INFO]
[INFO] ---------------< de.Jan.Raspberry.Shell:RaspberryShell >----------------
[INFO] Building RaspberryShell 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- javafx-maven-plugin:0.0.1:run (default-cli) @ RaspberryShell ---
[WARNING] Required filename-based automodules detected. Please don't publish this project to a public artifact repository!
[ERROR] Command execution failed.
java.io.IOException: Cannot run program "C:\Program Files\Java\jdk-11.0.6" (in directory "C:\Users\jan\Desktop\Programmieren\Java\Other\RaspberryShell\RaspberryShell\RaspberryShell"): CreateProcess error=5, Access is denied
at java.lang.ProcessBuilder.start (ProcessBuilder.java:1128)
at java.lang.ProcessBuilder.start (ProcessBuilder.java:1071)
at java.lang.Runtime.exec (Runtime.java:589)
at org.apache.commons.exec.launcher.Java13CommandLauncher.exec (Java13CommandLauncher.java:61)
at org.apache.commons.exec.DefaultExecutor.launch (DefaultExecutor.java:279)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:336)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.openjfx.JavaFXRunMojo.executeCommandLine (JavaFXRunMojo.java:525)
at org.openjfx.JavaFXRunMojo.executeCommandLine (JavaFXRunMojo.java:487)
at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:168)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: java.io.IOException: CreateProcess error=5, Access is denied
at java.lang.ProcessImpl.create (Native Method)
at java.lang.ProcessImpl.<init> (ProcessImpl.java:478)
at java.lang.ProcessImpl.start (ProcessImpl.java:154)
at java.lang.ProcessBuilder.start (ProcessBuilder.java:1107)
at java.lang.ProcessBuilder.start (ProcessBuilder.java:1071)
at java.lang.Runtime.exec (Runtime.java:589)
at org.apache.commons.exec.launcher.Java13CommandLauncher.exec (Java13CommandLauncher.java:61)
at org.apache.commons.exec.DefaultExecutor.launch (DefaultExecutor.java:279)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:336)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.openjfx.JavaFXRunMojo.executeCommandLine (JavaFXRunMojo.java:525)
at org.openjfx.JavaFXRunMojo.executeCommandLine (JavaFXRunMojo.java:487)
at org.openjfx.JavaFXRunMojo.execute (JavaFXRunMojo.java:168)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
答案1
得分: 2
让我们一起查看你的日志。你被告知:
java.io.IOException:无法运行程序“C:\Program Files\Java\jdk-11.0.6”(在目录“C:\Users\jan\Desktop\Programmieren\Java\Other\RaspberryShell\RaspberryShell\RaspberryShell”中):CreateProcess错误=5,拒绝访问
随后引发:
Caused by:java.io.IOException:CreateProcess错误=5,拒绝访问
error=5
通常意味着你要么:
- 对可执行文件的路径有误;(顺便问一下,"C:\Program Files\Java\jdk-11.0.6" 是可执行文件的路径吗?我认为不是)
- 没有权限读取(运行)该文件。
你必须确保可执行文件的路径正确,并且你对它具有适当(必要的)访问权限。
英文:
Let's check your log together. You're told, that:
java.io.IOException: Cannot run program "C:\Program Files\Java\jdk-11.0.6" (in directory "C:\Users\jan\Desktop\Programmieren\Java\Other\RaspberryShell\RaspberryShell\RaspberryShell"): CreateProcess error=5, Access is denied
which then causes:
Caused by: java.io.IOException: CreateProcess error=5, Access is denied
error=5
usually means, that you either:
- have a wrong path to the executable file; (by the way, is "C:\Program Files\Java\jdk-11.0.6" path to the executable? I don't think so)
- have no permission to read(run) that file.
You have to make sure your path to the executable file is correct, and that you have an appropriate (required) access to it.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论