如何从命令行运行Groovy脚本作为Java?
发布时间:2020-12-14 16:35:56 所属栏目:大数据 来源:网络整理
导读:我正在尝试使用groovyc,但有些是不对的: echo println("Hello world") test.groovygroovy test.groovyHello worldgroovyc test.groovyjava -cp C:utilsgroovy-1.8.1embeddablegroovy-all-1.8.1.jar testError: Could not find or load main class testd
我正在尝试使用groovyc,但有些是不对的:
>echo println("Hello world") > test.groovy >groovy test.groovy Hello world >groovyc test.groovy >java -cp C:utilsgroovy-1.8.1embeddablegroovy-all-1.8.1.jar test Error: Could not find or load main class test >dir test.class ... 11/10/2011 02:54 PM 7,104 test.class 我失踪了什么 解决方法
当您使用-cp switch指定类路径时,其默认值(当前目录)将被覆盖,因此JVM找不到您的类.
将当前目录添加到classpath,一切正常: >java -cp C:utilsgroovy-1.8.1embeddablegroovy-all-1.8.1.jar;. test Hello,world (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 比较v-bind和v-model
- Delphi中取得程序版本号
- 'Could not convert variant of type (Array Byte) int
- 仅返回Perl 5.8.8中的替换匹配(是:Perl“p”正则表达式修饰
- delphi – 如何从用户的自然语言查询中选择FAQ条目?
- groovy 之 helloWorld
- vB.net DbHelper类(完整)
- perl – 如何在一个mojolicious路线上添加多个over方法?
- [bigdata-34] pyenv + anaconda 4.2 + python3.5+ ubuntu 1
- Perl Global符号需要显式包名称