This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
albert kao wrote:Only a type can be imported. com.myutil resolves to a package KeyClient.java /XX/src/com/myutil/taglib line 9 Java Problem
The error message could be more clear, true. With imports you must either specify a class (e.g. java.util.List) or use a wildcard to import everything from the package (e.g. java.util.*). The former is preferred as it also avoids ambiguity (like java.awt.List and java.util.List when importing java.awt.* and java.util.*).
The method getTestKey(String) is undefined for the type KeyClient KeyClient.java /XX/src/com/myutil/taglib line 80 Java Problem
The getTextKey method is a static method of class GetTestKey. You are calling it directly so the compiler looks for the method in the current class (KeyClient). For instance methods you must use an instance to call a method (instance.instanceMethod(params)); for static methods you should use the class name (MyClass.staticMethod(params)).