-3
我有關於maxmind API的問題。我用一些例子來測試。然而,運行時錯誤「沒有主要功能public static void main(String [] args)」 我很困惑,我已經public static void main
已經。關於maxMind沒有主要功能錯誤
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");
}
}
}
提供更多的信息。我們不是魔術師。如果你希望我們幫助你,告訴我們你有什麼。 –
你有'public static void main',但是你有'public static void main(String [] args)'?你確定你有相同的聲明方法和相同的參數嗎? –
如果你的主要方法是正確的,那就留下了一些其他的可能性。也許你沒有正確編譯這個文件,或者你試圖運行錯誤的類? – kviiri