我有关于maxmind API的问题。我用一些例子来测试。但是,运行时错误“没有主函数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");
}
}
}
答案 0 :(得分:0)
您当然只需要在主方法中添加String[]
参数:
public static void main(String[] args){
// The content of your main method
}