SVcodeでjarを作成して、コマンドプロンプトで開こうとしたら
エラー: メイン・クラスhenkan.Appを初期化できません
原因: java.lang.NoClassDefFoundError: org/apache/poi/EncryptedDocumentException
と出てきて、詳しく調べたところXSSFWorkbookでのところでひっかかってるみたいで、恐らくpom.xmlでの設定が問題だと思うのですが解決方法が見つからないです
pom.xml
1<?xml version="1.0" encoding="UTF-8"?> 2 3<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 4 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 5 <modelVersion>4.0.0</modelVersion> 6 7 <groupId>henkan</groupId> 8 <artifactId>te</artifactId> 9 <version>1.0-SNAPSHOT</version> 10 11 <name>te</name> 12 <!-- FIXME change it to the project's website --> 13 <url>http://www.example.com</url> 14 15 <properties> 16 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 17 <maven.compiler.source>15</maven.compiler.source> 18 <maven.compiler.target>15</maven.compiler.target> 19 </properties> 20 21 <dependencies> 22 <dependency> 23 <groupId>junit</groupId> 24 <artifactId>junit</artifactId> 25 <version>4.11</version> 26 <scope>test</scope> 27 </dependency> 28 <dependency> 29 <groupId>org.apache.poi</groupId> 30 <artifactId>poi</artifactId> 31 <version>4.1.2</version> 32 </dependency> 33 <dependency> 34 <groupId>org.apache.poi</groupId> 35 <artifactId>poi-ooxml</artifactId> 36 <version>4.1.2</version> 37 </dependency> 38 </dependencies> 39 40 <build> 41 <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> 42 <plugins> 43 <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> 44 <plugin> 45 <artifactId>maven-clean-plugin</artifactId> 46 <version>3.1.0</version> 47 </plugin> 48 <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> 49 <plugin> 50 <artifactId>maven-resources-plugin</artifactId> 51 <version>3.0.2</version> 52 </plugin> 53 <plugin> 54 <artifactId>maven-compiler-plugin</artifactId> 55 <version>3.8.0</version> 56 </plugin> 57 <plugin> 58 <artifactId>maven-surefire-plugin</artifactId> 59 <version>2.22.1</version> 60 </plugin> 61 <plugin> 62 <artifactId>maven-jar-plugin</artifactId> 63 <version>3.0.2</version> 64 </plugin> 65 <plugin> 66 <artifactId>maven-install-plugin</artifactId> 67 <version>2.5.2</version> 68 </plugin> 69 <plugin> 70 <artifactId>maven-deploy-plugin</artifactId> 71 <version>2.8.2</version> 72 </plugin> 73 <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> 74 <plugin> 75 <artifactId>maven-site-plugin</artifactId> 76 <version>3.7.1</version> 77 </plugin> 78 <plugin> 79 <artifactId>maven-project-info-reports-plugin</artifactId> 80 <version>3.0.0</version> 81 </plugin> 82 <plugin> 83 <groupId>org.apache.maven.plugins</groupId> 84 <artifactId>maven-jar-plugin</artifactId> 85 <configuration> 86 <archive> 87 <manifest> 88 <mainClass>henkan.App</mainClass> 89 <addClasspath>true</addClasspath> 90 <addExtensions>true</addExtensions> 91 </manifest> 92 </archive> 93 </configuration> 94 </plugin> 95 </plugins> 96 </pluginManagement> 97 </build> 98</project>
プラグインの追加をすればいいと思うのですが、どうすればよいでしょうか
追記
作成した時の手順は mvn package で作成しました(この時にエラーなどの警告は無し)
開く方法としてはコマンドプロンプトで java -jar で開こうとして上記の様なエラー内容です。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/11/21 07:44
2020/11/24 00:21
2020/11/24 01:08
2020/11/24 12:18
2020/11/26 05:02