Java Couln';重命名主类后是否找不到或加载主类?
我已经将我的主类从CarInsurance重命名为CarInsuranceQuote,当我运行jar文件时,出现“找不到或加载主类”错误。 我使用Netbeans 8.2和maven作为构建工具。下面是pom.xmlJava Couln';重命名主类后是否找不到或加载主类?,java,maven,selenium,maven-2,Java,Maven,Selenium,Maven 2,我已经将我的主类从CarInsurance重命名为CarInsuranceQuote,当我运行jar文件时,出现“找不到或加载主类”错误。 我使用Netbeans 8.2和maven作为构建工具。下面是pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchem
<?xml version="1.0" encoding="UTF-8"?>
<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>com.challenge</groupId>
<artifactId>CarInsurance</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.challenge.carinsurance.CarInsuranceQuote</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
4.0.0
com.challenge
保险
1.0-快照
罐子
org.apache.maven.plugins
maven jar插件
2.6
真的
com.challenge.carinsurance.CarInsuranceQuote
org.seleniumhq.selenium
硒爪哇
3.4.0
UTF-8
1.8
1.8
非常感谢您的帮助,因为我陷入困境,我已经重新启动了netbeans,
在编译之前完成了mvn清理,但仍然得到相同的错误。您打包了吗?还是刚刚编译?@Vitaliy Moskalyuk刚刚编译,所以您的jar没有更改,而您执行的是旧的jar@VitaliyMoskalyuk,你能写下要遵循的mvn命令吗(步骤),因为我是maven的新手。至少感谢
mvn软件包
。这是医生