Skip to main content



      Home
Home » Newcomers » Newcomers » Help exporting to JAR file
Help exporting to JAR file [message #74028] Sun, 05 June 2005 13:35 Go to next message
Eclipse UserFriend
Originally posted by: lmcoon_nospam.cox.net

I'm using Eclipse 3.0.2 in Windows, and I'm trying to
export a project to a JAR file. The project relies on
JDBC, which uses a JAR file called jconn2.jar. I'm
trying (and failing) to have jconn2.jar exported as
part of the JAR file for my project. I don't know
whether I went wrong with the way I added jconn2.jar to
my project, the way I'm exporting it, or both.
Hopefully someone can tell me what I did wrong. Sorry
for the long-winded explanation.

In Eclipse, in the package explorer, I created a folder
called "lib". In lib, I did Import/From File System,
navigated to jconn2.jar, and opened it. At this point,
under my Project I see "lib" and under "lib" I see
"jconn2.jar."

Under my project properties, under Java Build Path/
Libraries, I did "Add JARs", navigated to lib/jconn2.jar,
and did OK. I verified that my project has correctly
added the JAR by running my app, and my app runs file.
So I know it's seeing & using jconn2.jar. (Note: when
I added jconn2.jar to the build path, it no longer
appears in the package explorer under the "lib" folder.
It's now directly under the project folder. Is this
right?)

Note: My project also contains an "images" directory with
a couple .gif files, which it uses just fine.

As further verification, I went to the O/S, verified that
the lib directory exists under my project directory, and
that it contains jconn2.jar.

Now I try to export to a JAR. I do File/Export/JAR file.
My project is checked under "Select the resources to
export." When I open it up, I can see my project, as well
as the two folders I created, "images" and "lib". Under
"images" I can see my two .gif files, both checked. Under
my project, package, I can see all my Java classes. But
under lib, nothing appears -- jconn2.jar does not show up.

Thinking maybe it throws jconn2.jar in there anyway, I go
ahead and create the JAR file, then open it up with WinZip.
As I suspected, jconn2.jar is not there.

So...am I associating jconn2.jar with my project incorrectly,
am I creating the JAR file incorrectly, or both? I'd
appreciate anybody pointing out where I went wrong. TIA.
Re: Help exporting to JAR file [message #75051 is a reply to message #74028] Tue, 07 June 2005 23:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

Jar files must be on your classpath not within other jar files. You need to
include the jconn2.jar file in the classpath that you use to run your
application.

"Larry Coon" <lmcoon_nospam@cox.net> wrote in message
news:42A337E9.22ED@cox.net...
> I'm using Eclipse 3.0.2 in Windows, and I'm trying to
> export a project to a JAR file. The project relies on
> JDBC, which uses a JAR file called jconn2.jar. I'm
> trying (and failing) to have jconn2.jar exported as
> part of the JAR file for my project. I don't know
> whether I went wrong with the way I added jconn2.jar to
> my project, the way I'm exporting it, or both.
> Hopefully someone can tell me what I did wrong. Sorry
> for the long-winded explanation.
>
> In Eclipse, in the package explorer, I created a folder
> called "lib". In lib, I did Import/From File System,
> navigated to jconn2.jar, and opened it. At this point,
> under my Project I see "lib" and under "lib" I see
> "jconn2.jar."
>
> Under my project properties, under Java Build Path/
> Libraries, I did "Add JARs", navigated to lib/jconn2.jar,
> and did OK. I verified that my project has correctly
> added the JAR by running my app, and my app runs file.
> So I know it's seeing & using jconn2.jar. (Note: when
> I added jconn2.jar to the build path, it no longer
> appears in the package explorer under the "lib" folder.
> It's now directly under the project folder. Is this
> right?)
>
> Note: My project also contains an "images" directory with
> a couple .gif files, which it uses just fine.
>
> As further verification, I went to the O/S, verified that
> the lib directory exists under my project directory, and
> that it contains jconn2.jar.
>
> Now I try to export to a JAR. I do File/Export/JAR file.
> My project is checked under "Select the resources to
> export." When I open it up, I can see my project, as well
> as the two folders I created, "images" and "lib". Under
> "images" I can see my two .gif files, both checked. Under
> my project, package, I can see all my Java classes. But
> under lib, nothing appears -- jconn2.jar does not show up.
>
> Thinking maybe it throws jconn2.jar in there anyway, I go
> ahead and create the JAR file, then open it up with WinZip.
> As I suspected, jconn2.jar is not there.
>
> So...am I associating jconn2.jar with my project incorrectly,
> am I creating the JAR file incorrectly, or both? I'd
> appreciate anybody pointing out where I went wrong. TIA.
Re: Help exporting to JAR file [message #76058 is a reply to message #75051] Thu, 09 June 2005 10:21 Go to previous message
Eclipse UserFriend
Originally posted by: lcnospam.assist.org

David Wegener wrote:

> Jar files must be on your classpath not within other jar files. You need to
> include the jconn2.jar file in the classpath that you use to run your
> application.

David,

Thanks for the reply. I was under the impression that if my app
required a library, which in this case is in a .jar file, I could
simply make a lib directory, stick the .jar file in it, and export
it along with the rest of my app, with the manifest file containing
a "Class-Path:" line pointing to it. I guess that impression was
mistaken?

So what is the best practice for doing what I want to do? Require
each client to installl the library & point their classpath to it
individually?
Previous Topic:Cannot type close braces in the editor
Next Topic:Run Application
Goto Forum:
  


Current Time: Tue Jul 22 14:05:12 EDT 2025

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

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

Back to the top