Skip to main content



      Home
Home » Newcomers » Newcomers » classpath trouble with my .jar
classpath trouble with my .jar [message #227595] Wed, 15 August 2007 17:07 Go to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

Hi,

I'm new at eclipse and I'm trying to create a .jar file that needs two
other different .jars to work well, jbcl.jar for borland layouts igot from
jBuilder, and mysqlConector.jar, for comunication with a data base in
mySql.

I have JDK 1.6 and i'm working at a 6.0 compliance level, I usually
execute my jars directly from windows, but with eclipse they don't work, I
have my java build path configured, but it seems like it doesn't go to the
manifest, my system classpath doesn't seem to work either, when I try
executing the jar from the console.

I do it like this:

java -cp "C:\Borland\JBuilder2005\lib\jbcl.jar" "C:\Archivos de
programa\Java\mysqlConnector\mysqlConnector.jar" -jar admin.jar

and when I try to modify the manifest directly there is a problem and
eclipse tells me that it couldn't generate the jar file because the
manifest is not sincroniced with the application.

I change my manifest like this:

Manifest-Version: 1.0
Main-Class: main.Main
Class-Path: "C:\Borland\JBuilder2005\lib\jbcl.jar" "C:\Archivos de
programa\Java\mysqlConnector\mysqlConnector.jar"

Can any body help me with this? I'm kind of lost. :(

Thanks
Re: classpath trouble with my .jar [message #227667 is a reply to message #227595] Wed, 15 August 2007 21:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

No ideas? anyone? pleaseeeeeeeeee?
Re: classpath trouble with my .jar [message #227672 is a reply to message #227595] Wed, 15 August 2007 22:11 Go to previous messageGo to next message
Eclipse UserFriend
Ana wrote:
> Hi,
>
> I'm new at eclipse and I'm trying to create a .jar file that needs two
> other different .jars to work well, jbcl.jar for borland layouts igot
> from jBuilder, and mysqlConector.jar, for comunication with a data base
> in mySql.
>
> I have JDK 1.6 and i'm working at a 6.0 compliance level, I usually
> execute my jars directly from windows, but with eclipse they don't work,
> I have my java build path configured, but it seems like it doesn't go to
> the manifest, my system classpath doesn't seem to work either, when I
> try executing the jar from the console.
>
> I do it like this:
>
> java -cp "C:\Borland\JBuilder2005\lib\jbcl.jar" "C:\Archivos de
> programa\Java\mysqlConnector\mysqlConnector.jar" -jar admin.jar
>
> and when I try to modify the manifest directly there is a problem and
> eclipse tells me that it couldn't generate the jar file because the
> manifest is not sincroniced with the application.
>
> I change my manifest like this:
>
> Manifest-Version: 1.0
> Main-Class: main.Main
> Class-Path: "C:\Borland\JBuilder2005\lib\jbcl.jar" "C:\Archivos de
> programa\Java\mysqlConnector\mysqlConnector.jar"
>
> Can any body help me with this? I'm kind of lost. :(
>
> Thanks
>
>
>
You want both jbcl.jar and mysqlConnector.jar on the classpath, right?
Try

java -cp "c:\...\jbcl.jar;c:\...\mysqlConnector.jar;admin.jar" main.Main

and see if that works. Note that I put the program jar file in the
classpath, and that class path entries are separated by semicolons.
(Fill in the ellipsis, of course; I just put ... because I'm lazy.)

/Paul
Re: classpath trouble with my .jar [message #227680 is a reply to message #227672] Wed, 15 August 2007 22:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

Thanks for answering, the thing is that what I'm trying to do is to get
the jar file from eclipse to have all the classpath configuration rigth,
so I can run the program from out side eclipse as a program.

I'm kind of new at eclipse so I don't know what I'm doing wrong.

have you made a jar from eclipse?

Thanks
Re: classpath trouble with my .jar [message #227725 is a reply to message #227680] Thu, 16 August 2007 07:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Ana,

For the Bundle-Classpath, when the are multiple entries, they are comma
separated, so maybe that same applies here.


Ana wrote:
> Thanks for answering, the thing is that what I'm trying to do is to
> get the jar file from eclipse to have all the classpath configuration
> rigth, so I can run the program from out side eclipse as a program.
>
> I'm kind of new at eclipse so I don't know what I'm doing wrong.
>
> have you made a jar from eclipse?
>
> Thanks
>
Re: classpath trouble with my .jar [message #227761 is a reply to message #227725] Thu, 16 August 2007 10:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

I don't see where in Eclipse I can place the classpaths separated with
comas to make my jar, where do you put them for plugins?
Re: classpath trouble with my .jar [message #227774 is a reply to message #227761] Thu, 16 August 2007 10:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Ana,

You said you edit the MANIFEST.MF directly. For a plugin project, the
PDE's editor lets you edit the MANIFEST.MF via a nice forms page and if
you add multiple classpaths it comma separates them so I was just
hypothesizing that the same syntax might apply in your case. I could be
wrong...


Ana wrote:
> I don't see where in Eclipse I can place the classpaths separated with
> comas to make my jar, where do you put them for plugins?
>
Re: classpath trouble with my .jar [message #227781 is a reply to message #227774] Thu, 16 August 2007 10:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

Thanks!!! it works!!! now I can make my jar with its classpaths!!!, but
the jar file still doesn't work.

when I run it from the console like this: java -jar admin.jar it tells me
java.lang.NoClassDefFoundError: com/borland/jbcl/layout/XYLayout but I
thougth that with the jbcl.jar classpath in the manifest of the jar this
would be fixed.

Any more ideas?

Thanks
Re: classpath trouble with my .jar [message #227788 is a reply to message #227781] Thu, 16 August 2007 10:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Ana,

Again, this is just a theory, but for the Bundle-Classpath, one usually
puts "." as the first entry so that the classes within the jarred plugin
itself will be searched as well as the other libraries that are listed
there.


Ana wrote:
> Thanks!!! it works!!! now I can make my jar with its classpaths!!!,
> but the jar file still doesn't work.
>
> when I run it from the console like this: java -jar admin.jar it tells
> me java.lang.NoClassDefFoundError: com/borland/jbcl/layout/XYLayout
> but I thougth that with the jbcl.jar classpath in the manifest of the
> jar this would be fixed.
>
> Any more ideas?
>
> Thanks
>
Re: classpath trouble with my .jar [message #227795 is a reply to message #227788] Thu, 16 August 2007 11:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

Hi, it didn't work, maybe its something in the configuration of my
computer, do you put the "." ont the system classpath?
Re: classpath trouble with my .jar [message #227798 is a reply to message #227795] Thu, 16 August 2007 11:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

You know, its like it doesn't see the class even thouth it its referenced
in the class-path....
Re: classpath trouble with my .jar [message #227872 is a reply to message #227798] Thu, 16 August 2007 15:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Ana,

You're sure the classes have the right paths within the jar?


Ana wrote:
> You know, its like it doesn't see the class even thouth it its
> referenced in the class-path....
Re: classpath trouble with my .jar [message #228011 is a reply to message #227872] Fri, 17 August 2007 09:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

I've got my import like:

import com.borland.jbcl.layout.XYLayout;

inside the borland jar jbcl.jar the first folder its com and its followed
by borland, jbcl, layout and finally the XYLayout class its there.

I don't know why it doesn't sees it, but I think its not Eclipse I tried
compiling from outside Eclipse and I got the same problem I compiled my
jar like this:

jar cfm admin.jar -C classes .

and I got the same problem

this is my manifest:

Manifest-Version: 1.0
Main-Class: main.Main
Class-Path: "." "C:/Borland/JBuilder2005/lib/jbcl.jar" "C:/Archivos de
programa/Java/mysqlConnector/mysqlConnector.jar"

Do you see something missing?

Thanks,

Ana
Re: classpath trouble with my .jar [message #228026 is a reply to message #228011] Fri, 17 August 2007 10:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Ana,

What do the contents of the jar look like? I thought you needed commas,
but I guess not?

Ana wrote:
> I've got my import like:
>
> import com.borland.jbcl.layout.XYLayout;
>
> inside the borland jar jbcl.jar the first folder its com and its
> followed by borland, jbcl, layout and finally the XYLayout class its
> there.
>
> I don't know why it doesn't sees it, but I think its not Eclipse I
> tried compiling from outside Eclipse and I got the same problem I
> compiled my jar like this:
>
> jar cfm admin.jar -C classes .
>
> and I got the same problem
>
> this is my manifest:
>
> Manifest-Version: 1.0
> Main-Class: main.Main
> Class-Path: "." "C:/Borland/JBuilder2005/lib/jbcl.jar" "C:/Archivos de
> programa/Java/mysqlConnector/mysqlConnector.jar"
>
> Do you see something missing?
>
> Thanks,
>
> Ana
>
>
>
Re: classpath trouble with my .jar [message #228040 is a reply to message #228026] Fri, 17 August 2007 10:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

When I decompress it I see all my packages and inside them all my classes,
there's the META-INF folder with the manifest and it looks like this:

Manifest-Version: 1.0
Class-Path: "." "C:/Borland/JBuilder2005/lib/jbcl.jar" "C:/Archivos de
programa/Java/mysqlConnector/mysqlConnector.jar"
Created-By: 1.6.0 (Sun Microsystems Inc.)
Main-Class: main.Main

I guess they are ok, I didn't get any error messages creating the .jar so
I guess the "," its not needed.

Even thougth I wrote badly the jar instruction in my last post its really
like this:

jar cfm admin.jar manifest -C classes .
Re: classpath trouble with my .jar [message #228048 is a reply to message #228040] Fri, 17 August 2007 11:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Ana,

If you change it to use just a dot, does it at least find your classes?
If you remove the quotes, does it work then? If you try to add just the
first additional jar with a comma separator, does that work. Maybe a
semicolon separator would make it happier.


Ana wrote:
> When I decompress it I see all my packages and inside them all my
> classes, there's the META-INF folder with the manifest and it looks
> like this:
>
> Manifest-Version: 1.0
> Class-Path: "." "C:/Borland/JBuilder2005/lib/jbcl.jar" "C:/Archivos de
> programa/Java/mysqlConnector/mysqlConnector.jar"
> Created-By: 1.6.0 (Sun Microsystems Inc.)
> Main-Class: main.Main
>
> I guess they are ok, I didn't get any error messages creating the .jar
> so I guess the "," its not needed.
>
> Even thougth I wrote badly the jar instruction in my last post its
> really like this:
>
> jar cfm admin.jar manifest -C classes .
>
>
>
Re: classpath trouble with my .jar [message #228056 is a reply to message #228048] Fri, 17 August 2007 11:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

I has always seen all my classes, it finds the main and goes through the
program well, it just doesn't find the ones in the jbcl.jar.

When I remove the "" things got worst, because it cuts the jar path at the
spaces, and actually the "." doesn't seem to do much but it doesn't do any
harm eigther so I left it there.

Its like it can't deconpress the external jar files ??
Re: classpath trouble with my .jar [message #228064 is a reply to message #228056] Fri, 17 August 2007 11:55 Go to previous messageGo to next message
Eclipse UserFriend
Ana wrote:
> I has always seen all my classes, it finds the main and goes through the
> program well, it just doesn't find the ones in the jbcl.jar.
>
> When I remove the "" things got worst, because it cuts the jar path at
> the spaces, and actually the "." doesn't seem to do much but it doesn't
> do any harm eigther so I left it there.
>
> Its like it can't deconpress the external jar files ??

Do you know for sure that it finds the mysqlConnector classes? I wasn't
aware that you could specify a class path in separate strings; I thought
it had to be all one string (using semicolons as separators with
Windows, colons with Linux).

/Paul
Re: classpath trouble with my .jar [message #228100 is a reply to message #228064] Fri, 17 August 2007 12:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

I it didn't sees the mySqlConector.jar either I tried using one of its
classes before and didn't work.

I think the ; and the : are needed in the console classpath but not in the
manifest classpath, but they don't do any damage either the only thing its
that you have to edit the manifest from inside Eclipse for it to let you
include it in its jars.

The console classpath doesn't work for me either, when I use it I get the
same error, and it is the same with the System variable classpath, but I
think it does read it because when I have mistakes in the "" it tells me
it can't find the path I wrote.

Its like it found the jar but didn't look inside of it, because the thing
it says it can not find its the com/borland/jbcl/layout/XYLayout not the
path to the jar.

weird ah?

thanks
Re: classpath trouble with my .jar [message #228136 is a reply to message #228100] Fri, 17 August 2007 20:24 Go to previous message
Eclipse UserFriend
Originally posted by: afrancoc2000.hotmail.com

Hi guys,

I know now what was wrong, I'm using an absolute path in the class-path at
the manifest and it has to be a relative one, so it never finds the jars
it needs.

ChuckBing at the java forums find it out!!

Thank you all you've been great,

Ana
Previous Topic:No class files exported in JAR!
Next Topic:please help
Goto Forum:
  


Current Time: Sun Jun 01 03:54:05 EDT 2025

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

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

Back to the top