import package

  • Thread starter Christoph Keller
  • Start date
C

Christoph Keller

Dear NG

I'm trying to import a package stored in a file "jacob.jar" by:
import com.jacob.com.*;
The compiler says:
package com.jacob.com does not exist.
jacob.jar ist stored in c:\program files\java\classes and the table of
content shows:
META-INF/MANIFEST.MF
com/jacob/com/ComException.class
com/jacob/com/ComFailException.class
etc.
the environment variable CLASSPATH is set to "c:\program files\java\classes"
I also tried to store "jacob.jar" in ....\java\jre\lib or
.....\java\jre\lib\ext but it did not helb:
package com.jacob.com does not exist, says the compiler.

I would very much appreciate any help or hints, thanks

Chris Keller, JAVA newbie (version 6, Windows XP)
 
A

Arne Vajhøj

Christoph said:
Dear NG

I'm trying to import a package stored in a file "jacob.jar" by:
import com.jacob.com.*;
The compiler says:
package com.jacob.com does not exist.
jacob.jar ist stored in c:\program files\java\classes and the table of
content shows:
META-INF/MANIFEST.MF
com/jacob/com/ComException.class
com/jacob/com/ComFailException.class
etc.
the environment variable CLASSPATH is set to "c:\program files\java\classes"
I also tried to store "jacob.jar" in ....\java\jre\lib or
....\java\jre\lib\ext but it did not helb:
package com.jacob.com does not exist, says the compiler.

I would very much appreciate any help or hints, thanks

"c:\program files\java\classes" in classpath make Java look for
"c:\program files\java\classes\com\jacob\com\*.class".

You need to put "c:\program files\java\classes\jacob.jar" in CLASSPATH.

Arne

PS: It is not very good to put things in the global CLASSPATH variable !
 
W

Wesley Mesquita

Dear NG

I'm trying to import a package stored in a file "jacob.jar" by:
import com.jacob.com.*;
The compiler says:
package com.jacob.com does not exist.
jacob.jar ist stored in c:\program files\java\classes and the table of
content shows:
META-INF/MANIFEST.MF
com/jacob/com/ComException.class
com/jacob/com/ComFailException.class
etc.
the environment variable CLASSPATH is set to "c:\program files\java\classes"
I also tried to store "jacob.jar" in ....\java\jre\lib or
....\java\jre\lib\ext but it did not helb:
package com.jacob.com does not exist, says the compiler.

I would very much appreciate any help or hints, thanks

Chris Keller, JAVA newbie (version 6, Windows XP)

Tell us what command you are using to compile it, maybe usefull. IDEs
like Eclipse, do it automatically but somentimes it is better to
explicit tell the compiler (eg, javac) the class path.
 
M

Mark Space

Christoph said:
....\java\jre\lib\ext but it did not helb:

If it's not working there, that's not a good sign. There maybe some
other issue, so keep plugging away at it. Both Arne and Wesley had good
suggestions.

As a last ditch sort of thing, you might want to unpack the .jar file
(it's just a .zip file) and check the paths very carefully. It's not
likely, but it's just possible there's a non-ascii character in the
package name or something similar.
 
C

Christoph Keller

the environment variable CLASSPATH is set to "c:\program
You need to put "c:\program files\java\classes\jacob.jar" in CLASSPATH.

Arne

This was my mistake, thank you Arne.

Does anyone have a pointer to a tutorial that deals with
package/classes/project organisation: i.e. what to store where? do you all
work with makefiles?

Christoph Keller
 
M

Martin Gregorie

Christoph said:
>
do you all work with makefiles?
I have done, due to much C compiling, but they really don't work too
well with Java, largely because of the way that the javac compiler does
a lot of the stuff that a simple make recipe is used for.

Use ant for Java - its Yet Another Make but has been optimized to work
with Java and, unlike make, has a number of built-in operations such as
running javac, javadoc and jar.

If you're used to writing makefiles from scratch you'll find ant quite easy.

HTH
Martin
 
A

Arne Vajhøj

Christoph said:
Does anyone have a pointer to a tutorial that deals with
package/classes/project organisation: i.e. what to store where? do you all
work with makefiles?

Advice:
* nothing in CLASSPATH.
* nothing in jre/lib/ext
* everything in explicit classpath for command

Most people uses either ant or maven to build with.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top