Board index » jbuilder » java.exe -jar my.jar

java.exe -jar my.jar


2005-05-03 05:48:17 PM
jbuilder1
I have compressed my project and all dependency jars in my.jar archive.
If I run it like this from CMD line:
java.exe -jar my.jar
then an error occur saying that it can't find log4j's Logger class:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/log4j/Logger
I have included log4j package in my.jar, but the problem is that I don't
know how to specify where it is inside my.jar. I think -classpath param is
only for files on my disk (file system) and not inside my jar archive
(my.jar). I've tried this, but still the same error:
java.exe -classpath "lib/log4j-1.2.8.jar;lib/...other jars here..." -jar
my.jar
 
 

Re:java.exe -jar my.jar

I seem to recall, a few years ago when I tried to manually generate a
manifest for a jar file that I got the same error.
See java.sun.com/docs/books/tutorial/jar/manifest/appman.html
and note :- Warning: The text file must end with a new line or carriage
return.
If my memory is correct, this is what caused the problem for me.
Arth
"Petar Popara" <none>wrote in message
Quote

I have compressed my project and all dependency jars in my.jar archive.
If I run it like this from CMD line:

java.exe -jar my.jar

then an error occur saying that it can't find log4j's Logger class:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/log4j/Logger

I have included log4j package in my.jar, but the problem is that I
don't know how to specify where it is inside my.jar. I think -classpath
param is only for files on my disk (file system) and not inside my jar
archive (my.jar). I've tried this, but still the same error:

java.exe -classpath "lib/log4j-1.2.8.jar;lib/...other jars here..." -jar
my.jar

 

Re:java.exe -jar my.jar

Java cannot open jar files from inside of other jars. You have two
options - unjar log4j.jar and put its files into your jar (with your
manifest) or add Class-Path property into your jar file manifest and
ship two jar files.
- Alexey.
Petar Popara wrote:
Quote
I have compressed my project and all dependency jars in my.jar archive.
If I run it like this from CMD line:

java.exe -jar my.jar

then an error occur saying that it can't find log4j's Logger class:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/log4j/Logger

I have included log4j package in my.jar, but the problem is that I don't
know how to specify where it is inside my.jar. I think -classpath param is
only for files on my disk (file system) and not inside my jar archive
(my.jar). I've tried this, but still the same error:

java.exe -classpath "lib/log4j-1.2.8.jar;lib/...other jars here..." -jar
my.jar


 

{smallsort}

Re:java.exe -jar my.jar

Petar Popara wrote:
Quote
I have compressed my project and all dependency jars in my.jar archive.
If I run it like this from CMD line:

java.exe -jar my.jar

then an error occur saying that it can't find log4j's Logger class:

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/log4j/Logger

I have included log4j package in my.jar, but the problem is that I don't
know how to specify where it is inside my.jar. I think -classpath param is
only for files on my disk (file system) and not inside my jar archive
(my.jar). I've tried this, but still the same error:

java.exe -classpath "lib/log4j-1.2.8.jar;lib/...other jars here..." -jar
my.jar




I have something like your application and java CAN use a jar library
from inside your application jar. I'm using JBuilder Archive builder.
I've selected the Include All Dependencies option in Archive Builder.
Try this way..
 

Re:java.exe -jar my.jar

Quote
I have something like your application and java CAN use a jar library
from inside your application jar. I'm using JBuilder Archive builder. I've
selected the Include All Dependencies option in Archive Builder. Try this
way..
Yes, but I can't use it, because some .jars are signed. :(