当前位置: 代码迷 >> Eclipse >> 初学,为什么在命令行方式下可以编译通过,在eclipse下不行呢?该怎么处理
  详细解决方案

初学,为什么在命令行方式下可以编译通过,在eclipse下不行呢?该怎么处理

热度:93   发布时间:2016-04-23 14:18:53.0
初学,为什么在命令行方式下可以编译通过,在eclipse下不行呢?
eclipse 3.3.1 + jdk 1.7.0
  ant_home 已经设置
public class helloworld {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
  System.out.println("hello,world!");
}

}


1, javac helloworld.java 可以编译通过 ;java helloworld 可以输出
2, 但是在eclipse中,右键点击helloworld.java-->run as --> java application 
  确提示; a java exeception has occurred ;  
  error:could not find the main class ;
  error:a jni error has occured ,please check your installation and try again .



------解决方案--------------------
在我的eclips运行中通过,估计lz程序安装有问题。

------解决方案--------------------
应该是JDK安装有问题哇
或者是ECLIPCE有问题
一般的咋个会报ERROR
------解决方案--------------------
你的eclipse配制的时候,选的jdk是否正确?
------解决方案--------------------
请问上一楼的朋友,为什么呢?
  相关解决方案