-3

I have a problem about maxmind API. I use some example to test. However, the runtime error "no main function public static void main(String[] args)" I am confused that I have public static void main already.

public class GetLocationExample {


    public static void main(String[] args) {

        try {
            LookupService lookup = new LookupService("D:\\GeoLiteCity.dat\\GeoLiteCity.dat",LookupService.GEOIP_MEMORY_CACHE);
            Location locationServices = lookup.getLocation("140.118.175.207");
            System.out.println("# country code: " + locationServices.countryCode);
            System.out.println("# country name: " + locationServices.countryName);
            lookup.close();
        }
        catch (IOException e) {
            System.out.println("IO Exception");
        }

    }
}
BenMorel
  • 34,448
  • 50
  • 182
  • 322
louis
  • 25
  • 6
  • 1
    Provide more info. We are no magicians. If you want us to help you, show us what you've got. – Martijn Courteaux Oct 29 '13 at 22:48
  • 1
    You have `public static void main` but do you have `public static void main(String [] args)` ?Are you sure you have the same declaration method with the same parameter ? – Alexis C. Oct 29 '13 at 22:49
  • If your main method is correct, that leaves a handful of other possibilities. Maybe you haven't compiled the file properly, or you're trying to run the wrong class? – kviiri Oct 29 '13 at 22:57
  • sorry, i can't understand this platform very much .. – louis Oct 29 '13 at 22:58
  • I mean that i have main function and no complie error, but i get rum time error that say i have no main function in my class – louis Oct 29 '13 at 22:59

1 Answers1

0

You certainly just have to add String[] parameter to your main method :

public static void main(String[] args){
    // The content of your main method
}
kmas
  • 6,401
  • 13
  • 40
  • 62