Error while trying to use auto-complete with Scala: java.lang.NoClassDefFoundError: scala/tools/nsc/util/SourceFile

427 views
Skip to first unread message

Shaun

unread,
May 26, 2013, 4:21:17 PM5/26/13
to eclim...@googlegroups.com
Hi,

I'm running Eclipse 4.2.2 with Eclim 2.2.6 and Scala IDE for Eclipse 3.0.0.v-2_10-201303191408-1e64c72 and MacVim snapshot 65 on OS X 10.8.3 and I'm having some trouble using auto-complete with Scala. Auto-complete works as expected when I'm editing Java through Eclim and it works with Scala within Eclipse's editor, the only combination that doesn't work is auto-completing Scala within vim using Eclim. When I try to do so, in any context, I get this error message:

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NoClassDefFoundError: scala/tools/nsc/util/SourceFile)
while executing command (port: 9091): -editor vim -command scala_complete -p "ScalaTest" -f "src/scala/scalatest/__eclim_temp_Test.scala" -o 74 -e utf
-8 -l standard

I'm not sure I'm missed something extra I need to do to get Eclim working with Scala which I don't need with Java? Any help is greatly appreciated.

Thanks,
Shaun

Eric Van Dewoestine

unread,
May 30, 2013, 9:31:11 AM5/30/13
to eclim...@googlegroups.com
It appears that between scala 2.9 and 2.10, the SourceFile class was
moved from one package to another. Eclim doesn't reference that class
directly in its code anywhere, but it uses a scala-ide call which
does, and it seems that during compilation that this indirect
reference is pulled into the java byte code for eclim's scala
completion command. When compiling against 2.10 it would seem that the
scala compiler takes care of translating the old SourceFile location
to the new location and spits out a warning in the process. When
compiling against 2.9, the resulting byte code will continue to
reference the old location.

The issue seems to be that I built the eclim distribution against
2.9 thinking that building against the earlier scala version would
result in byte code that would work in both 2.9 and 2.10. Manually
moving the compiled plugins from an eclipse install with 2.9 to one
with 2.10 seemed to validate that theory, but when I install eclim
using the installer, I run into the same issue you have.

I really want to avoid creating a proliferation of eclim installers.
Having 2 (1 for juno+ and 1 for indigo) is painful enough, so I
want to avoid doubling that to 4 (1 for 2.9 and 1 for 2.10 for each
eclipse version). I'll try to come up with a reasonable way to solve
this.

To work around the issue today, I'm afraid you'll have to build eclim
from source so that it will compile against the 2.10 version of scala
in your eclipse install.

--
eric

Shaun

unread,
May 30, 2013, 10:58:29 AM5/30/13
to eclim...@googlegroups.com
Okay, thanks for the help. I'll try compiling Eclipse from source.
Reply all
Reply to author
Forward
0 new messages