You need to import,
Make sure you are using a IDE.Code:net.sf.javainetlocator.InetAddressLocator;
|
Compiler error:
src\panel\Address.java error: package net.sf.javainetlocator does not exist
import net.sf.javainetlocator.InetAddressLocator;
^
src\panel\Address.java:4: error: package net.sf.javainetlocator does not exist
import net.sf.javainetlocator.InetAddressLocatorException ;
^
src\panel\Address.java:13: error: cannot find symbol
this.countryOfOrigin = InetAddressLocator.getLocale(addr
ess).getDisplayCountry();
^
symbol: variable InetAddressLocator
location: class Address
src\panel\Address.java:14: error: cannot find symbol
} catch (InetAddressLocatorException ex) {
^
symbol: class InetAddressLocatorException
location: class Address
4 errors
Appuyez sur une touche pour continuer...
Address.java
package panel;
import net.sf.javainetlocator.InetAddressLocator;
import net.sf.javainetlocator.InetAddressLocatorException ;
public class Address {
private String address;
private String countryOfOrigin;
public Address(String address) {
this.address = address;
try {
this.countryOfOrigin = InetAddressLocator.getLocale(address).getDisplayCo untry();
} catch (InetAddressLocatorException ex) {
this.countryOfOrigin = "Unknown";
}
if (this.countryOfOrigin.equals(null) || this.countryOfOrigin.equals("**") || this.countryOfOrigin.equals("")) {
this.countryOfOrigin = "Unknown";
}
}
public String getAddress() {
return address;
}
public String getCountryOfOrigin() {
return countryOfOrigin;
}
}
It can't be fixed without using an IDE like eclipse?
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |