Scala + Play + Intellij IDEA Issue - scala

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.

Related

Could not find or load main class in scala in intellij IDE

I have searched for this error, but the answers were for Java,
but my case is Scala. I am trying to run this project in IntelliJ IDE
sentimenAnalysis, but it throws an error. This is also the structure of the project. Class Not found
Update 1 According to answers, Adding $ at the end of the name of search class
Update 2 after adding sbt task:
Update 3
My problem was resolved by importing the project, instead of getting it directly from GitHub, probably the manual configuration that Mike Allen said could resolve the problem, but I couldn't successfully apply that.
My problem was resolved when I marked "src" folder as sources root.
Right-click on (folder) src -> Mark Directory as -> Sources Root
Probably you imported project somehow wrong. I see scala folder is not highlighted as sources.
Usually, you don't even need to setup Run configuration manually for Scala SBT project. Do you have Scala and SBT Plugins in your IDE?
You should open SBT projects through "Import project" and choose "build.sbt" file. I would also recommend enabling auto-import to install all of the dependicies.
That's how it look for me:
If you still wanna make it manually your configuration should work. That's my Run configuration that works:
You will get this error if you tried to open the project and imported it incorrectly. I would open the project like this in Intellij:
File>New> Project from Existing Source>(select) Import project from external model>
(select)sbt
click Next>Finish
To fix this issue in my project I invalidated caches and restarted:
In my case the object in the object MyObject extends App was nested, if you have it unested meaning in your scala file it's not under any other object it made it work.
Netsted caused this error in intellij:
object External {
object MyMain extends App // Could not find or load main class in scala in intellij IDE
}
While the below unested worked:
object External { }
object MyMain extends App // Worked!
Hi I solved this problem by defining the class in src package under main and by setting up the configuration as default.
Create a new project and make sure SBT is proper loaded along with Scala Library. This happens with many times, bad internet connection or failure of Scala library/SBT loading might be some of the reasons.
Best of Luck for Next Project, Happy Developers & Coders.
Had a similar problem with latest Intellij IDEA build (2022.1.1) and scala 3.1.2 - both sbt and Intellij scala projects. For me the solution was to use non-ascii path.
#SeriousDron answer helped me with my problem. You need to make sure you have Scala language installed in IntelliJ. You can do this by going to Settings > Plugins > search for "Scala". Now, it will automatically pick up your .sbt file and project.
I met the same issue, please check the whole execute command and check the configuration, make sure the compiled files path is correctly configured.
refer to my screenshot:

Creating SBT Project in IntelliJ Ultimate 13.1.1 with Scala plugin gives no New > Scala object for src/main/scala?

I'm trying to get started with a quick Hello World application in Scala.
I'm using IntelliJ Ultimate 13.1.1. I've downloaded the Scala plugin. I've also downloaded the SBT plugin. The project SDK is Java 1.6.
I went ahead and created a new project. I selected SBT Project. The project is created fine. I notice that the src/main/* and src/test/* folders are created nicely.
When I right-click on the src/main/scala folder and try to create a new Scala object, there's no option to do so?! I tried to mark the directory as a sources root. Still, the issue persists. I'm given the option to create a Java file but not a Scala file.
What's going on?! I've been pulling my hair on this for the past two hours.
This is a bug in IntelliJ. Here is the answer to a bug report (#25058) I submitted:
Andrey Dernov (JetBrains Support)
Mar 26 19:43
Please see the respose from the developer:
Hi Dave, the problem was (mostly) because of the uppercase letter
(http://youtrack.jetbrains.com/issue/SCL-6853). You can either use
lowercase project name, or wait for a new plugin build that fixes the
issue. Thank you for the bug report!
You can get around it by explicitly editing the Run -> Edit Configurations and adding the class that you want to run. Set the main class and delete the $ (for the object).

NoClassDefFoundError: com/sun/lwuit/layouts/Layout error?

i am developing an java application using eclipse pulser ide, in that i have got `NoClassDefFoundError: com/sun/lwuit/layouts/Layout.
i have tried many solution's and tried to import LWUIT.jar and cleaned project's but even its not working can anybody head up with a solution.
Thank you.
Go to project Properties, Java Build Path, Order and Export and make sure that your LWUIT jar is marked.

IntelliJ show errors in scala source files but the project compiles successfully

I'm working with project in intellij IDEA IDE based in maven. I can perform all maven goals but IntelliJ is showing a lot of errors in the source code like bellow:
Everything worked fine a few hours ago. I don't understand why the IDE continue
showing errors. When I rebuild or compile the entire project (CTRL + F9) or a single
scala class I always receive a success message like that:
I already had configured scala plugin before, so I don't know what is happen.
thanks for your help
Sometimes the IntelliJ cache gets corrupted. You can fix this by the following:
File > "Invalidate Caches / Restart"
After choosing "Invalidate and Restart" when prompted, IntelliJ will restart and rebuild its cache.
If IDEA has lost track of obviously correct types such as Database or DateTime it probably means the configuration of the project is wrong or corrupted. Most commonly it does not have the required 3rd part dependencies such as Joda Time.
If you're not already doing so, define your project solely in SBT and use the sbt-idea plug-in to produce your IDEA project definition. Then whenever you change the project dependencies, re-run gen-idea to regenerate your IDEA project files. No muss, no fuss.
There are many bugs raised in jetbrains's bug tracker for this. I suggest you raise some bugs or vote for existing ones.
It loos like the problem you have is with the type aware highlighting which is worse than useless.
thanks for your responses.
I solved this problem importing the project again.

Using playframework with the scala worksheet plugin for 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?