0

I started to code robocode with eclipse. But whenever i run the program from eclipse it gives error,

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

Things i have done:

  • I added robocode.jar as a reference library

In run configuration

  • VM arguments -Xmx512M -Dsun.io.useCanonCaches=false
  • Working directory other - /home/sameera/robocode
  • project - robo_first
  • Main class - robo_first.robo_new

What's wrong with this? Are there anything else that I should do?

package robo_first;

import robocode.Robot;

public class robo_new extends Robot{

    @Override
    public void run() {


        while(true){
            turnGunRight(360);
            ahead(100);
        }
    }
}

I ran above code in Robocode directly, by setting preference/development options and adding eclipse workspace/project/bin.. and it works..!!!

I'm using eclipse luna, ubuntu 14.04 and robocode 1.9.2.4

Sameera Kumarasingha
  • 2,908
  • 3
  • 25
  • 41

1 Answers1

1

I think that the error is that you are search the main method in robo_first.robo_new but there is no main method in that class, you must search it in robocode.Robocode the class which is inheriting.

the configuration looks like this

enter image description here