将Scala应用程序作为Java应用程序运行
发布时间:2020-12-16 08:58:26 所属栏目:安全 来源:网络整理
导读:我正在尝试运行以下火箭发射应用程序: object HelloWorld { def main(args: Array[String]) { println("Hello World!") }} 直接从java这样: java -cp scala-library.jar HelloWorld (显然在用scala编译之后) 但得到以下错误: Exception in thread "main"
我正在尝试运行以下火箭发射应用程序:
object HelloWorld { def main(args: Array[String]) { println("Hello World!") } } 直接从java这样: java -cp scala-library.jar HelloWorld (显然在用scala编译之后) 但得到以下错误: Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld Caused by: java.lang.ClassNotFoundException: HelloWorld at java.net.URLClassLoader$1.run(Unknown Source) (...) Could not find the main class: HelloWorld. Program will exit. 我是否已经监督了我需要做些什么才能让它发挥作用? 解决方法
从
Java documentation:
添加.:(或.;在Windows上)到类路径的开头应该有效. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |