简体   繁体   English

Java代码可以在cmd窗口中编译,但不能在eclipse中运行

[英]The java code can compile in cmd window, but can not run in eclipse

this is the code from TIJ4# 这是TIJ4#的代码

The java code can compile and run in cmd window , but can not compile and run in eclipse . Java代码可以在cmd窗口中编译和运行,但是不能在eclipse中编译和运行。

//: io/MemoryInput.java
import java.io.*;   

public class MemoryInput {
public static void main(String[] args)
throws IOException {
StringReader in = new StringReader(
    BufferedInputFile.read("MemoryInput.java"));
int c;
while((c = in.read()) != -1){
  System.out.print((char)c);
  }
}

the wrong information about the code in eclipse is : 关于eclipse中的代码的错误信息是:
BufferedInputFile cannot be resolved BufferedInputFile无法解析

BufferedInputFile is not part of the package java.io . BufferedInputFile不是包java.io一部分。 If you have that class in a library or in a certain folder you have to include it in Eclipse. 如果您在库中或某个文件夹中拥有该类,则必须将其包含在Eclipse中。

BufferedInputFile is not part of any default lib of java. BufferedInputFile不属于任何Java默认库。 So you have to add that class to your class path. 因此,您必须将该类添加到您的类路径中。

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

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