Java – how to automatically load database jars in groovy without using the – CP switch?

I want to simplify the execution of groovy scripts to call Oracle databases How to add ojdbc jar to the default classpath so that I can run

groovy RunScript.groovy

replace

groovy -cp ojdbc5.jar RunScript.groovy

Solution

Excerpt from groovy recipes, which is automatically posted by Scott Davis/ The groovy / lib directory contains jars:

>Create in your login directory Groovy / lib > uncomment ${groovy_home} / conf / groovy starter The following lines in conf

load! {user.home} /. groovy / lib / *. Jar > copy the jar to be included to groovy / lib

It seems that for groovy 1.5 or later, you can get this by default (you don't need to edit CONF), just put the jar in the / lib directory

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>