我无法通过 Eclipse 创建 Windows 软件。使用“运行”确实会按应有的方式运行应用程序,但我想在没有 Eclipse 的情况下启动它,最好作为独立的 Windows 应用程序,只需双击即可。 虽然this建议了几种方法,它们都需要我不具备的额外知识。
我尝试过使用 Launch4J,但它还需要额外的知识。我很惊讶创建一个简单的 Windows-Java-应用程序是如此困难。
编辑 我正在使用这个 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0.0</version>
<name>baz</name>
<description></description>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.8.3</version>
<configuration>
<mainClass>application.Main</mainClass>
<updateExistingJar>true</updateExistingJar>
<skipCopyingDependencies>true</skipCopyingDependencies>
<useLibFolderContentForManifestClasspath>true</useLibFolderContentForManifestClasspath>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>build-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
但是 Eclipse 给出了以下错误消息:
Failed to execute goal com.zenjava:javafx-maven-plugin:8.8.3:build-jar
目标是
clean compile package -e
Maven 已安装,尝试以最少的附件运行它。
最佳答案
Launch4j我知道它可以在Java上制作一个exe Wrapper,而且它是跨平台的。
关于java - 通过 Eclipse 从 Java(FX) 创建 Windows EXE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54153564/