Scala trouble accessing Java methods

試著忘記壹切 提交于 2019-12-05 18:42:29

I never encountered such problems, and you probably checked your configuration and everything else twice, so I would guess this is some Eclipse related build issue. You should try to build from the command line in order to see whether Scala or Eclipse is the problem.

Is it possible for you to run a test against the class just to see if you got the right one?

p.getClass.getMethods

... and if possible (may run into NPE) in order to find the source:

p.getClass.getProtectionDomain.getCodeSource.getLocation.getPath

When compiling the Scala class, do something like this:

scalac *.scala *.java

This way, Scala will look a the Java code to see what is available. If, however, the Java code is already compiled and provided as a jar file, just add it to the classpath used when compiling the Scala code.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!