I'm having an issue with a custom hook I'm deploying in Liferay.
I've created both a hook and a theme using Liferay Plugins SDK 6.2.0
I create a .war (with Eclipse's built in Liferay -> SDK -> war command) for my theme, and deploy it onto my server running Liferay EE 6.2, which works fine.
However, I repeat the same process with my hook and I get this error:
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.UnsupportedClassVersionError: com/bofa/UserLoginImpl :
Unsupported major.minor version 51.0 (unable to load class com.bofa.UserLoginImpl)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassL
oader.java:2908)
I'm not sure if this could be a Java Compiler version error like I've read about, because my theme uses the same exact settings and works properly.
Any ideas?
Its because of different JDK at compile time and runtime, make sure you are using same JDK version to compile and run it.
It generally occurs if a higher JDK version is used to compile the java file and a lower JDK version is used at runtime
Related
In AndroidStudio BumbleBee, there does not appear to be a way to configure the Gradle JDK that persists between full builds of the target app. Our app requires JDK 8 and Gradle requires JDK 11...
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
We develop our Cordova webapp (JS/CSS) on Mac for desktop first and then port to mobile. We do full builds, not incrementals.
Changing org.gradle.java.home does not work and might be too late as the JDK is already launched to run Gradle and parse org.gradle.java.home.
Changing JAVA_HOME sets the JDK for both our app and Gradle... and all other projects that use Java.
Chaning the IDE settings can be done manually... each full Cordova 11 build and launch of AndroidStudio. Here is how we have to set the Gradle JDK in AndroidStudio preferences... every time we launch Android Studio. Looking for a way to set the Gradle JDK in the IDE that will be honored between runs...
The dropdown includes the embedded JDK 11 that comes with AndroidStudio. This needs to be selected for the Gradle JDK to successfully build our app. Here is the dropdown...
Tried starting AndroidStudio from the commandline, where env variables can be set just for the launched process...
$ JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home" open "/Applications/Android Studio.app"
If there are no options in BumbleBee, are there plans for such support in later releases of Android Studio.
I installed Netbeans 11.3 under Ubuntu 18.04 and created in the following a new Groovy project.
Choose File > New Project (Ctrl-Shift-N;\u2318-Shift-N on Mac) from the main menu to open the New Project wizard.
Select Java Application in the Java category. Click Next.
Type GroovyJavaDemo as the Project Name and specify the folder where you want to create the application in the Project Location field.
Deselect the Create Main Class checkbox. Click Finish.
Next, I created a Groovy Script file with only this content println "Hello" and it caused the following problems:
ant -f /home/ubuntu/NetBeansProjects/GroovyJavaDemo -Djavac.includes=Hello.groovy -Drun.class=Hello run-single
init:
deps-jar:
Created dir: /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build
Updating property file: /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build/built-jar.properties
Created dir: /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build/classes
Created dir: /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build/empty
Compiling 1 source file to /home/ubuntu/NetBeansProjects/GroovyJavaDemo/build/classes
/home/ubuntu/NetBeansProjects/GroovyJavaDemo/nbproject/build-impl.xml:1120: The following error occurred while executing this line:
/home/ubuntu/NetBeansProjects/GroovyJavaDemo/nbproject/groovy-build.xml:26: Error running forked groovyc.
BUILD FAILED (total time: 1 second)
What did I miss?
Thank you in advance,
I don't think you missed anything, since I can reproduce your problem with JDK 11 on NetBeans 11.3.
However, there is a (somewhat unsatisfactory) workaround that worked for me:
Install JDK 8 (if necessary).
Edit the NetBeans file etc/netbeans.conf and set the JDK that NetBeans uses to JDK 8. In my case I added the line netbeans_jdkhome="C:\Java\jdk1.8.0_221" to netbeans.conf.
Restart NetBeans then rebuild your project. It should compile now:
Notes:
You could bug report this issue to the NetBeans team if you wish.
I also tried using JDK 14 as the default Java platform for NetBeans and got a different error: NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7. See the Gradle bug JDK 14 support #10248 for more information on that.
Setting JDK 8 as the default platform for NetBeans doesn't prevent you from adding other Java platforms (Tools > Java Platforms > Add Platform...) such as JDK 11 and JDK 14 for your individual projects.
Edit the groovy-build.xml and replace <groovyc javahome="${platform.home}" with <groovyc javahome="${jdk.home}" it works for me on JDK 1.8
Please find here the solution for Open-JDK-13
I installed jdk 1.8 and set the JAVA_HOME variable in my ubunut 16.04 LTS machine.
After that I downloaded Anypoint studio and extracted the files in it. Then when I run the studio it is getting opened properly. But remaining controls seems not working properly.
For example, When I click on windows->preferences and searching for 'JRE', it is not searching at all. Did anyone has same/similar issues?
You should check and see if Anypoint Studio supports Java 8 currently. I just switched to version 3.8 and my Studio seems to "want" Java 1.7. I have version 8 Java on my machine but I noticed that the latest version of Anypoint Studio (using 3.8 Mule EE) wants to use 1.7. I tried to select my 1.8 Java and it said that Anypoint Studio would still be using a compiler compliance level of 1.7.
Go read the documentation on the Mule site.
HTH
I had setup broadleaf commerce project with mysql database with successive MAVEN install. When i am going to run ant task for tomcat it gives errors like this
The archive: /home/yogesh/Downloads/.eclipse%20(3)/plugins
/org.eclipse.swt.gtk.linux.x86_64_3.104.0.v20150528-0211.jar
which is referenced by the classpath, does not exist.`
Try redownloading and re-installing Eclipse. Also make sure that you are using the latest release version, which is Eclipse Mars.
I'm compiling a project that works OK in Eclipse, and builds fine with ant, but in IntelliJ IDEA gives:
Internal groovyc error: code 1
How can I resolve this? Other error messages include:
1:35:46 PM Unknown Natures Detected
Imported projects contain unknown natures:
org.eclipse.jdt.groovy.core.groovyNature
Some settings may be lost after import.
1:43:55 PM Compilation completed with 1 error and 7 warnings in 20 sec
Groovyc: Cannot compile Groovy files: no Groovy library is defined for module
Groovy itself is installed on Linux. Adding it as a groovy compiler in settings does not affect the behavior:
> groovy --version
Groovy Version: 1.7.4 JVM: 1.6.0_24
Apparently you tried to import an Eclipse project into IDEA, and that isn't good enough. (Groovy) Eclipse comes with its own version of Groovy, whereas in IDEA, you have to add groovy-all-1.7.4.jar (or whatever version you want to use) as a compile dependency.
You have to add JAXB dependencies if you are using Groovy 2.5.3 + Java 11 (also check out Java 11 related change). Groovy comes with extra JAXB Jars so we can add them. Open 'Project Structure' dialog, then select 'Dependencies' tab and add the dependencies
Changing the project SDK from Java 15 to Java 8 seemed to have magically fixed the same problem on my machine.
Steps:
Go to File > Project structure... (may differ on Mac/Linux).
Under Project Settings, select Project.
In Project SDK: dropdown, choose a different version of the JDK installed.
Click Apply & OK at the bottom of the dialog.
** Rerun your program.
This worked for me!!
Read the log before the "Internal groovyc error: code 1", then it should show you a groovy version mismatch. Change your groovy version from the dependency list as per the log.
Ex. compile 'org.codehaus.groovy:groovy-all:2.4.11'
Move the Groovy dependency in the module settings to the top right after JDK.
I could make it work just by reestart intellij and invalidate the caches.
It can be found (for intelliJ 2018.1):
File -> Invalidate Caches/restart -> Invalidate and Restart
I found this solution which worked totally for me. You can use this link for fixing this problem
resolving-groovyc-internal-groovyc-error-code-1
I had to reinstall groovy SDK and it started working.
i was use wrong SDK ,please cheak your SDK version