gpt4 book ai didi

java - OptaPlanner 7.21.0 无法从 jar 文件执行 - 目录 dataDir 错误

转载 作者:行者123 更新时间:2023-12-02 09:42:44 34 4
gpt4 key购买 nike

我正在尝试创建可执行 jar,因为我已经完成了我的应用程序并希望将其导出到其他计算机。然而我收到了错误提示。有什么建议吗?

我已经根据 POM 尝试了带有依赖项和阴影的 Jar

<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>org.optaplanner.examples.nurserostering</groupId>
<artifactId>NurseRostering</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Staff Rostering</name>
<dependencies>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<!-- https://mvnrepository.com/artifact/org.eclipse.platform/org.eclipse.swt -->
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-core</artifactId>
<version>7.21.0.Final</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
<artifactId>mchange-commons-java</artifactId>
<version>0.2.11</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency> <!-- Internal dependencies -->
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-persistence-common</artifactId>
<version>7.21.0.Final</version>
</dependency>
<dependency><!-- Most examples use the XStream integration -->
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-persistence-xstream</artifactId>
<version>7.21.0.Final</version>
</dependency>
<dependency><!-- TODO add examples that use the JAXB integration -->
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-persistence-jaxb</artifactId>
<version>7.21.0.Final</version>
</dependency>
<dependency><!-- TODO add examples that use the jackson integration -->
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-persistence-jackson</artifactId>
<version>7.21.0.Final</version>
</dependency>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-benchmark</artifactId>
<version>7.21.0.Final</version>
</dependency>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-test</artifactId>
<scope>test</scope>
<version>7.21.0.Final</version>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
<version>7.21.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<scope>runtime</scope>
<version>7.21.0.Final</version>
</dependency>
<!-- External dependencies -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.19</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.23</version>
</dependency>
<!-- Common utils -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>runtime</scope>
<version>1.1.3</version>
</dependency>


<!-- Examples only dependencies. -->
<!-- WARNING: every examples only dependency must be properly dealt with
in optaplanner-distribution/src/main/assembly/assembly-optaplanner.xml -->
<!-- Converters -->
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>

</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.4.0-b180830.0438</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.24</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-javafx</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>13-ea+9</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>13-ea+9</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>13-ea+9</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-fontawesome-pack</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-core</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.3.Final</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>13-ea+9</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-octicons-pack</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-fontelico-pack</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-ionicons-pack</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-ionicons4-pack</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-entypo-pack</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-themify-pack</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-materialdesign-pack</artifactId>
<version>11.3.4</version>
</dependency>
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-foundation-pack</artifactId>
<version>11.3.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.optaplanner.examples.nurserostering.app.NurseRosteringApp</mainClass>

<!-- -Dlog4j.configurationFile=../properties/idStrikeSolver-log4j.properties
-Duser.timezone="UTC" -->
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/kie.conf</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

异常(exception):

Exception in thread "main" java.lang.IllegalStateException: The directory dataDir (/home/rodney/Desktop/data/nurserostering) does not exist.
Either the working directory should be set to the directory that contains the data directory (which is not the data directory itself), or the system property org.optaplanner.examples.dataDir should be set properly.
The data directory is different in a git clone (optaplanner/optaplanner-examples/data) and in a release zip (examples/sources/data).
In an IDE (IntelliJ, Eclipse, NetBeans), open the "Run configuration" to change "Working directory" (or add the system property in "VM options").
at org.optaplanner.examples.common.app.CommonApp.determineDataDir(CommonApp.java:52)
at org.optaplanner.examples.common.app.CommonApp.createSolutionBusiness(CommonApp.java:127)
at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:117)
at org.optaplanner.examples.common.app.CommonApp.init(CommonApp.java:113)
at org.optaplanner.examples.nurserostering.app.NurseRosteringApp.main(NurseRosteringApp.java:41)

最佳答案

让我通过复制粘贴问题来回答这个问题:)

... The directory dataDir (/home/rodney/Desktop/data/nurserostering) does not exist. Either the working directory should be set to the directory that contains the data directory (which is not the data directory itself) or ... The data directory is different in a git clone (optaplanner/optaplanner-examples/data) and in a release zip (examples/sources/data). In an IDE (IntelliJ, Eclipse, NetBeans), open the "Run configuration" to change "Working directory" ...

关于java - OptaPlanner 7.21.0 无法从 jar 文件执行 - 目录 dataDir 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56929821/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com