krish
krish

Reputation:

How to add external jars in batch file in Java

I have a java batch file consisting of 4 execution steps written for analyzing any Java application. In one of the steps, I'm adding few libs in classpath that are needed for my core application to run. If any of Java applications that I'm analyzing need specific jars, then how do I add them in the classpath mentioned in the batch file. Can this be done using JavaScripts ?

Upvotes: 1

Views: 2964

Answers (2)

tcurdt
tcurdt

Reputation: 15808

Just add them up front. The JVM loads them lazy-ly anyway. Also have a look here on the options how. (Also the comments)

Upvotes: 1

duffymo
duffymo

Reputation: 308793

I would say that you should have those core JARs available in the CLASSPATH of the script on start-up. I can't see why you'd want to repeatedly fetch those JARs and put them somewhere again and again.

Put those JARs in a/lib directory as part of your core app, add them to CLASSPATH in the script, and be done with it would be my advice.

Upvotes: 0

Related Questions