---
title: "关于为什么执行JAVA程序时，会出现Exception in thread \"main\" java.lang.NoClassDefFoundError的错误。"
author: "simon_zhang"
date: "2006-09-14T09:46:00Z"
tags: []
slug: "java-exception-in-thread-main-java-lang-noclassdeffounderror"
draft: false
lastmod: "2006-09-14T09:46:00Z"
id: 64934
url: "https://mogee.iteye.com/blog/64934"
---

前天刚装完的系统环境变量多配好了，在控制台运行的时候出现Exception in thread "main" java.lang.NoClassDefFoundError：test  的错误。环境变量的配置如下：

java\_home ： D:\\bea\\jdk142\_05  
path ：D:\\bea\\jdk142\_05\\bin  
ClassPath   ：D:\\bea\\jdk142\_05\\lib\\dt.jar;D:\\bea\\jdk142\_05\\lib\\tools.jar

在eclipse中运行一点问题也没有，嘿 问题出在哪了。问题一定在环境变量里。后经仔细查看原来问题真的出在环境变量ClassPath中，后改为如下：

ClassPath ： .;D:\\bea\\jdk142\_05\\lib\\dt.jar;D:\\bea\\jdk142\_05\\lib\\tools.jar

问题就解决了。