eclipse 将 main 方法定义为:public static void main(String[] args) 或 JavaFX 应用程序类必须扩展 javafx.application.Application

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46894793/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:29:29  来源:igfitidea点击:

define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application

javaeclipse

提问by Venkat Gurrala

Error: Main method not found in class Arrays.C, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application

错误:在类 Arrays.C 中找不到 Main 方法,请将主要方法定义为:public static void main(String[] args) 或 JavaFX 应用程序类必须扩展 javafx.application.Application

Although am having a main method, am getting this kind of error.
the code is as follows.....

虽然我有一个主要的方法,但我遇到了这种错误。
代码如下.....

package Arrays;

public class C {

    public static void main(String[] args) {
        // TODO Auto-generated method stub


        int a[][]={{1,3,4},{3,4,5}};  
        int b[][]={{1,3,4},{3,4,5}}; 
        int c[][]=new int[2][3];  
        for(int i=0;i<2;i++)
        {  
            for(int j=0;j<3;j++)
            {  
                 c[i][j]=a[i][j]+b[i][j];  
                System.out.print(c[i][j]+" ");  
            }  
            System.out.println();
        }
    }

}

回答by Ashim Paul

javac -d . -classpath .;Arrays.jar C.java

javac -d 。-classpath .;Arrays.jar C.java

java -classpath .;Arrays.jar Arrays.C

java -classpath .;Arrays.jar Arrays.C

回答by Brent Sandstrom

It runs fine for me. Try this in eclipse: File > New > Java Project. Create a new Class called C in the src folder. Run

它对我来说运行良好。在 Eclipse 中试试这个:文件 > 新建 > Java 项目。在 src 文件夹中创建一个名为 C 的新类。跑