I just started learning Javafx with Java11
I created a project in IntelliJ and it gave the standard structure.
In src file when I change the package name for the package "sample" to anything else, IntelliJ gives the following error.
Error:Kotlin: The Kotlin standard library is not found in the module graph. Please ensure you have the 'requires kotlin.stdlib' clause in your module definition
The error disappears when I refactor the package back to "sample".
how do I rename without getting this problem.
this might be helpfull
Javac gives this error, when lint is enabled and you use Java 9 module in Kotlin. You have to declare "requires kotlin.stdlib" in your module-info.java.
Ran into the same issue. For me, I'm using a module-info file in the src folder that looks like this:
module javafx {
requires javafx.fxml;
requires javafx.controls;
requires javafx.graphics;
opens sample;
}
If you rename your package to foo, then you need to change the last line to "opens foo". Otherwise it's still gonna look for and try to open a package named "sample". I have no idea what this has to do with kotlin.
I had the same problem and I solved it disabling "Kotlin migration detection". I have already response here:
https://stackoverflow.com/a/59628873/2350799
I had the same problem. But as long as you are not using Kotlin in the project there is a workaround : disable the Kotlin plugin, under settings.
Related
I am writing a small plugin for PhpStorm. During development, I run it in IDEA and everything works fine there. However, after I try to enable it in PhpStorm I get the following error:
Plugin 'name' is compatible with IntelliJ IDEA only because it doesn't define any explicit module dependencies
How can this problem be solved?
The documentation plugin compatibility says that if your plugin does not have module dependencies (built-in plugins that are non-removable parts of the IDE), then it is considered legacy and will load only in IDEA, as reported by the error message.
In order to fix this error, you need to explicitly add a dependency to one of the modules. For example, com.intellij.modules.platform:
Add the following line to plugin.xml:
<depends>com.intellij.modules.platform</depends>
And the plugin should load successfully in PhpStorm.
In a newly installed IntelliJ IDEA, I created a new Kotlin scratch file and tried to run it, but it gives me an error:
add kotlin script runtime jar to classpath
There is related issue on YouTrack: https://youtrack.jetbrains.com/issue/KT-33010
As a workaround you could add kotlin runtime manually:
Open "Project Structure | Modules"
Select your module, click on plus and add "Kotlin" facet
See "kotlin library not found ..." message and click on "Fix..."
Select your module in editor ( "Use casspath of module").
Just add one line of dependency
dependencies {...implementation("org.jetbrains.kotlin:kotlin-script-runtime:1.5.21")...}
Not sure if there's any magical trick that sorted this out, but I simply created a new Scratch file and everything worked!
PS: In my case, I suspect the problem was related to me renaming the scratch file previously. Again, not sure! :)
I am working on a project using kotlinjs for nodejs and I start to learn coroutines and integrate them into my code to say goodbye to the callback hell.
I managed to get coroutines working, my code can be compiled and executed, everything seems fine.
...except: The IDE still shows me errors. It seems to be confused by the additional libraries I added in order to get coroutines running.
I am currently fiddling around with the library dependencies, sometimes some errors go away, but then some code gets red which was okay before...
This is what I see:
Case 1:
Cannot access class 'kotlinx.coroutines.experimental.CoroutineContext'. Check your module classpath for missing or conflicting dependencies
Case 2:
Unresolved reference: JsModule
Modifier 'external' is not applicable to 'class'
You see, launch is recognized when I add the stdlib, but then the IDE complains with the other two errors.
Again, please note: In both cases, actual compilation is successful!
I am using IntelliJ 2018.1 with Kotlin Plugin 1.2.41.
Thanks to Alexander Chernikov at youtrack.jetbrains I could resolve my problem.
I cite his explanation:
The issue is that JavaScript libraries should be marked with special attribute to be recognized.
When they are imported from pom.xml or build.gradle, this mark is set, so the feature works.
In your project they are not marked.
At the moment, to correct the libs manually, please open .idea/libraries/org_jetbrains_kotlin_kotlin_stdlib_js_1_2_41.xml and .idea/libraries/org_jetbrains_kotlinx_kotlinx_coroutines_core_js_0_22_5.xml.
In both files find type="repository" and replace it with type="kotlin.js".
Make sure IDEA sees the change. (You can exit IDEA, make the change and restart.)
Then you can keep only these two libs in dependencies. The editor should work.
Here is the issue link:
https://youtrack.jetbrains.com/issue/KT-24575
There I have also attached a sample project with the problem.
When calling new JScrollPane, I was prompted to use a JBScrollPane.
com.intellij.ui.components.JBScrollPane
But when I do import com.intellij.ui.components.JBScrollPane, the compilation triggered an error.
error: cannot find symbol
import com.intellij.ui.components.JBScrollPane;
I tried adding this repository artifact, but it doesn't work.
This inspection is supposed to be shown only in the code of IntelliJ itself and IntelliJ plugins; if you saw it in a regular Swing project, it's a bug.
IntelliJ components can be adapted to be used outside of IntelliJ, but they are not packaged and published in a way that makes it easy.
I have a few import statements in my project that are displayed in RED. Intellij shows 'Cannot resolve symbol' errors, and I am not able to autocomplete these classes or their methods. However, when I run my project it runs perfectly fine. This is strange so much so, that lets say I have an import statement
import org.apache.velocity.app.Velocity
It cannot resolve the 'Velocity' class, even though when I do a ctrl+b selecting the 'app' package, it clearly shows the Velocity class:
I am lost in this and I am struggling to code like this. Any help will be appreciated.
Best Regards.
EDIT: In my project, some of the dependencies are also not resolved, although I refreshed my project multiple times. The exact same dependencies are resolved in my colleague's system, who is using the same code-branch and environment as me.
I can see that the unresolved dependencies lie inside the play.sbt package, but are still not resolved. Is there a compatibility issue between Intellij("15.0.2") and SBT("0.13.8" mentioned in build.properties of my app)?
Reimport project using option 'Import project from external model' and choose 'sbt'. In next window choose options like 'use auto-import' and download 'sources for SBT and plugins'.