2011年12月5日月曜日

groovy 実行コードのパスを求める

定期的なオペレーションに使っていたgroovy scriptが動かない、、、。
htmlunitに付属するxm-api.jarが何処かとぶつかっているみたいで、同様のトラブルはgoogle
すると結構見つかる。 バージョン(javaも含めて)によりclassが衝突を起こす、という事の
様で、「不要なパッケージを消す」事で対応している様です。 さー、cron起動のスクリプトの
classpathを何処で指定しようか、、、。

How can I access the path of the script file from within the script?
(後で役立つかもしれないので)

scriptDir
= new File(getClass().protectionDomain.codeSource.location.path).parent
scriptFile
= getClass().protectionDomain.codeSource.location.path

println scriptDir
println scriptFile

0 件のコメント:

RM Noise

最近Galaxyの携帯のCMで風のノイズ除去をしているシーンが気になっていて、「AIで処理すれば、ノイズ除去性能は上がるのでは?」なんて思いながら、 AIのopen source?の Hagging face をブラブラしていましたら、何故かFacebookで RM noize ...