2

Really basic question I'm sure for some of you Java heads out there.

I have a list of java files and jars that are required.

On windows to build I have this batch file

javac -cp .;opencsv-1.8.jar;mysql-connector.jar -source 1.4 -target 1.4 *.java
jar cvf cup.jar *.class
del *.class

If I want to do the same thing on mac how would a write a shell script to do the same?

1 Answer 1

9

Basically the same thing, except

  1. The path separator is ':' instead of ';'
  2. I believe the command to delete is called 'rm'

Also, I'd put a shabang at the start.

So:

#!/bin/sh
javac -cp .:opencsv-1.8.jar:mysql-connector.jar -source 1.4 -target 1.4 *.java
jar cvf cup.jar *.class
rm *.class
Sign up to request clarification or add additional context in comments.

2 Comments

Yup, forgot the bang part of the shabang.
Thanks, the ':' in the path separator was the one catching me out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.