Eclipse正在执行错误的Java文件 [英] Eclipse is executing the wrong Java file

查看:87
本文介绍了Eclipse正在执行错误的Java文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse编写和测试Java。我是一个初学者,所以我不知道任何关于Eclipse。



当我尝试运行我刚写的Java文件时,会出现问题。而不是执行打开的文件,它执行我以前成功运行的文件。我在同一个默认包中有几个文件。软件包资源管理器显示我的软件包的位置是:Aayush> src>默认包



我想运行一个名为的文件logicaloperator.java ,但它运行 ifstatement.java 都在同一个默认包中,我使用工具栏上的第6个按钮来运行它。当我将鼠标悬停在运行按钮上时,它会显示运行ifstatement,但应该是运行逻辑运算符。

解决方案

strong> 1。请参阅您在此类文件中包含 main()方法。



2。如果您还有问题,请右键单击包资源管理器中的此java文件,然后选择运行



3。保留包含您的main()方法的类名以及将
保存在Eclipse中的文件名称。 / p>

它的 logicaloperators.java NOT logicaloperator.java .. ....你错过了s



例如:

  class logicaloperators {


public static void main(String [] args){


}

将其另存为 logicaloperators.java


I am using Eclipse to write and test Java. I am a beginner so i don't know anything about Eclipse.

The problem occurs when I try to run the Java file I just wrote. Instead of executing the file that is opened, it executes the file that I have successfully ran before. I have a few files in the same default package. The package explorer shows that the location of my package is: Aayush > src > default package

I want to run a file named logicaloperator.java but it runs ifstatement.java both are in the same default package and I use the 6th button on the toolbar to run it. When I hover over the run button it says : "run ifstatement" but it should be saying "run logicaloperator".

解决方案

1. Please see that you have included the main() method in this class file.

2. If you still have the probs then right click on this java file in the package explorer and select Run

3. Keep the class name which contains your main() method, and the File name with which you save your file in Eclipse as SAME.

Its logicaloperators.java NOT logicaloperator.java......You have missed the "s"

Eg:

class logicaloperators{


      public static void main(String[] args){

   }
 }

Save it as logicaloperators.java

这篇关于Eclipse正在执行错误的Java文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆