简体   繁体   English

简单的Java程序在Eclipse EE IDE上不产生任何输出

[英]Simple Java program producing no output on Eclipse EE IDE

I am trying to execute a simple Java program in newly setup Eclipse IDE, but cannot see any output in console. 我试图在新设置的Eclipse IDE中执行一个简单的Java程序,但是在控制台中看不到任何输出。 Below is my program 下面是我的程序

/** 
 * The HelloWorldApp class implements an application that
 * simply prints "Hello World!" to standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.
    }
}

Have checked build paths for JRE and JDK is added to environment variables as well. 检查了JRE的构建路径,并且JDK也已添加到环境变量中。 I am missing some configuration settings but not able to figure that out. 我缺少一些配置设置,但无法弄清楚。 Any leads will be helpful. 任何线索都将有所帮助。


Compilation is working perfectly file and .classes work as expected via cmd. 编译工作正常,文件和.classes通过cmd正常工作。 Added a breakpoint in the main method. 在main方法中添加了一个断点。 When I did debug As -> application, error is thrown, its not able to launch the class. 当我调试As->应用程序时,抛出了错误,它无法启动该类。

Error Thrown --> Cannot connect to VM Socket operation on nonsocket: configureBlocking 引发错误->无法在非套接字上连接到VM套接字操作:configureBlocking

There is a small pull-down icon on the right of the console that lets you select which console you want to see. 控制台右侧有一个小下拉图标,可让您选择要查看的控制台。 Maybe you accidentally selected a different console. 也许您不小心选择了其他控制台。

If this doesn't work try next. 如果这不起作用,请尝试下一个。

Go to run and choose Run Configurations -> Common and in the Standard Input and Output configuration see if Allocate Console is selected. 转到run并选择Run Configurations -> Common然后在标准输入和输出配置中查看是否选择了Allocate Console

在此处输入图片说明

Use the command prompt first to check if JDK, and JRE properly are install. 首先使用命令提示符检查是否已正确安装JDK和JRE。 Then if the problem still exit after you set up the path permanently. 然后,如果在永久设置路径后问题仍然存在。 Reinstall Eclipse IDE For executing any java program, you need to 重新安装Eclipse IDE要执行任何Java程序,您需要

  1. List item install the JDK if you don't have installed it, download the JDK and install it. 如果您尚未安装JDK,请安装列表项,然后下载并安装JDK。
  2. set path of the jdk/bin directory. 设置jdk / bin目录的路径。 http://www.javatpoint.com/how-to-set-path-in-java http://www.javatpoint.com/how-to-set-path-in-java
  3. create the java program compile and run the java program 创建Java程序编译并运行Java程序
  4. open command prompt then type javac Simple.java 打开命令提示符,然后键入javac Simple.java
  5. then type java Simple 然后输入java Simple

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM