Using playframework with the scala worksheet plugin for eclipse - eclipse

I tried to use the worksheet plugin in eclipse in combination with a play project but it doesn't seem to work. Every import is marked as not being found.
Has anyone got this working, is there anything special I need to do?

Yeap, I had that problem. What I've done to solve it was:
If you're not using it, I would recommend you start using Scala-IDE for eclipse
Even though I've previously got scala-ide, when I tried to use scala worksheet with a play project I still had that problem. I tried to do the default action to the scala worksheet plugin when you have a computer problem: reboot-update-reboot. And it worked! The version of Scala Worksheet that I'm currently using is (as seen in my Eclipse Installation details):
Scala
Worksheet: 0.1.2.v-2_09-201210230838-85b738a
Check if your version is the same as mine. If it's try to remove it and install it againt. If it isn't, then try to update it. Tell me if it works.
Cheers!

the question is a bit general, but:
if worksheet is working correctly without play framework => problem should lies in the installment of the framework:
did you update PATH (http://www.playframework.org/documentation/2.0.4/Installing)?
is command play help working ?
You are asking about Play's Eclipse plugin specifically:
did you follow guide at http://www.playframework.org/documentation/1.0.1/ide#eclipse ?
Which step didn't work for you?

Related

Intellij IDEA 14.1: Play Framework 2.3.8 Scala project import issue

I have created a Play framework 2.3.8 (Scala) project successfully, and ran it successfully as well. I just installed Intellij IDEA 14.1 and installed the Scala plugin during installation too. I am now trying to import the created project into the IDE; but I just can't find any guides to get me through it. I am stuck here, as the images there show you. Any comprehensive help would be very much appreciated. Should I download anything further than what the default procedure does during the project creation with the Play Framework? If not, how do I set up the settings on the screen shown in the images on the page at the link provided above.
See the "\bin\bin" in the error message? It looks like you should remove the \bin from the path to the JVM - it should be just c:\program files\java\jdk1.8.0_40.

Scala + Play + Intellij IDEA Issue

I was getting below error when I was making new Scala + Play project using activator. I am using standard activator method to generate Intellij Idea support for project but every time I was facing below issue.
I dont know how to resolve below issue. Please help,
#
The project 'play-scala-intro' has an older format and will be converted. You may not be able to open the project with earlier versions of IntelliJ IDEA. Details...
Old versions of project files will be saved to: 'E:\Personal\Scala Workspace\play-scala-intro\projectFilesBackup'
#
this problem probably happened when you use activator's command idea or git (you pull your collaborator's settings) . I have a same problem (also auto-complete doesn't work for my company's class ). I remove .setting , .idea , and every thing start with dot. next open project from Intellij and config my project.
this solve my problem I hope could help you ,too.
My problem is resolbved. As Sarvesh Kumar Singh mentioned I have created activator project and open that project in In Intellij IDEA and used options Auto import and download sources.
Above option resolved my problem.

Issues while setting up lightweight modular staging

I'm trying to get started with the examples here. I'm trying to set up my dev environment using Scala IDE (Eclipse).
So far,
I have downloaded lms, built it using sbt and added the generated jar library to my eclipse project.
I'm trying to write this bit of the code sample provided.
val snippet = new DslDriver[Array[Int],Array[Int]] {
def snippet(v: Rep[Array[Int]]) = {// Continues
However, DslDriver isn't found inside the scala.virtualization.lms package. The library is being found so it's not a problem with the build path.
I have also installed the scala-virtualized plugin to my Scala IDE.
Perhaps this is an eclipse issue where it can't find the necessary classes? Should I switch to coding using an editor and building using sbt?
Any help would be appreciated. Thanks in advance
I'm not familiar with lms but have you tried using sbteclipse to set up your project?
I'm not sure if you found a solution to your question, but the DslDriver class is defined in the dslapi.scala file.
Checkout the whole tutorial folder.

Intellij Idea setup for Scala, clarification needed

Using IntelliJIdea 12, i downloaded the Scala plugin and created a HelloWorld application.
The following import seems odd. Why does IDEA not recognize this to be a Scala Application? Is my setup incomplete?
I checked to see where does my compiler points to and got this. Don't really see a way to navigate IDEA to my scala installation.
Please advise.
When creating a new Scala project from the wizard IDEA can download and configure everything for you:
Settings can be changed later in the Scala Facet:
and in Compiler:
Libraries configuration:
Code and imports completion is available from the Scala library:
You need to add Scala as a framework for your project.
To do this, right click on the top level directory in your project, choose "Add Framework Support..." and select Scala. Then Scala will be added as a "Facet" of your project.
Here is a good page with more info:
IDEA Scala Project Configuration Explained
I got around this by downloading the Scala library from scala-lang.org, unzipping it and then pointing the project to it. It worked fine after that. But of course, I'm an eclipse guy so perhaps someone else might be able to give you a better automated (?) solution. Here's what my project looks like in Module Settings -> Libraries:

How to use Scala in IntelliJ IDEA (or: why is it so difficult to get a working IDE for Scala)?

I recently gave up trying to use Scala in Eclipse (basic stuff like completion doesn't work). So now I'm trying IntelliJ. I'm not getting very far.
I've been able to edit programs (within syntax highlighting and completion... yay!). But I'm unable to run even the simplest "Hello World". This was the original error:
Scala signature Predef has wrong version
Expected 5.0
found: 4.1 in .... scala-library.jar
But that was yesterday with IDEA 9.0.1. See below...
UPDATE
Today I uninstalled IntelliJ 9.0.1, and installed 9.0.2 Early Availability, with the 4/14 stable version of the Scala plug-in.
Then I setup a project from scratch through the wizards:
new project from scratch
JDK is 1.6.u20
accept the default (project) instead of global / module
accept the download of Scala 2.8.0beta1 into project's lib folder
Created a new class:
object hello {
def main(args: Array[String]) {
println("hello: " + args);
}
}
For my efforts, I now have a brand-new error :)
Here it is:
Scalac internal error: class java.lang.ClassNotFoundException [java.net.URLClassLoader$1.run(URLClassLoader.java:202), java.security.AccessController.doPrivileged(Native Method), java.net.URLClassLoader.findClass(URLClassLoader.java:190), java.lang.ClassLoader.loadClass(ClassLoader.java:307), sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301), java.lang.ClassLoader.loadClass(ClassLoader.java:248), java.lang.Class.forName0(Native Method), java.lang.Class.forName(Class.java:169), org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:72)]
FINAL UPDATE
I uninstalled 9.0.2 EA and reinstalled 9.0.1, but this time went with the 2.7.3 version of Scala rather than the default 2.7.6, because 2.7.3 is the one shown in the screen-shots at the IntelliJ website (I guess the screen-shots prove that they actually tested this version!). Now everything works!!!
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.
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.
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.
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.
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.
You are mixing code compiled with two different Scala versions.
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.
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.
I had similar problem, following this blog post instructions solved the problem for me