`

eclipse maven项目运行时报错could not find the main class的解决办法

阅读更多

打开.project文件,从其他可以有运行main的地方copy一个maven的builder过来,补上就好了。

 

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>xxx</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.m2e.core.maven2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
...

 原因猜测:ecilpse的工程运行main的时候需要builder去提供类路径吧,然后没有builder相当于classpath少了一部分,纯属猜测

分享到:
评论

相关推荐

    达梦 6 数据库驱动 jar 包

    System.out.println("Could not find the driver."); e.printStackTrace(); } catch (SQLException e) { System.out.println("Failed to connect to the database."); e.printStackTrace(); } } } ``` 在上述...

    SQL Server连接JDBC需要的jar包

    System.out.println("Could not find the driver."); e.printStackTrace(); } catch (SQLException e) { System.out.println("Error connecting to the database."); e.printStackTrace(); } } } ``` 在这个...

    java连接SQLServer2008代码和jar包

    System.out.println("Could not find the driver."); e.printStackTrace(); } catch (SQLException e) { System.out.println("Error connecting to the database."); e.printStackTrace(); } } } ``` 在上述...

    java连数据需要的3个包

    System.out.println("Could not find the driver."); e.printStackTrace(); } catch (SQLException e) { System.out.println("Error connecting to the database."); e.printStackTrace(); } } } ``` 在上述...

    JDBC 连接到 PostgreSQL 数据库简单例子

    System.out.println("Could not find the driver."); e.printStackTrace(); } catch (SQLException e) { System.out.println("Error connecting to the database."); e.printStackTrace(); } } } ``` 在这个...

Global site tag (gtag.js) - Google Analytics