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 件のコメント:

温湿度モニター(続き) 

バッテリの充電をしても直ぐに止まってしまうので、止む無く回収修理することにしました。しかし、5年前の物で入手できるものは既になく、今更 ESP8266 でもないので ESP32-S3 , SHT45 で作り直してみることにしました。 ESP32と言っても色々あるので、 deep ...