I tried to make a new project on IntelliJ IDEA. On the gradle options, I check the Java and Kotlin/JVM libraries. After I named the project folder, there's error popped up on my screen. I use jdk 16.
Error Adding Module
What's wrong with my jdk? anyone could help me?
I changed the environment variables of "JAVA_HOME" to be more specific. It didn't do it, if it's located on "C:\Program Files\Java". It'll do it if it's changed into "C:\Program Files\Java\jdk-16.0.2".
Related
Ok im wondering where does xamarin get this path from?
Severity Code Description Project File Line Source Suppression State
Error The specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_71\\bin\javac.exe" is invalid.
So I can go and change it to the new jdk1.8. I have the new JDK set up I just need to know where to change the path at.
I had the same problem and solution is.
Remove all jdk and install jdk 1.8
Change reference java location in Visual Studio Tool > Options > Xamarin
Clean and Rebuild Project
I've just solved this exact problem for me.
I don't know why you wouldn't have a JDK_HOME variable. Completely remove the JDK and install it again maybe?
The Environment Variables for java were set to my previously installed path. I guess Oracle screwed up here.
As I had the same error, here's what I did:
I went to C:\Program Files\Java\ and checked what the jdk folder is called. For me it's jdk1.8.0_102.
For users who don't know where to find System Variables:
Go to System Properties and on the left hand side, click Advanced System Settings. Switch to the Advanced tab, click Environment Variables. Under System Variables there should be two variables in the list called JAVA_HOME and JDK_HOME.
I edited those values and change the path to what I found in the java folder. In my case this would be C:\Program Files\Java\jdk1.8.0_102.
No need to close VS, just build your app and it should get passed the annoying error.
Hope this helps :)
I had exactly the same problem. I got it to go away (which is not the same thing as fixing it).
Un-install every bit of JAVA you have. Delete both JAVA folders (Program Files and Program Files (x86)).
Install the latest version of the Java (x32) SDK.
Clean and Rebuild your project(s).
Since my Solution is multi-platform, I changed the Startup Project to the .iOS one, built it, ran it in an emulator, and set the Startup Project back to the .Droid project.
Somewhere in all this, the problem went away.
And remember kids! If it can go away all by itself, it can come back again all by itself!
I had this issue as well, I downloaded 32 bit Java but VS was still looking for the 64 bit one.
To solve it all I had to do was change the JAVA_HOME and the variable in my Path, clean my project and rebuild it.
Just set JAVA_HOME and JDK_HOME ambient variables, clean your solution and build again. For me worked fine.
Don't forget to clean your solution.
I was trying to execute a simple program in IntelliJ IDEA as a static web project. I'm newbie and I'm learning web development with Node.js. I took help from the official website of IntelliJ IDEA, but the error was same. Though, I configured the settings and Project structure also.
Error:
"C:\Program Files\Java\jdk1.8.0_91\bin\java" -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 2016.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2016.1.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain ""
Exception in thread "main" java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
Process finished with exit code 1
Snapshot of IDE
Please help me to sort out this problem. I'm digging out this problem since few days.
This is because the className value which you are passing as argument for forName(String className) method is not found or doesn't exists, or you a re passing the wrong value as the class name. Here is also a link which could help you.
1.
https://docs.oracle.com/javase/7/docs/api/java/lang/ClassNotFoundException.html
2.
https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#forName(java.lang.String)
Update
Module not specified
According to the snapshot you have provided this problem is because you have not determined the app module of your project, so I suggest you to choose the app module from configuration. For example:
this is how I fix this issue
1.open my project structure
2.click module
3.click plus button
4.click import moduleļ¼and find the module's pom
5.make sure you select the module you want to import,then next next finish:)
For IntelliJ IDEA 2019.3.4 (Ultimate Edition), the following worked for me:
Find the Environment variables for your project.
Specify, from the dropdowns, the values of "Use class path of module:" and "JRE" as in the attached screenshot.
I faced the exact issue of module not found and solved it by navigating to pom.xml file in file system of my project and opening it as a maven project in my intelliJIdea.
Then it has populated the sub modules for selection in the edit configurations window.
Faced the same issue. To solve it,
I had to download and install the latest version of gradle using the comand line. $ sdk install gradle using the package manager or $ brew install gradle for mac. You might need to first install brew if not yet.
Then I cleaned the project and restarted android studio and it worked.
This happened to me when I started to work with a colleque's project.
He was using jdk 12.0.2 .
If you are suspicious jdk difference might be the case (Your IDE complains about SDK, JDK etc.):
Download the appropriate jdk
Move new jdk to the folder of your choice. (I use C:\Program Files\Java)
On Intellij, click to the dropdown on top middle bar. Click Edit Configurations. Change jdk.
File -> Invalidate Caches and Restart.
I just install Android Studio 1.5 on Ubuntu 14.04. I created a new project and I get the following error:
Error:Could not determine Java version using executable /usr/lib/jvm/java-1.5.0-gcj/bin/java.
My /usr/lib/jvm/ contain:
java-1.5.0-gcj java-7-oracle java-gcj
java-1.5.0-gcj-4.8-amd64 java-8-oracle java-gcj-4.8
The Project Structure has the JDK location set up to /usr/lib/jvm/java-1.5.0-gcj. Should it me something else ? How can I know ?
Many thanks for you help !
I solved my problem by simply changing the JDK to /usr/lib/jvm/java-8-oracle. I still don't know why it works, or why it should have been like this at the first place.
Sorry for the question.
The problem occurred because location of the JDK directory was not defined correctly.
In Android studio File ->Project structure ->in left side tabs click on SDK location->define the directory where JDK is located .
For example:/usr/lib/jvm/java-8-oracle/jdk1.8.0_77 is my directory of JDK.The location can be different.
Another variant:
Replace homePath value in ~/.AndroidStudio1.5/config/options/jdk.table.xml on /usr/lib/jvm/java-8-oracle/bin/java
I have a project that uses both Java and Scala code. When I am trying to run a main function from Scala on Intellij 13.1.4 with Scala Plugin 0.38.441 installed I get the following error
Error:scalac: Error: Scala instance doesn't exist or is invalid:
version unknown, library jar: /home/arpit/.m2/repository/org/scala-lang/scala-library/2.11/scala-library-2.11.jar, compiler jar: /home/arpit/.m2/repository/org/scala-lang/scala-compiler/2.11/scala-compiler-2.11.jar
sbt.InvalidScalaInstance: Scala instance doesn't exist or is invalid:
version unknown, library jar: /home/arpit/.m2/repository/org/scala-lang/scala-library/2.11/scala-library-2.11.jar, compiler jar: /home/arpit/.m2/repository/org/scala-lang/scala-compiler/2.11/scala-compiler-2.11.jar
at sbt.ScalaInstance$.slowActualVersion(ScalaInstance.scala:122)
at sbt.ScalaInstance$.sbt$ScalaInstance$$actualVersion(ScalaInstance.scala:119)
at sbt.ScalaInstance$$anonfun$actualVersion$1.apply(ScalaInstance.scala:32)
at sbt.ScalaInstance$$anonfun$actualVersion$1.apply(ScalaInstance.scala:32)
at scala.Option.getOrElse(Option.scala:120)
at sbt.ScalaInstance.actualVersion$lzycompute(ScalaInstance.scala:32)
at sbt.ScalaInstance.actualVersion(ScalaInstance.scala:32)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$.org$jetbrains$jps$incremental$scala$local$CompilerFactoryImpl$$getOrCompileInterfaceJar(CompilerFactoryImpl.scala:79)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:43)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl$$anonfun$getScalac$1.apply(CompilerFactoryImpl.scala:42)
at scala.Option.map(Option.scala:145)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.getScalac(CompilerFactoryImpl.scala:42)
at org.jetbrains.jps.incremental.scala.local.CompilerFactoryImpl.createCompiler(CompilerFactoryImpl.scala:21)
at org.jetbrains.jps.incremental.scala.local.CachingFactory$$anonfun$createCompiler$1.apply(CachingFactory.scala:23)
at org.jetbrains.jps.incremental.scala.local.CachingFactory$$anonfun$createCompiler$1.apply(CachingFactory.scala:23)
at org.jetbrains.jps.incremental.scala.local.Cache$$anonfun$getOrUpdate$2.apply(Cache.scala:20)
at scala.Option.getOrElse(Option.scala:120)
at org.jetbrains.jps.incremental.scala.local.Cache.getOrUpdate(Cache.scala:19)
I also checked for compiler settings under Project setting in IntelliJ and for Scala Compiler it says "Nothing to show here in external build mode". Can this be the problem?
It seems that the compiler cannot read the version of the scala-compiler jar. Maybe it is corrupted. Try to redownload it or to use another version. To set another compiler library go to Project Structure/Facets/Scala facet of your module and select a suitable library.
If it does not work please create a ticket on the bugtracker (with the attached compiler library):
http://youtrack.jetbrains.com/issues/SCL
Also you can try to change the type of the incremental compiler in Settings/IDE Settings/Scala
There is nothing wrong with the Compiler/Scala Compiler settings.
I had the same problem, that's what I've done:
(After installing IntelliJ and SBT) I downloaded Scala as well from this website and installed it.
Then I went to File -> Project Structure -> Libraries and I removed the existing library.
Afterwards, I clicked the "+" symbol and "Scala SDK" and found the Scala installation folder (C:\Program Files (x86)\scala\ in my case).
And followed the instructions. Then everything worked fine...
Hope it helps...
I had similar issue when run Idea under the root user. Idea was not able to find the scala library. I solved the issue by quitting the Idea and run it under my current user.
in my case i went into Compiler/Scala Compiler settings and deleted additional compiler options (make -transitive)
I decided to update my JDK to Java 8, and installed to the default location of C:\Program Files\Java\jdk1.8.0 with a jre subdirectory.
I wasn't sure how Android Studio worked out the JDK location, so I decided to launch it and see. I got the following message:
Failed to complete Gradle execution.
Cause:
Supplied javaHome is not a valid folder. You supplied: C:\Program Files\Java\jdk1.7.0_45
I updated my JAVA_HOME environment variable (both for system and user) to point to the new path, and tried adding it to my PATH variable as well, but every time I attempt to build in Android Studio I get the same message. The quoted path is nowhere to be found in my environment variables though, so where is it getting it from and how can I change it?
Thanks
The problem was my project's JDK location. From the Android Studio Project tool window, I right clicked on the root directory, selected 'module settings', and set the JDK location. Everything's fine now.
I don't know why or how this problem occurred but this answer got me over the hump. On macOS rm -rf ~/.gradle to wipe out the cache then restart Android Studio. I tried everything else up to and including reinstalling the JDK and Android Studio. Wiping out the .gradle directory is the only thing that worked.
Try to delete all .iml files and .idea, and re-import the project from Gradle. Worked for me (provided you have everything else set up).
This error happens when you switch from Intellij to Android Studio, or the other way around, and load the same project. Looks like their project model is not compatible.
For Android Studio 1.1.0, after right-clicking on the project:
Select Open Module Settings
Select SDK Location at top left
Type text into JDK Location: box
I ran into the same issue. My jdk was upgraded from a 1.8.0_172 to 1.8.0_202. And I kept getting the mentioned error although I changed to the right jdk, in the module configurations. What confused me was the fact that the API version was stamped with the old *_172 version in the dropdown of available project sdk's. I found the reason for this to be an old obsolete entry in the dropdown that referenced the old *172. After deleting this entry, the APi versions was magically stamped with the new version.
Note to self: Remember to sanitize your projects when new versions come along
I was also seeing this same problem. For me the fix was in 'Run/Debug Configurations' (Run > Edit Configurations...)
The 'Gradle project' value was set to the build.gradle file location, and this should've been set to the Gradle project object in IDEA, click the folder looking icon not the '...'.
I'm in 1.0.2 and after I clicked OK, it immediately opened a dialog to allow me to specify the location for my project, no longer requiring navigation of the menus to edit the project JDK path.
Definitely strange that during install, it says the JAVA_HOME environment variable is set to a path that doesn't contain the JDK. After spending time fixing it (downloading the full 64 bit JDK), I create my first project and get the same thing. Because it's not using the environment variable that it hinges on during setup.
Odd behavior.
For some reason I failed using all the above answers, so what I did is to delete (actually moved, so that I could go back in case something goes wrong) the ".idea" folder from the project. Then I opened the IDE again, and it went fine.
Getting this in 2021? Try to to rm -rf ~/.gradle and restart Android studio.