Gradle sync fails when creating a new Kotlin project with default settings in freshly installed IntelliJ IDEA - kotlin

I wanted to learn some Kotlin so I installed IntelliJ IDEA, created a new Kotlin project with the default settings and then the IDE tells me that Gradle sync has failed. Here's the error message:
Could not open init generic class cache for initialization script 'C:\Users\<my_name>\AppData\Local\Temp\wrapper_init.gradle' (C:\Users\<my_name>\.gradle\caches\6.8\scripts\344chmz69zyndatc9zp4rwux5).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 60
I googled the error and got a suggestion to try a different JDK version. Tried a few different versions but that didn't help. Then I installed the IDE on my laptop to see if that works and there I don't get any errors. As far as I can tell, the project settings were exactly the same on both machines but obviously something is messed up on my desktop computer. Both have Windows 10.
I'm also not at all familiar with the Java/Kotlin ecosystem or the build tools or whatever so I honestly have no idea how I could even begin fixing some Gradle errors. I don't really even know what Gradle is or what it does. So can you help me?

First, check the version which the project uses: File > Project Structure. Or, during project creation (https://i.stack.imgur.com/SXIzQ.png / example with SDK 1.8)
It has to be the same as JDK / SDK installed on your computer.
To verify java version installed in your terminal:
java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~19.10-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

Related

How can I open .zul file in Intellij?

I have downloaded the ZK plugin, but when I create a .zul file, it is just recognized as an unknown file for intellij. I tried resetting cache and rebooting, didn't make a difference..
Is there a way to connect the plugin to the extension? Am I missing something here?
I had quite the opposite experience, I created a .zul file and IntelliJ automatically suggested something like: "There's a plugin available that handles .zul files, would you like to install download and it?" -> confirmed and restarted ... Then .zul files are registered as XML files under Settings/File Types and code completion is working.
Not sure how this is failing for you, can you provide your version details including the plugins installed?
Here what I am using (Help/About):
IntelliJ IDEA 2019.2.4 (Community Edition)
Build #IC-192.7142.36, built on October 29, 2019
Runtime version: 11.0.4+10-b304.77 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-72-generic
...
Non-Bundled Plugins: org.zkoss.zkidea

IntelliJ IDEA seems to not fully switch to the new jdk

I am stuck with the following problem regarding Intellij IDEA.
I had installed the following java version:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
on my Win7 PC and using Intellij IDEA v14.1.3.
After some time, I have upgraded my jdk and now I have installed the following:
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)
I have consequently changed all the references to point to the new jdk in system variables and in Intellij in Project structure ...
Everything seemed to work fine (when I run a program from Intellij I see that the command java is invoked from the right path).
The problem is that for some reasons, when I open the integrated terminal in Intellij and write java -version the result is the old version (1.7.0_51).
I realized this because of some issues of the old version of java I face when I run my unit tests that should have been resolved in the new version.
Have anybody any idea how to solve this?
Thank you in advance!
I would not only update the java version, but completely delete it from the machine. Obviously, you have not removed all the references to the old java, as your problem statements describes.
Maybe the Java Uninstall tool might be helpful for this? Then make a clean new installation.

IBM Worklight Failing to start

Configuration: Eclipse (Juno) 4.2.2
IBM Worklight version: 6.2.0.01
Java version:
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
JDK: jdk1.7.0_71.jdk
Java Compiler: 1.7
My worklight studio was previously working and suddenly stops working after I had to force quit my eclipse. Even after reinstallation of the plugins, the error still recurs.
Here's a screenshot of the initial error log before 'Worklight server failed to start' and 'Failed to deploy application in the worklight server'. Any help to fix this issue will be deeply appreciated. Worklight studio issues like this is starting to get frustrating.
I uninstalled java from my mac. Reinstalled Java (JDK & JRE), new Eclipse (Juno 4.2.2) -> Then installed IBM Worklight Studio plugin. Figured it was the problem with Java as it was throwing the java exception 'unable to read the manifest'. Probably there was some issue after updating to Yosemite.
I had the same problem. You need to set correct IP for Worklight server. It doesn't work with "localhost" or "*".
It looks Java EE got corrupted somehow,
So as suggested the best approach would be to use a fresh Eclipse instance with a new plug-in installation and a new workspace as well. This way it makes sure everything is fresh and new.

Android Build Error: Unable to locate Java VM. Please set JAVA_HOME environment variable

I'm using Ti Studio on Win7, and my project builds and works when I have my Android plugged in via USB and I run using "Android Device".
However, when I try to buid it for distribution I get:
[ERROR] Program launch failed. Unable to locate Java VM. Please set JAVA_HOME environment variable.
I have looked at this thread which describes a similar problem, and verified that JAVA_HOME is set:
+>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_29
Also, in Ti Studio I have verified that Preferences->Studio->Platforms->Android has the "Android SDK Home" set to the path where Android SDK is installed.
Can anyone guide me on what else I need to do to fix this?
Thanks!
UPDATE FOR ANAND
+>javac -version
javac 1.6.0_29
+>java -version
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)
Did you read System Requirements?
From Documentation:
For Windows, the 32-bit version of Java JDK is required regardless of
whether Titanium is running on a 32-bit or 64-bit system.
Try to install additional 32bit version of Java (without removing the 64bit) and set the system variable.
You may refer this answer.
Hope it helped you
Configure environment variables as mentioned here and JDK must be 32 bit

"Unsupported major.minor version 51.0" in Netbeans

I know that the title is almost identical to other questions, but, I've not been able to resolve my problem with those answers.
This is the problem:
I have 2 almost identical projects (one has been cloned from the other with mercurial) and some changes have been made.
After the last pull from the original project, the following error appears when I try to run the project. I know that means that the project is being compiled with java7 and run with java6.
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/[...]/Start : Unsupported major.minor version 51.0
The original project keeps running normally.
It runs if I change the Java Platform in the project properties to java7, but I need the project to run on java6, so that's not an option.
Product Version: NetBeans IDE 7.2 (Build 201207171143)
Java: 1.6.0_35; Java HotSpot(TM) 64-Bit Server VM 20.10-b01
System: Linux version 3.2.0-32-generic running on amd64; UTF-8; en_US (nb)
Thanks for your help!
You can add more than 1 jdk to your environment and you can decide which one to use. try to add the jdk 6 and compile it based on that.