Class Path
Hi Guys,
I have a class that uses another class that I designed. until now I used an IDE like BlueJ or NetBeans that automatically looked for the classes on the same folder as the class i am writing, But now I am using an Editor called TextPad and it does not do that. The question is how can I tell the JAVA compiler where the class being used is?
Best regards
Luis
> Hi Guys,
> I have a class that uses another class that I
> designed. until now I used an IDE like BlueJ or
> NetBeans that automatically looked for the classes on
> the same folder as the class i am writing, But now I
> am using an Editor called TextPad and it does not do
> that. The question is how can I tell the JAVA
> compiler where the class being used is?
> Best regards
>Luis
There are a couple ways to do this:
Set the classpath environment variable on your system to contain the root of the path where you classes can be found (where the top level package can be found).
Or, pass that information to the compiler / vm using the -cp or -classpath parameter on the command line when you run java or javac.
Or, if your working directory is the same as the directory that contains the top-level package, then the virtual machine should be able to find the classes itself.
- Adam
it should be, as long as your working directory is that directory... alternatively, add that directory to your classpath environment variable, OR just specify that path with the -cp switch when you execute java / javac.