How to configure Eclipse to compile using Oracle javac 1.7.0_09?

前端 未结 2 1312
孤街浪徒
孤街浪徒 2020-12-11 04:32

I am trying to compile following piece of code:

public class DuplicateMainExample {
    public static void main(Stri         


        
2条回答
  •  粉色の甜心
    2020-12-11 05:25

    Simply because you have declared the same method with exactly the same signature twice ... Only one main method for class should be declared .

    Eclipse have embedded its own compiler and in the case of two main methods it gets the last one, the eclipse compiler and the javac compiler are two different compilers ...

    Take a look at this older post for more information ...

    If you want to compile with javac you could try using the ant javac adapter from within eclipse ... However i think that ECJ is even better than javac(my opinion) ...

提交回复
热议问题