Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Where do I put the JAR?
Where do I put the JAR? [message #156839] Wed, 14 June 2006 18:50 Go to next message
Eclipse UserFriend
Originally posted by: eclipse.spfweb.co.uk

Hi,

Using Eclipse 3.1 on OS X 10.4.6, I have a Dynamic Web Project running on a
Tomcat 5.5 server. I'm using the FileUpload library from Apache within my
application.

I'm confused as to where I should put the jar file? I can specify an
External JAR in the Java Build Path so my code compiles cleanly. But the jar
file is outside of the project folder way off in wherever I downloaded it
to, and then the app doesn't run because the server can't see it at runtime.

Could I import the jar file? Where is the best place to I import it to?

And I assume I also need to specify it in the J2EE Module Dependencies - how
does the list in 'Add JARs...' get populated; my list is empty?

Help - this is all really confusing! I'm just a few months into Java, and I
understand classpaths-n-stuff, but I'm finding the Eclipse interface a bit
confusing here.

Thanks for any help.

--
Steve.
Re: Where do I put the JAR? [message #156925 is a reply to message #156839] Thu, 15 June 2006 01:59 Go to previous messageGo to next message
Bill Winspur is currently offline Bill WinspurFriend
Messages: 180
Registered: July 2009
Senior Member
Steve Folly wrote:
> Hi,
>
> Using Eclipse 3.1 on OS X 10.4.6, I have a Dynamic Web Project running on a
> Tomcat 5.5 server. I'm using the FileUpload library from Apache within my
> application.
>
> I'm confused as to where I should put the jar file? I can specify an
> External JAR in the Java Build Path so my code compiles cleanly. But the jar
> file is outside of the project folder way off in wherever I downloaded it
> to, and then the app doesn't run because the server can't see it at runtime.
>
> Could I import the jar file? Where is the best place to I import it to?
>
> And I assume I also need to specify it in the J2EE Module Dependencies - how
> does the list in 'Add JARs...' get populated; my list is empty?
>
> Help - this is all really confusing! I'm just a few months into Java, and I
> understand classpaths-n-stuff, but I'm finding the Eclipse interface a bit
> confusing here.
>
> Thanks for any help.
If you are talking about an archive you created, containing web.xml and
the WEB-INF directory, that is a web-app aka servlet, and should have
the .war extension (web archive), not jar. If not, I do not know what
jar you are referring to.

On a vanilla tomcat configuration .war files usually go into webapps/,
relative to the tomcat installation root. You will also need to set up a
context element xml-fragment for the app (determines the name xxx in
http://localhost/xxx, at which the app can be invoked). The context
element xml-fragment file is placed in the
$CATALINA_HOME/CONF/[enginename]/[hostname]/ directory. Consult the
tomcat docs at http://jakarta.apache.org/tomcat for details on exactly
how to set tomcat up.

Hope this is relevant to your question,
Bill.
Re: Where do I put the JAR? [message #156940 is a reply to message #156925] Thu, 15 June 2006 05:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse.spfweb.co.uk

On 15/6/06 02:59, in article e6qeua$qpv$1@utils.eclipse.org, "Bill Winspur"
<bwinspur@wynnon.com> wrote:

> Steve Folly wrote:
>> Hi,
>>
>> Using Eclipse 3.1 on OS X 10.4.6, I have a Dynamic Web Project running on a
>> Tomcat 5.5 server. I'm using the FileUpload library from Apache within my
>> application.
>>
>> I'm confused as to where I should put the jar file? I can specify an
>> External JAR in the Java Build Path so my code compiles cleanly. But the jar
>> file is outside of the project folder way off in wherever I downloaded it
>> to, and then the app doesn't run because the server can't see it at runtime.
>>
>> Could I import the jar file? Where is the best place to I import it to?
>>
>> And I assume I also need to specify it in the J2EE Module Dependencies - how
>> does the list in 'Add JARs...' get populated; my list is empty?
>>
>> Help - this is all really confusing! I'm just a few months into Java, and I
>> understand classpaths-n-stuff, but I'm finding the Eclipse interface a bit
>> confusing here.
>>
>> Thanks for any help.
> If you are talking about an archive you created, containing web.xml and
> the WEB-INF directory, that is a web-app aka servlet, and should have
> the .war extension (web archive), not jar. If not, I do not know what
> jar you are referring to.

I was talking about commons-fileupload-1.1.1.jar.

Basically, where is the best place to put commons-fileupload-1.1.1.jar so
that I can

a) Compile everything that uses it, and
b) Dependencies are resolved at runtime.

And, which actions in Eclipse do I use to best manage this? E.g. Do I have a
'3rd-party-jars' directory at the same level as my 'src' folder? Do I import
commons-fileupload-1.1.1.jar into it?

Do I just reference it using Add External JARs in the Java Build Path
properties?

I hope this makes the question clearer.

--
Regards,
Steve.
Re: Where do I put the JAR? [message #156991 is a reply to message #156839] Thu, 15 June 2006 13:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cburgess.progressrail.com

Steve Folly wrote:
> Hi,
>
> Using Eclipse 3.1 on OS X 10.4.6, I have a Dynamic Web Project running on a
> Tomcat 5.5 server. I'm using the FileUpload library from Apache within my
> application.
>
> I'm confused as to where I should put the jar file? I can specify an
> External JAR in the Java Build Path so my code compiles cleanly. But the jar
> file is outside of the project folder way off in wherever I downloaded it
> to, and then the app doesn't run because the server can't see it at runtime.
>
> Could I import the jar file? Where is the best place to I import it to?
>
> And I assume I also need to specify it in the J2EE Module Dependencies - how
> does the list in 'Add JARs...' get populated; my list is empty?
>
> Help - this is all really confusing! I'm just a few months into Java, and I
> understand classpaths-n-stuff, but I'm finding the Eclipse interface a bit
> confusing here.
>
> Thanks for any help.
>


I've not used Tomcat via Eclipse before, but it seems like Tomcat will
have its own classpath settings that are separate from your Eclipse
project's Build Path. If you are able to configure Tomcat from an
Eclipse plugin, I'd look for classpath settings in there. Otherwise,
you probably have to dig into Tomcat's own launch configuration to see
how its classpath is set up.

I'm confident that Bill has it right in that the settings are part of
the XML files that Tomcat expects to find in its WEB-INF directory, but
again I don't know if a Tomcat-based project in Eclipse tries to handle
those settings for you or not.

When all else fails, there's always the nasty fix-a-flat method of
putting your 3rd party JARs in your JRE's /ext directory. This method
works most of the time, but has its issues... I _never_ do it unless I
have to solve a production issue quicker than I can solve the true
classpath problem causing the issue, and even then it will only be a
temporary fix until I do solve the classpath problem the right way.
Re: Where do I put the JAR? [message #157052 is a reply to message #156940] Thu, 15 June 2006 20:45 Go to previous message
Bill Winspur is currently offline Bill WinspurFriend
Messages: 180
Registered: July 2009
Senior Member
Steve Folly wrote:
> On 15/6/06 02:59, in article e6qeua$qpv$1@utils.eclipse.org, "Bill Winspur"
> <bwinspur@wynnon.com> wrote:
>
>
>>Steve Folly wrote:
>>
>>>Hi,
>>>
>>>Using Eclipse 3.1 on OS X 10.4.6, I have a Dynamic Web Project running on a
>>>Tomcat 5.5 server. I'm using the FileUpload library from Apache within my
>>>application.
>>>
>>>I'm confused as to where I should put the jar file? I can specify an
>>>External JAR in the Java Build Path so my code compiles cleanly. But the jar
>>>file is outside of the project folder way off in wherever I downloaded it
>>>to, and then the app doesn't run because the server can't see it at runtime.
>>>
>>>Could I import the jar file? Where is the best place to I import it to?
>>>
>>>And I assume I also need to specify it in the J2EE Module Dependencies - how
>>>does the list in 'Add JARs...' get populated; my list is empty?
>>>
>>>Help - this is all really confusing! I'm just a few months into Java, and I
>>>understand classpaths-n-stuff, but I'm finding the Eclipse interface a bit
>>>confusing here.
>>>
>>>Thanks for any help.
>>
>>If you are talking about an archive you created, containing web.xml and
>>the WEB-INF directory, that is a web-app aka servlet, and should have
>>the .war extension (web archive), not jar. If not, I do not know what
>>jar you are referring to.
>
>
> I was talking about commons-fileupload-1.1.1.jar.
>
> Basically, where is the best place to put commons-fileupload-1.1.1.jar so
> that I can
>
> a) Compile everything that uses it, and
> b) Dependencies are resolved at runtime.
>
> And, which actions in Eclipse do I use to best manage this? E.g. Do I have a
> '3rd-party-jars' directory at the same level as my 'src' folder? Do I import
> commons-fileupload-1.1.1.jar into it?
>
> Do I just reference it using Add External JARs in the Java Build Path
> properties?
>
> I hope this makes the question clearer.
>
I usually set up a lib directory under the project root and put any
extra jars I need into it. You could just put them under the proj
root, but I find that cluttered, particularly if you are using the
jwsdk. I also wrote a very simple ant build script to upload the latest
copies of my changeable libed jars automatically on every build. Its not
very efficient I suppose, but it does not noticably delay a code > build
> test cycle.

If you the use ext jars approach, your project becomes less
portable but you dont have to copy them if they change.

Bill.
Previous Topic:Using Eclipse with multiple systems
Next Topic:error!!!!!!
Goto Forum:
  


Current Time: Tue Jul 16 12:55:43 GMT 2024

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

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

Back to the top