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

来源:百度知道 编辑:UC知道 时间:2024/06/09 14:15:20
下面是我的代码,我在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.ou

直接在eclipse里面新建一个项目,复制如你编的代码不就好了,出现乱码查看JAVA文件的编码系统。

Run->Open Run Dialog -> 在左边的Java Application,选择一个(如果没有按右键新建一个)
然后在右边选择Common tab选项,在Standard Input and Output中选中 Allocate Console