我对 maxmind API 有疑问。我用一些例子来测试。但是,运行时错误“no main function public static void main(String[] args)”我很困惑,我已经知道public static void main
了。
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");
}
}
}