Importing classes

Hi!

I downloaded a Jar file call Voip.jar and inside the jar file it has a directory called com and a subdirectory called classes which contain all the classes I am referencing from my program.

What is the proper way to reference them with import?

import com.classes.*;

import Voip.com.classes.*;

I can't figure it out,

David

[369 byte] By [Davida] at [2007-10-2 3:52:47]
# 1
import com.classes.*;and when you attempt to compile, the Viop.jar must be in your classpath.
Arbiea at 2007-7-15 23:09:11 > top of Java-index,Java Essentials,New To Java...
# 2
They are in my class path and the working directory from where I am trying to run my app.It's still not working.
Davida at 2007-7-15 23:09:11 > top of Java-index,Java Essentials,New To Java...
# 3

> They are in my class path and the working directory

> from where I am trying to run my app.

>

> It's still not working.

Then contrary to what you say, it is not in the classpath. When you say classpath I hope you're not talking about some environment variable named CLASSPATH. You should tell the compiler and runtime what your necessary classpath is at that time and not depend on an environment variable.

javac -classpath /path/Voip.jar;(other classpath elements here) ...

java -classpath (ditto) ....

warnerjaa at 2007-7-15 23:09:11 > top of Java-index,Java Essentials,New To Java...
# 4

I see where I went wrong. I did not realise that the Jar file has to be part of the classpath.

What I had was:

in a directory called java_dev:

myapp.java

myapp.class

someclassesina.jar

My command was:

java -classpath ./ myapp.class

What I should oh had was:

java -classpath ./someclassesina.jar myapp.class

Forums are for figuring out those subtle differences. :)

Thanks,

David

Davida at 2007-7-15 23:09:11 > top of Java-index,Java Essentials,New To Java...