Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2004

Tip: Looking for answers? Try searching our database.

can't find package that is in jar file

Thread view: 
chris - 14 Apr 2004 23:42 GMT
So there is a package in /somedir/somewhere/stuff.jar

If I look in stuff.jar I see subdirs like this:

/com/mycompany/connection/*.class

My CLASSPATH has /somedir/somewhere in it, and my code has this import statement:

import com.mycompany.connection.*

But yet I get an error when I try to compile with "javac mycode.java"

package com.mycompany.connection does not exist

What on Earth is going on here? I'm using java 1.4.2. Thanks.

chris
Chris Smith - 15 Apr 2004 00:26 GMT
> So there is a package in /somedir/somewhere/stuff.jar
>
[quoted text clipped - 11 lines]
>
> What on Earth is going on here? I'm using java 1.4.2. Thanks.

Your classpath needs the whole JAR file, "/somedir/somewhere/stuff.jar".  
Including "/somedir/somewhere" in your classpath tells the Java compiler
that the class might be in a file called
"/somedir/somewhere/com/mycompany/connection/ClassName.class"... which,
of course, it is not.

Signature

www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Roedy Green - 16 Apr 2004 00:06 GMT
>My CLASSPATH has /somedir/somewhere in it, and my code has this import statement:

See http://mindprod.com/jgloss/classpath.html

Note especially what you must do to get it to look in jar files.  You
DON'T just put jars somewhere on the classpath.

There are two techniques -- the ext directory -- easiest, and adding
individual jars to the classpath.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.