I have a can called "MyTools". The box is located in the c: \ data folder. I created a new file in the same folder called "UseTools.java". Now I would like to use some of the classes from MyTools.jar in my UseTools.java. I tried this, but it does not seem to work:
import MyTools.*; public class UseTools { public static void main(String[] args) { MyTools.SomeClass foo = new SomeClass(); SomeClass.doSomething(); } }
I tried to compile this with:
javac -cp . UseTools.java
and received this error message:
UseTools.java:1: package MyTools does not exist import MyTools.*; ^ UseTools.java:7: package MyTools does not exist MyTools.SomeClass foo = new SomeClass() ^ 2 errors
I did not specify a package name in any class.
Do I need to set the package name in my jar classes?
source share