本地存在多个Java版本造成”Could not find the main class. Program will exit!”


近日,在对一个工程打包成可执行的Jar文件之后,每次双击都会出现Could not find the main class. Program will exit!错误。
尝试了使用eclipse打包,手工打包,确认MANIFEST.MF文件格式没有问题。
最后通过编写bat文件,指明java.exe路径解决问题。
文件内容:”C:\Program Files\Java\jre6\bin\java.exe” -jar jarname.jar
Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s