Hello
I have created a java class which I want to use from another java program.
Do I need to store the java file in a particular location? (bit like C/C++
include files?).
I tried just pasting class to bottom of file with main java program I was
using but that didn't work. Can I just have class in same file? But how?
Any help would be much appreciated.
Angus
Arne Vajhøj - 26 Nov 2006 22:15 GMT
> I have created a java class which I want to use from another java program.
>
[quoted text clipped - 5 lines]
>
> Any help would be much appreciated.
You can only have one public class per source file.
I think what you are looking for is "classpath".
Simple example:
javac -classpath .;C:\utilities Foobar.java
java -classpath .;C:\utilities Foobar
will be able to use a class mystuff.SmartUtility
in C:\utilities\mystuff\SmartUtility.class
Arne