X
Xiaoshen Li
Dear All,
I have a Java class ToolBox inside the file ToolBox.java, which has many
static methods. I put it in(Linux OS): /home/Xiaoshen/programming/java/
Now if I have a file in the same directory, I have no problem in using
ToolBox's static methods. For example, in the file Test.java, I can have:
int iNum = ToolBox.averageTwoInts(2, 4);
But if I am working in a different directory, say,
/home/Xiaoshen/programming/java/homework/proj_1/. The problem came:
ToolBox cannot be found.
(
I know setting CLASSPATH solves the problem:
export CLASSPATH= /home/Xiaoshen/programming/java/:.
)
Here I am trying to go through package name. I have added the line on
the top of the file:
import home.Xiaoshen.programming.java.*;
But it doesn't work. Should I add a line to the top of the file
ToolBox.java:
package mypackage;
Could anybody help me out? Thank you very much.
I have a Java class ToolBox inside the file ToolBox.java, which has many
static methods. I put it in(Linux OS): /home/Xiaoshen/programming/java/
Now if I have a file in the same directory, I have no problem in using
ToolBox's static methods. For example, in the file Test.java, I can have:
int iNum = ToolBox.averageTwoInts(2, 4);
But if I am working in a different directory, say,
/home/Xiaoshen/programming/java/homework/proj_1/. The problem came:
ToolBox cannot be found.
(
I know setting CLASSPATH solves the problem:
export CLASSPATH= /home/Xiaoshen/programming/java/:.
)
Here I am trying to go through package name. I have added the line on
the top of the file:
import home.Xiaoshen.programming.java.*;
But it doesn't work. Should I add a line to the top of the file
ToolBox.java:
package mypackage;
Could anybody help me out? Thank you very much.