score:20
I have encountered the same scalac error when trying to run a Scala project in Intellij Idea 9.0.2 and I've managed to find a solution by chance :). These are the steps I took in creating the project and running it.
I have created a Scala project in Intellij Idea 9.0.2 final (it was released today). I have installed the Scala plugin, restarted the IDE and created a new Scala project (with the name "TestScala") with scala-2.8.0.Beta1 as project library. Once the project is created and the scala libraries downloaded, I have created a Test.scala file with the following content:
object Test {
def main(args:Array[String]){
println("hello")
}
}
After that, I created a launch configuration ("Edit Configurations"), choosing the "Application" template. I set as main class Test and choose the project name ("TestScala") in the "Use classpath and JDK of module" combo box. When I run the configuration I get the same error as you reported ("Scalac internal error: class java.lang.ClassNotFoundException") .
Now comes the freaky part :). I right click on the project, choose "Module Settings", have a look on all settings but I don't change anything . Click "apply" and "ok", try to run configuration again and it works :) .
I use Intellij Idea 9.0.2 the final release (build 95-66); Ubuntu 9.10 and JDK 1.6.0_18. I also have to mention that I had a JDK configured in Intellij, otherwise there is an extra step to configure it.
UPDATE:
When checking the setting of the module, one needs to click on the Module->Scala and Facets->Scala (expand it and click on Scala(ProjectName)) . Both of these settings are about the scala compiler and scala library location. I would guess these values are not properly set when the project is created but are saved once the user touches them and saves the settings.
score:0
You are mixing code compiled with two different Scala versions.
score:0
I use Netbeans to write scala programs. So far it works very well with my codes. You can try the plugin here: http://wiki.netbeans.org/Scala68v1.
score:0
I was getting this error and also had to right click on the project and "Open Module Settings". However, it was more than just hitting apply. I had to make sure that my Content Root was correct for each project. For some reason, there were some incorrect Source and Test Folders.
My project uses maven as the main build tool and importing the project into Intellij is probably what created these incorrect settings.
score:0
I had similar problem, following this blog post instructions solved the problem for me
score:1
I had the same problem yesterday while trying to set it up. Solution is pretty simple, you just have to set scala somewhere in project settings.
score:2
I just did a fresh install and had exactly this same problem myself. It turned out that, because I had created the file in the root package, IDEA had added a package statement at the top with naming a package. I assume that this then got compiled as "package object Main" - valid syntax in 2.8? Anyway, I deleted the line that said package and it all worked fine.
score:6
Installing the plug-in is prerequisite one.
The next thing you should do is define a library (global or project-specific; I use global) that holds the Scala library and compiler JAR files (at a minimum, that's scala-compiler.jar
and scala-library.jar
). Adding source JARs and a documentation JAR or URLs is a good idea, too. Then make this library a dependency of any modules in your project that include Scala code.
Lastly, find the Scala facets in those modules and de-select both check-boxes there.
score:10
To answer your question, it's difficult to get a working IDE for Scala for two reasons: (a) Scala is only just beginning to reach a wide audience and (b) due to (a), there is no business case for spending time on a Scala IDE.
Also, if you are old enough to cast your mind back and young enough to still remember, you would know that for the first five or more years of Java, we were stuck with okay-ish tools like JBuilder that did little more than compile your code when you said so - no error highlighting, no auto-importing, and the word refactoring didn't even exist. If you want to pioneer, you need to be prepared to cut some of the road yourself, or at least bush-bash.
I know it won't help you, but I have successfully used IDEA for Scala on Linux, Mac and Windows. I typically have the Scala SDK installed somewhere locally and point IDEA at that rather than using the 'download' option.
Presently, I am mostly using an EAP version of IDEA 9 on Mac OS X with Scala 2.8.0.Beta1-RC5 and it's working well (except that fsc doesn't seem to worked with mixed sources).
You could try your luck over at the IDEA Scala Plugin Discussion Forum, though I haven't had a great lot of responses to my own postings there.
Source: stackoverflow.com
Related Query
- How to use Scala in IntelliJ IDEA (or: why is it so difficult to get a working IDE for Scala)?
- How to get Scala imports working in IntelliJ IDEA with the Play framework?
- How to get IntelliJ IDEA 14 working with Scala on Android (SBT)
- How do I get Intellij IDEA 12.0 to work with Play Framework 2.1.0 app and Scala 2.10.0?
- How to get Intellij to use dependencies from SBT scala
- Why do identical objects get different printed outputs in IntelliJ Scala REPL depending on how they were created?
- Why does Scala compilation get stuck in IntelliJ IDEA 13.1.3?
- Scala code compiles through command-line sbt but fails when compiled through Intellij Idea - how set up Intellij to use external sbt?
- How can I use IntelliJ IDEA 10.5.2 to connect to a database for a Scala application
- How to use IntelliJ with Play Framework and Scala
- How to add Jar libraries to an IntelliJ Idea SBT Scala project?
- How do I change intellij idea to compile with scala 2.11?
- How can I get Intellij to stop underlining my scala code?
- How to get logging working in scala unit tests with testng, slf4s, and logback
- How to run scala code on Intellij Idea 11?
- How to debug a scala based Spark program on Intellij IDEA
- How to get rid of scalac ServerException with IntelliJ Idea
- How to set up Java and Scala in one single Module in Intellij IDEA 11?
- How to use scala reflection API to get all contained classes
- How to run Scala code in Intellij Idea 10
- How to make IntelliJ IDEA use javac for Java and scalac for Scala?
- How to run tests on every code change in IntelliJ IDEA from Scala sbt project?
- How to know if a Scala file modified with IntelliJ Idea is saved and if it is checked into CVS?
- How to get IntelliJ to recognize imports in Scala script?
- How do I get the scalaz IDEA live templates working for the symbolic methods?
- How to set up an IntelliJ Idea Scala project to recognize local Ivy2 cache?
- How do I get IntelliJ to display the Scala compilation deprecation warnings
- How to use my classes from Scala worksheet in IntelliJ CE with Scala plugin?
- How do I make intellij Idea to highlight Scala script correctly with #! (shebang)
- How do I use Scala dispatch to get the URL returned in a 301 redirect?
More Query from same tag
- java.lang.NoClassDefFoundError: org/apache/lucene/codecs/simpletext/SimpleTextCodec
- Play 2.5.9 + cucumber, JPA withTransaction deprecated
- Transforming arrays in-place with parallel collections
- Slick: Return inserted row with auto increment id
- Forwarding messages to other Akka actors
- Enabling Parallelization in Spark with Partition Pushdown in MemSQL
- Can individual case statements have type parameters? If so, how?
- How to create Sink with some MaterializedValue
- Using Akka with Scalatra
- Retrieving data/value from elastic search in scala
- Converting from Task[Either[A, Task[B]]] to Task[Either[A, B]]
- How to implement Secure.Authenticator in scala Controller?
- Implicit parameter not passed to higher-order function
- What is the correct way to effect multiple updates on a Neo4J graph?
- How to declare task dependency on tasks in 0.13?
- Is Scala installed multiple times if using Scala IDE, Scala on the command line, and SBT?
- Using Scala's Runtime
- Avoid concurrent execution of Akka actor
- Convert Seq to Pipe in Scalding
- Filter Spark Dataframe with a variable
- Catch Exceptions that are thrown on map function in Spark
- In scala, is it possible to discourage the compiler from searching for Predef implicit first?
- Is class parameters with the option type need not to pass a value?
- how to do chain functions in Spark dataframe?
- Scala Play 2.1: Accessing request and response bodies in a filter
- how to update nested column's value of xml in spark scala dataframe
- Obtain the field member of the class where the macro is defined in
- Type mismatch with Scala implicits
- Understanding Packrat Parsers in Scala
- using for comprehension for 2-argument map function