Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to Specify CLASSPATH for eclipse?(Does eclipse use the Java devlopment environment CLASSPATH?)
How to Specify CLASSPATH for eclipse? [message #1717817] Thu, 17 December 2015 00:35 Go to next message
Arthur Chan is currently offline Arthur ChanFriend
Messages: 44
Registered: September 2015
Member
Hi.
I have a simple Java file to test connection to Oracle 11gR2.

I've downloaded the latest jodbc6.jar and it is in the CLASSPATH:
c:\Program Files\Java\jdk1.7.0.40\lib

I had assumed eclipse would look in the CLASSPATH i.e. in the development env. However it cannot find the OracleDriver.

Do I need to specify it explicitly to eclipse?

Project Name -> Build Path -> where do I go from here?

I want this CLASSPATH to be accessible for all projects.
Re: How to Specify CLASSPATH for eclipse? [message #1717818 is a reply to message #1717817] Thu, 17 December 2015 00:55 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 12/16/2015 05:35 PM, Arthur Chan wrote:
> Hi.
> I have a simple Java file to test connection to Oracle 11gR2.
>
> I've downloaded the latest jodbc6.jar and it is in the CLASSPATH:
> c:\Program Files\Java\jdk1.7.0.40\lib
>
> I had assumed eclipse would look in the CLASSPATH i.e. in the
> development env. However it cannot find the OracleDriver.
>
> Do I need to specify it explicitly to eclipse?
>
> Project Name -> Build Path -> where do I go from here?
>
> I want this CLASSPATH to be accessible for all projects.

For various good reasons, Eclipse doesn't work with your system
CLASSPATH. You must put the JAR into your project as a JAR/library.

There are lots of ways to do this.

You can do it "physically". This is not the best way, but it works very
well. It means a copy of that JAR in every project.

The most popular (and best) way is to put a dependency in your pom.xml
file for that JAR. That way, every project gets it out of your
..m2/repository each time you build. Of course, you have to grok Maven to
do that.

Hope this helps.
Re: How to Specify CLASSPATH for eclipse? [message #1717819 is a reply to message #1717818] Thu, 17 December 2015 01:43 Go to previous messageGo to next message
Arthur Chan is currently offline Arthur ChanFriend
Messages: 44
Registered: September 2015
Member
Groannn, I don't grog Maven Sad

What about from the point of view of distributiing the apps, probably packaged in an executable .jar

Doesn't that mean I have to physically pull the .jar into each project?
Re: How to Specify CLASSPATH for eclipse? [message #1717824 is a reply to message #1717819] Thu, 17 December 2015 05:44 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 12/16/2015 06:43 PM, Arthur Chan wrote:
> Groannn, I don't grog Maven :(
>
> What about from the point of view of distributiing the apps, probably
> packaged in an executable .jar
> Doesn't that mean I have to physically pull the .jar into each project?

Well, you think about it. Does the JAR have to be there for the project
to work/run/etc.?

Maven is a steep learning curve, however, I think Eclipse has made it
easier. Maven copies the JAR physically into the project when it builds
it so you don't have to manage any JARs directly.

Otherwise, you can just do what we all used to do years ago before
Maven: stick the JAR under a subdirectory named lib and use Build Path
to add it to the project.

Sorry.
Re: How to Specify CLASSPATH for eclipse? [message #1717826 is a reply to message #1717819] Thu, 17 December 2015 05:45 Go to previous message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 12/16/2015 06:43 PM, Arthur Chan wrote:
> Groannn, I don't grog Maven :(
>
> What about from the point of view of distributiing the apps, probably
> packaged in an executable .jar
> Doesn't that mean I have to physically pull the .jar into each project?


http://www.vogella.com/tutorials/ApacheMaven/article.html
Previous Topic:Error to Enter eclips
Next Topic:Automatic, persistent subscription to posts?
Goto Forum:
  


Current Time: Thu Apr 25 18:01:18 GMT 2024

Powered by FUDForum. Page generated in 5.08808 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top