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 / March 2005

Tip: Looking for answers? Try searching our database.

Troubles with my classpath

Thread view: 
Tom Vercauteren - 29 Mar 2005 19:23 GMT
Hi,

I've read a lot of threads about the classpath, but I didn't really find
what I was looking for.  
Briefly explained : i want to add jdbcdrv.zip to my classpath.
the file is located under: C:\Program Files\Sybase\SQL Anywhere 7\java

so i add to my classpath the directory with the zipfile, but i still can't
import anything from whitin that zipfile.

My classpath :
C:\Program Files\Java\jdk1.5.0_02\bin;C:\Program Files\Sybase\Jaguar CTS
3.5\html\classes;C:\Program Files\Sybase\Jaguar CTS 3.5\java\classes;C:\
Program Files\Sybase\Shared\Sun\jdk118\lib\classes.zip;C:\Program Files\
Sybase\Shared\PowerBuilder\classes.zip;.;%J2EE_HOME%\lib\j2ee.jar;%
J2EE_HOME%\lib\locale;C:\Program Files\Sybase\SQL Anywhere 7\jConnect\
classes;C:\Program Files\Sybase\SQL Anywhere 7\java\jdbcdrv.zip;

OS : windows XP

Structure of jdbcdrv.zip : /com/sybase/jdbc/..

When i want to import, i type
import com.sybase.jdbc.*;

And then i always get the error message : The import com.sybase cannot be
resolved.

I use eclipse to develop.  

Does anyone has an idea how i can solve this problem ?

Thanks in advance,
Greetz,
Tom
Brian Munroe - 29 Mar 2005 19:51 GMT
> Hi,
>
[quoted text clipped - 9 lines]
>
> Does anyone has an idea how i can solve this problem ?

I am new to using Eclipse, but whenever I need to add an external jar
file (or zip in this case) I usually do the following:

(This is version 3.0, btw)

1. In the Package Explorer, right click on the project name
2. From the context menu, choose Properties
3. Select the Java Build Path in the left pane
4. Click the "Add External Jars" button
5. Navigate to where the jdbcdrv.zip file is located and double-click
it.  At this point it should add the zip to the build path
6. In the Properties dialog, select the Ok button.

Now go back to the editor window and hopefully your errors disappear -
btw, you may have to do a little editing and saving to cause Eclipse to
reparse the file (like press the space bar or remove whitespace, etc),

-- brian
Tom Vercauteren - 29 Mar 2005 20:20 GMT
This works !!!

So if i get this right... Eclipse uses his own classpath, above that of the
one of the operating system?  

Anyway...
A very big thank you man !
Brian Munroe - 29 Mar 2005 20:25 GMT
> So if i get this right... Eclipse uses his own classpath, above that of the
> one of the operating system?

Yep, I don't even think it touches the OS classpath environment
variable.  By the way, the steps above are for an individual project
classpath, but I think if you goto Window->Properties->Java->Build
Path->Classpath Variables you can modify the Eclipse environment
classpath, but I haven't tried that yet.

> Anyway...
> A very big thank you man !

No problem, glad to help.

-- brian
Big Jim - 29 Mar 2005 20:18 GMT
The path to your file has spaces in it, java doesn't like that. You could
move it or if you're using an IDE, add it as an "external library" through
that, it'll probably resolve the spaces problem for you.

> Hi,
>
[quoted text clipped - 31 lines]
> Greetz,
> Tom
Tom Vercauteren - 30 Mar 2005 06:41 GMT
i thought that already that those spaces were the problem, but even when i
put my library in another directory it wasn't working.  
When i did your second thing, it worked... I imported the "external"
library and everything went fine.

Thanks to both of you!


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.