Pedro Neves
Pedro Neves

Reputation: 374

JAR that calls another JARs

I'm having some problems with some commands in Java. I created a JAR that needs another JARs to run my app. I had created a batch file to run it with just a click:

java -cp Projecto.jar;.\jcommon-1.0.17.jar;.\jfreechart-1.0.14.jar Geral.Client  
pause

How can I modify this to make a runable for Linux and Mac OS? Because the command:

java -cp Projecto.jar;.\jcommon-1.0.17.jar;.\jfreechart-1.0.14.jar Geral.Client

as far as I tried does not work in Linux.

Upvotes: 0

Views: 134

Answers (3)

Alexei Kaigorodov
Alexei Kaigorodov

Reputation: 13535

try to change slashes: \ to /.

Upvotes: 0

Wins
Wins

Reputation: 3460

You need to replace all semicolons (;) to colon (:) and all back-slash (\) to forward-slash(/)

Upvotes: 0

BalusC
BalusC

Reputation: 1108742

The path separator in Unix based operating systems is colon :, not semicolon ;. Also the file separator in Unix based operating systems is forwardslash /, not backwardslash \.

So this should do:

java -cp Projecto.jar:./jcommon-1.0.17.jar:./jfreechart-1.0.14.jar Geral.Client

Upvotes: 1

Related Questions