Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use jarjar from the command-line?

I'm having trouble using jarjar from the command-line to combine a simple Scala program with the scala runtime-library.

jarjar correctly detects the dependency:

$ java -jar ~/Desktop/saug/jarjar-1.0.jar find jar BCT.jar scala-library.jar
/home/schani/Work/scala/bct/BCT.jar -> /home/schani/Work/scala/bct/scala-library.jar

Combining them doesn't work, however:

$ CLASSPATH=./scala-library.jar java -jar ~/Desktop/saug/jarjar-1.0.jar process rules.jjl BCT.jar BCTS.jar

The jar file that I get still depends on scala-library.jar. Whether or not I add the CLASSPATH variable makes no difference. My rules.jjl file looks like this:

keep BCT

What to do?

like image 871
Mark Probst Avatar asked Nov 15 '22 14:11

Mark Probst


1 Answers

Using the java "-jar" option ignores the classpath. Try specifying the main class explicitly with a classpath, and omit "-jar":

java -cp ~/Desktop/saug/jarjar-1.0.jar:./scala-library.jar com.tonicsystems.jarjar.Main process rules.jjl BCT.jar BCTS.jar
like image 195
vdichev Avatar answered Dec 20 '22 00:12

vdichev