本文介绍了错误:无法找到或加载主类com .....如何解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
错误:无法找到或加载主类com.raj.spring.springormagain.Test
我尝试了什么:
Test.java
package com.raj.spring.springormagain;
public class 测试{
public static void main( String [] args){
System.out.println( hello world) ;
}
}
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
< ; groupid> com.raj.spring
< artifactid> springormagain
< version> 0. 0 。 1 -SNAPSHOT
< packaging> jar
< name> springormagain
< url> http: // maven.apache.org
< properties>
< springframework.version> 5. 0 。 8 .RELEASE
< dependencies>
<依赖>
< groupid> org.springframework
< artifactid> spring-core
< version> $ {springframework.version}
<依赖性>
< groupid> org.springframework
< artifactid> spring-context
< version> $ {springframework.version}
< ! - https: // mvnrepository.com/artifact/org.springframework/spring-orm - >
< dependency>
< groupid> org.springframework
< artifactid> spring-orm
< version> $ {springframework.version}
< ! - https: // mvnrepository.com/artifact/org.hibernate/hibernate-core - >
< dependency>
< groupid> org.hibernate
< artifactid> hibernate-core
< version> 5. 3 。 6 .Final
<! - https: // mvnrepository.com/artifact/mysql/mysql-connector-java - >
< dependency>
< groupid> mysql
< artifactid> mysql-connector-java
< version> 8. 0 。 12
< build>
< pluginmanagement>
< plugins>
< plugin>
< groupid> org.apache.maven.plugins
< artifactid> maven-compiler-plugin
< version> 3. 8 . 0
< configuration>
< source />1. 8
< target> 1. 8
解决方案
Error: Could not find or load main class com.raj.spring.springormagain.Test
What I have tried:
Test.java
package com.raj.spring.springormagain; public class Test { public static void main(String[] args) { System.out.println("hello world"); } }
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 <groupid>com.raj.spring <artifactid>springormagain <version>0.0.1-SNAPSHOT <packaging>jar <name>springormagain <url>http://maven.apache.org <properties> <springframework.version>5.0.8.RELEASE <dependencies> <dependency> <groupid>org.springframework <artifactid>spring-core <version>${springframework.version} <dependency> <groupid>org.springframework <artifactid>spring-context <version>${springframework.version} <!-- https://mvnrepository.com/artifact/org.springframework/spring-orm --> <dependency> <groupid>org.springframework <artifactid>spring-orm <version>${springframework.version} <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core --> <dependency> <groupid>org.hibernate <artifactid>hibernate-core <version>5.3.6.Final <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --> <dependency> <groupid>mysql <artifactid>mysql-connector-java <version>8.0.12 <build> <pluginmanagement> <plugins> <plugin> <groupid>org.apache.maven.plugins <artifactid>maven-compiler-plugin <version>3.8.0 <configuration> <source />1.8 <target>1.8
解决方案
这篇关于错误:无法找到或加载主类com .....如何解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!