用Eclipse运行记事本编写的Java程序时出现no console display at this time

下面是我的代码,我在cmd或者用Jcreator运行时都能运行,但是用Eclipse不行,我的eclipse应该没设置错,我直接用eclipse编写的程序可以运行。

import javax.swing.*;
import java.awt.*;
public class Daxiao{
public static void main(String[]args){
String strNumber1 = JOptionPane . showInputDialog (" ÇëÊäÈëµÚÒ»¸öÊý ") ;
String strNumber2 = JOptionPane . showInputDialog (" ÇëÊäÈëµÚ¶þ¸öÊý ") ;
int number1= Integer.parseInt (strNumber1 );
int number2= Integer.parseInt (strNumber2 );
if(number1>number2) {System.out.println("ÄúÊäÈëµÄÁ½¸öÊýÖÐ×î´óµÄÊýΪµÚÒ»¸öÊý£º"+number1);}
else if(number1==number2){System.out.println("ÄúÊäÈëµÄÁ½¸öÊýÏàµÈ£¬¶¼Îª£º"+number2);}
else {System.out.println("ÄúÊäÈëµÄÁ½¸öÊýÖÐ×î´óµÄÊýΪµÚ¶þ¸öÊý£º"+number2);}
}}
一楼的我按照你说的做后,发现无法建立application

第1个回答  2009-04-02
Run->Open Run Dialog -> 在左边的Java Application,选择一个(如果没有按右键新建一个)
然后在右边选择Common tab选项,在Standard Input and Output中选中 Allocate Console
第2个回答  2009-04-02
直接在eclipse里面新建一个项目,复制如你编的代码不就好了,出现乱码查看JAVA文件的编码系统。
相似回答
大家正在搜