Solved

# How to run Java project in a jar file on Unix from a shell script?

Posted on 2013-10-21
Medium Priority
1,260 Views
Hi,
I have a Java project in Eclipse and I created a runnable jar file.

Then on Windows, I created a batch file as the following:

set CLASSPATH=%CLASSPATH%;\\some\path\to\a\directory\GUI-ext
java -jar \\some\path\to\a\directory\CSGUI10.jar


And it works fine on Windows.

Now, I try to do the same thing on Unix using tcsh and I have this runGUI.sh.sh file:

setenv CLASSPATH /some/path/to/a/directory/GUI-ext/
java -jar /some/path/to/a/directory/GUI-ext/CSGUI10.jar


When I type the following command nothing happens. The GUI does not start:

tcsh runGUI.sh


What am I missing?
0
Question by:Tolgar
• 3
• 2

LVL 86

Expert Comment

ID: 39589357
Well the two classpath settings are different in kind. The Unix one sets a wholly new one where the Windows one appends

Are you sure the second one only contains class files (not jars)?
0

Author Comment

ID: 39589411
I set it this way because my \$CLASSPATH is not defined in the beginning on Unix. By doing this I temporarily solve the undefined problem.

The class paths that I add are the same both on Unix and Windows.
0

LVL 86

Accepted Solution

CEHJ earned 1000 total points
ID: 39589435
I'm not really familiar with that shell. I would try a test class first before the real app

It's possible that there's actually nothing wrong with the csh script (looks ok to me) and that the problem lies elsewhere
0

Author Comment

ID: 39589575
ok. I solved the problem. It was about the jre version and the swt library that I use.

Now it works. Thanks,
0

LVL 86

Expert Comment

ID: 39589594
:)
0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.