English 中文(简体)
Class-path in manifest not read when running jar in Unix
原标题:

I have a client application that needs to run on Unix. It works fine in Windows but i get a NoClassDefFound exception in unix. Here s my manifest file:

Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.5 Created-By: 2.3 (IBM Corporation) Main-Class: com.main.Client Class-Path: lib/commons-lang-2.3.jar lib/commons-io-1.3.2.jar lib/comm ons-logging-api-1.1.jar lib/log4j-1.2.12.jar

And the Client.jar structure:

com com/main lib meta-inf

To run it, i use the command below:

$JAVA_HOME/jre/bin/java -jar Client.jar

It works fine in windows. Somehow i think that its not reading the manifest right. Help please! Thanks!

问题回答

Maybe because your meta-inf folder is in lower-case?

One way is to make sure you have defined your CLASSPATH variable for the user that is running the program.

$ echo $CLASSPATH

if there is nothing shown from the above, then export it

$ export CLASSPATH="/lib/commons-lang-2.3.jar:/your/other/paths"




相关问题
Generate assembler code from C file in linux

I would like to know how to generate assembler code from a C program using Unix. I tried the gcc: gcc -c file.c I also used firstly cpp and then try as but I m getting errors. I m trying to build an ...

Function to create the array by reading the file

I am creating scripts which will store the contents of pipe delimited file. Each column is stored in a separate array. I then read the information from the arrays and process it. There are 20 pipe ...

Compare characters at the end of the string C++

This program supposed to find command line arguments entered on Unix which ends with “.exe”. For some reason it doesn t work. Here is the code: int main( int argc, char* argv[] ) { for ( int ...

Batch Job Dependencies Using Open Source/Free Software

I run a large data warehouse plant where we have a lot of nightly jobs running concerruently however many have dependencies on a extract or data load process before they start. Currently we use an ...

Writing application for both Unix and Windows

I ll write a program for Interactive UNIX (http://en.wikipedia.org/wiki/INTERACTIVE_UNIX). But in a year it will be ported to Windows. I ll write it in ANSI C and/or SH-script. When it runs on Windows ...

Development Environment in Windows [closed]

What are your recommendations for setting up a development environment in Windows, especially when not using an IDE. I am attempting to familiarize myself with Windows, and I feel a bit lost. What ...

热门标签