简体   繁体   English

JSONobject在intellij中有效,但从命令行运行时不起作用

[英]JSONobject works in intellij but not when run from command line

I have used maven to install JSON support to my Java project in IntelliJ. 我已经使用maven在IntelliJ中将JSON支持安装到我的Java项目中。 The project runs without problems while using JSONObject when I run it from the IntelliJ console. 从IntelliJ控制台运行该项目时,使用JSONObject时该项目运行不会出现问题。 When I open the IntelliJ terminal and run from the command line I get the following error. 当我打开IntelliJ终端并从命令行运行时,出现以下错误。

命令行中有关jsonobject的错误

I had the exact same issue where everything ran well when executed from IDE (IntelliJ) but throwing same "NoClassDefFound" error when executing jar file in command line. 我遇到了完全相同的问题,即从IDE(IntelliJ)执行时一切运行良好,但是在命令行中执行jar文件时却抛出相同的“ NoClassDefFound”错误。

Assuming you are using Maven, below is the best workaround I found: How to Create an Executable JAR with Maven 假设您正在使用Maven,以下是我发现的最佳解决方法: 如何使用Maven创建可执行的JAR

Henry's answer " You need to add the dependencies to the class path when executing the program. " provide the best clue. 亨利的答案“ 执行程序时需要将依赖项添加到类路径中。 ”提供了最佳线索。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 spring 在命令行上运行时引导不从 application.properties 文件中读取属性值,但在从 Intellij 运行应用程序时工作 - spring boot does not read property values from application.properties file when run on command line but works when application is run from Intellij 从命令行运行intellij idea项目 - Run intellij idea project from command line 如何从命令行运行 Intellij 项目 - How to run Intellij project from command line 从命令行运行IntelliJ配置 - Run IntelliJ configuration from command line 春季:mvn clean tomcat:run在命令行上有效,但不能在IntelliJ上运行 - Spring: mvn clean tomcat:run works on command line but not IntelliJ Maven 项目中的 JUnit 5 测试适用于 IntelliJ,但不适用于命令行 - JUnit 5 tests in Maven Project works in IntelliJ but Not from Command Line 在 IntelliJ 中使用 SimpleEmail 从命令行失败 - SimpleEmail works within IntelliJ fails from command line mysqldump从java运行时返回代码6,但同样的命令从命令行运行正常 - mysqldump returns code 6 when run from java, but the same command works fine from command line Intellij-命令行运行到配置 - Intellij - Command Line run to Configuration 能够从IntelliJ运行Java程序,但不能从命令行运行 - Able to run java program from IntelliJ but not from command line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM