|
Re: How to Specify CLASSPATH for eclipse? [message #1717818 is a reply to message #1717817] |
Thu, 17 December 2015 00:55 |
|
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 #1717824 is a reply to message #1717819] |
Thu, 17 December 2015 05:44 |
|
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.
|
|
|
|
Powered by
FUDForum. Page generated in 5.08808 seconds