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

Posted on 2013-10-21
Medium Priority
Last Modified: 2013-10-21
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

Open in new window

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

Open in new window

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

tcsh runGUI.sh

Open in new window

What am I missing?
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)?

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.
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

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,
LVL 86

Expert Comment

ID: 39589594

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.

Join & Write a Comment

This article is in regards to the Cisco QSFP-4SFP10G-CU1M cables, which are designed to uplink/downlink 40GB ports to 10GB SFP ports. I recently experienced this and found very little configuration documentation on how these are supposed to be confi…
This article explains the fundamentals of industrial networking which ultimately is the backbone network which is providing communications for process devices like robots and other not so interesting stuff.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question