---
title: "eclipse maven项目运行时报错could not find the main class的解决办法"
author: "floydd"
date: "2017-05-03T14:35:09Z"
tags: []
categories: ["编程语言"]
slug: "eclipse-maven-could-not-find-the-main-class"
draft: false
lastmod: "2017-05-03T14:36:12Z"
id: 2372433
url: "https://floydd.iteye.com/blog/2372433"
---

打开.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少了一部分，纯属猜测