Debugging Compiled Scala?

First off, I'm new to using IntelliJ, Java, and Scala so hopefully this is a trival issue I'm running up against. I'm using IntelliJ 10.0.3 and Scala 2.8.1.final and am having issues debugging compiled scala. I can debug scripts just fine. With compiled scala however, I'm getting the following error whenever I try to debug.

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:55456,suspend=y,server=n -classpath /System/Library/Java/Support/CoreDeploy.bundle/Contents/Resources/Java/deploy.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/dt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/javaws.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jconsole.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/management-agent.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/plugin.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/sa-jdi.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/alt-rt.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/alt-string.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/charsets.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/jsse.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/ui.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/apple_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/dnsns.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/localedata.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunjce_provider.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext/sunpkcs11.jar:/usr/local/scala-2.8.1.final/lib/scala-library.jar:/usr/local/scala-2.8.1.final/lib/scala-swing.jar:/usr/local/scala-2.8.1.final/lib/scala-dbc.jar:/Users/cin/Desktop/IntelliJ IDEA 10 CE.app/lib/idea.jar:/Users/cin/Desktop/IntelliJ IDEA 10 CE.app/lib/idea_rt.jar:. -javaagent:/Users/cin/Library/Caches/IntelliJIdea10CE/groovyHotSwap/gragent.jar -Dfile.encoding=UTF-8 Ex3
Connected to the target VM, address: '127.0.0.1:55456', transport: 'socket'
Exception in thread "main" java.lang.NoClassDefFoundError: IDEA
Caused by: java.lang.ClassNotFoundException: IDEA
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Disconnected from the target VM, address: '127.0.0.1:55456', transport: 'socket'


I had to explicitly add . to the classpath as the debugger couldn't find my class initially. I also tried to add idea.jar to classpath, but apparently that class isn't in there. I also verified this with jar -tf. Where is IDEA defined? Or is this a side-effect of another problem?

Thanks in advance.

5 comments
Comment actions Permalink

You should not need to add anything to the classpath explicitly, when you're running your application from IDEA.
Can you provide a description of how you've set up your project?

-tt

0
Comment actions Permalink

Are you trying to construct the java command line in a console? The error message suggests you are, and that you forgot to add quotes around the classpath.

java -classpath="/foo/path with spaces/abc.jar" ..

0
Comment actions Permalink

I installed Scala and the Scala plugin, then followed http://pro-thoughts.blogspot.com/2008/07/novice-scala-programmer-eclipse-vs_9647.html. I also referenced http://stackoverflow.com/questions/2668153/how-to-use-scala-in-intellij-idea-or-why-is-it-so-difficult-to-get-a-working-id to try to find a solution. I also have the modules and facets settings for the project pointing to the right compiler (the only scala compiler on this machine). I'm at a loss... :(

0
Comment actions Permalink

No, I'm just using Run->Debug. I only started editing the VM parameters when things weren't working.

EDIT:
I just ran through the steps provided at http://confluence.jetbrains.net/display/SCA/Getting+Started+with+IntelliJ+IDEA+Scala+Plugin and got it to work. I don't really understand what's different as the dependencies, modules, and facets all look the same.

0
Comment actions Permalink

Can you screenshot the steps you are going through?

0

Please sign in to leave a comment.