简体   繁体   中英

Robocode run in eclipse

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

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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