Error installing PMD on Eclipse Version: 2020-06 (4.16.0) - eclipse-plugin

I recently upgraded to Eclipse Version: 2020-06 (4.16.0) on Windows 10.
My java version is "14.0.1" 2020-04-14
After the upgrade, I attempted to install Eclipse-PMD 2.0 from the Marketplace ( help / Eclipse Marketplace / etc. ) ...I receive the error(s):
Cannot complete the install because some dependencies are not
satisfiable Software being installed: a.jre.javase 14.0.0 Software
being installed: Eclipse PMD Plug-in 2.0.0.202006052026
(ch.acanda.eclipse.pmd.feature.feature.group 2.0.0.202006052026)
Cannot satisfy dependency:
From: Eclipse PMD Plug-in 2.0.0.202006052026 (ch.acanda.eclipse.pmd.feature.feature.group 2.0.0.202006052026)
To: org.eclipse.equinox.p2.iu; ch.acanda.eclipse.pmd.java.feature.feature.group
[2.0.0.202006052026,2.0.0.202006052026] Cannot satisfy dependency:
From: eclipse-pmd Java 2.0.0.202006052026 (ch.acanda.eclipse.pmd.java 2.0.0.202006052026)
To: osgi.ee; (&(osgi.ee=JavaSE)(version=11)) Cannot satisfy dependency:
From: eclipse-pmd Java Support (Optional, JDT Prerequisite) 2.0.0.202006052026 (ch.acanda.eclipse.pmd.java.feature.feature.group 2.0.0.202006052026)
To: org.eclipse.equinox.p2.iu; ch.acanda.eclipse.pmd.java [2.0.0.202006052026,2.0.0.202006052026]
Does anyone have an idea(s) as regards the source of the issue ...if all else fails I may try building the PMD source from the github repo ( https://github.com/eclipse-pmd/eclipse-pmd ) but I cannot imagine why this should be necessary.

I created eclipse-pmd and I can install eclipse-pmd 2.0 from the marketplace with Java 14 and Eclipse 2020-06 without any problems.
From the error message you provided it looks like there are two missing dependencies:
ch.acanda.eclipse.pmd.java requires (&(osgi.ee=JavaSE)(version=11))
several plugins require org.eclipse.equinox.p2.iu and ch.acanda.eclipse.pmd.java
The first issue indicates that you do not run Eclipse with Java 11+. Check the Java version by opening the "Installation Details" dialog: Help > About Eclipse IDE > Installation Details > Configuration. Then look for the system property java.version. If it shows a version lower than 11, then you need to configure Eclipse to run with Java 11+.
The second issue looks like a subsequent error. Since ch.acanda.eclipse.pmd.java couldn't be installed, all plugins that depend on this plugin cannot be installed either. Why org.eclipse.equinox.p2.iu is also mentioned in the error message is unclear to me since eclipse-pmd does not (directly) depend on this plugin and it should be a plugin installed by default in Eclipse.
If this does not fix your problem, then please open a new issue on Github as it is easier to help with problems like this on Github than on Stack Overflow.

You need to run Eclipse with a Java 11 JRE. This is normally done by insuring you have JAVA_HOME set to Java 11, and JAVA_HOME in your path. Alternatively, you can modify eclipse.ini and specify Java 11 as the vm (How to run Eclipse with different Java version?).

Related

Can not execute maven wrapper verify goal in IntelliJ IDEA 2021.2 [duplicate]

Background
I started my first project in android studio to get familiar with Android programming.
I am following this tutorial, in which
I created a new project Empty Activity, without any change
It is supposed to simulate a simple app that shows "Hello World" message
Problem Description
But every time I try to run and build (I want to emulator as of now), I get the following error message.
Unable to make field private final java.lang.String java.io.File.path accessible:
Unable to make field private final java.lang.String java.io.File.path
accessible: module java.base does not "opens java.io" to unnamed module #42760a00
Here is my config set-up:
Android Gradle plugin version: 4.2.1
Gradle Version: 7.0.1 (changed to fix another issue I had while syncing the Gradle ("Gradle sync failed: Unsupported class file major version 60") and based discussion on this forum as quoted below)
Andrey Dernov commented 14 Apr 2021 00:18 Please use Gradle 7.0 or JDK
less than 16 version for importgin and building the project (Settings
(Preferences on macOS) | Build, Execution, Deployment | Build Tools |
Gradle | Gradle JVM option).
JDK: 16.0.1
Any suggestion or idea?
The solution from GitHub has worked for me. It was no need to downgrade Java JDK. Just changed gradle version in gradle-wrapper properties to 7.1.1 (6.x does not support java 16), and adding the following line in gradle.properties:
org.gradle.jvmargs=-Xmx1536M \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
You must be using a JDK version that is not supported by the Gradle Version.
( There is no need to downgrade )
1-Check your JDK Version from C:\Program Files\Java. In My Case, It's JDK-17.0.2
2-Check The Respective Gradle version for your JDK
https://docs.gradle.org/current/userguide/compatibility.html
3-Open gradle-wrapper.properties from .\android\gradle\wrapper\
and change the distributionUrl to your required gradle version
e.g. for JDK 17
distributionUrl = https\://services.gradle.org/distributions/gradle-7.3-all.zip
4-Open build.gradle from .\android\build.gradle
and change the plugin in the class path to the one according to your gradle version
e.g.
classpath("com.android.tools.build:gradle:4.2.2") for Gradle 6.7.1+
classpath("com.android.tools.build:gradle:7.0.0") for Gradle 7+
Check the Compatible Plugin for your Gradle version at
https://developer.android.com/studio/releases/gradle-plugin#updating-gradle
5-run npx react-native run-android
I think I found the solution.
If you are importing an old project you are likely to face this error.
Basically you made your old project with lower JDK versions and now you have higher JDK versions installed currently in your system.
You should avoid higher JDK versions for building older projects.
Basically Download JDK 8 (1.8) and install it.
change environment variable (write JDK 8 path to environment variable)
Then change your project structure and write JDK 8 path to JDK location.
invalidate caches and restart android studio.
build your project and it should work.
If you got the following error:
Error:Cannot fit requested classes in a single dex file.Try supplying a main-dex list. # methods: 72477 > 65536
Then add the following dependency in your app.gradle file:
// multidex
implementation 'com.android.support:multidex:1.0.3'
then you need to enable multidex in your app.gradle file.
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.convenient.easymeasure"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
I found this discussion kind of related to my question.
But could not figure out how to pass JVM parameters in Android studio.
But, the error is gone after replacing JDK 16 by JDK 15.
Run Flutter doctor, if there´s an error indicating that the java bundled can´t be found (specially if you have Android Studio version Artic Fox), run this commands if using Mac:
cd /Applications/Android\ Studio.app/Contents/jre
ln -s ../jre jdk
ln -s "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" jdk
has worked for me in Macbook Air M1 Apple Silicon. you no need to downgrade or uninstall Java JDK.
in my case Just changed gradle version in gradle-wrapper.properties to 7.2
like this :
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
and adding the following line in gradle.properties:
org.gradle.jvmargs=-Xmx1536M --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
related solution on github
This is a known issue when using Gson and reflection for parsing Json. Updating your Android Gradle Plugin version to 7.0.0+ and the error should go away.
For those having these issues with the latest Android Studio - Electric Eel version, and other canaries and preview releases, note that the bundled jre directory in the Android Studio installation folder is now renamed to jbr
(This answer came from eja's answer on this question.)
To resolve this, just create a sym link jre -> jbr and Flutter won't complain.
On Linux
cd ~/android-studio/ && ln -s jbr jre
Windows (check installation folder)
cd C:\Program Files\Android\Android Studio
mklink /D "jre" "jbr"
or
New-Item -ItemType SymbolicLink -Path .\jre -Target .\jbr
Mac OS
cd /Applications/Android\ Studio.app/Contents
ln -s jbr jre
Note that if you are running a preview release, the default installation directory might be different, e.g. on Linux it would be
~/android-studio-preview/
You must be using JDK-16, use the version below JDK-16, in my case, I downgrade to JDK-11 and it worked for me.
I downloaded 2 JDK jdk-17.0.1 and jdk-11.0.13 and add below line on gradle.properties
org.gradle.java.home=C\:\\Program Files (x86)\\Java\\jdk-11.0.13
Also go to Android Studio (Arctic Fox)-> Project Structure -> Gradle setting and choose JDK version
I was able to fix it by upgrading grade project settings using Android Studio which replaced
classpath("com.android.tools.build:gradle:4.2.2") with classpath('com.android.tools.build:gradle:7.0.3') in android/build.gradle
Had same problem with Flutter.
I uninstalled Android Studio and Android SDK and reinstalled everything and upgraded Flutter, without success.
Then I created a new Flutter project and copied the sources from the old one, and this time it worked.
Installing JDK 1.8.0 and setting JAVA_HOME path to JDK 1.8.0's folder in environment variables worked for me.
Just added from another solution
If you have later version installed, and your project is using older version. Don't forget to check in terminal which jdk is used.
In my case my project using JDK 15. And terminal using 18. So i uninstall the other version and leaving the proper version (in my mac, just delete another jdk directory in /Libray/Java/JavaVirtualMachine)
I had the same issue with a Flutter 2 project after updating Android Studio to electric eel. I was still able to build the android project, but flutter run on the Flutter project would cause this issue. lortschi's answer was the key, but it was missing one more entry to make it work, so my final gradle.properties looks like this now:
org.gradle.jvmargs=-Xmx1536M \
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED \
--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
android.useAndroidX=true
android.enableJetifier=true
I was very skeptical, but it worked.
Windows user:
Go to C:\Users\arpan.gradle\caches and delete all the gradle cache.
then,
Go to "C:\Program Files\Android\Android Studio" there you will see jbr and jre folder then copy the content of jbr and paste the content into jre folder.
ss:
and run flutter doctor again and run your App.
Check if JDK is installed or not configure your SDK also and try again
you can download JDKfrom Java SE
After I updated jdk to 18 then I got this error mention I the question. so I downgraded to jdk11. to install jdk11 please run this command I windows 10. choco install openjdk11. Hope it will fix your problem.
To run the above command you must have to install chocolatey and add it to path. chocolatey is dependency manager for windows 10. Here is link to guide
Here is the link https://community.chocolatey.org/packages/openjdk11

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

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)

Modifying the source code of PMD

I want to modify the source code of PMD, but I don't know how to compile and use this modifying PMD with Eclipse as a plug-in.
I read this Compiling PMD instruction but I didn't understand it very well.
can you help me please?
My Eclipse platform version: 4.3.2
PMD version: pmd-src-5.4.1
Operating System: windows 7

Installing Glassfish tools in eclipse luna

Im trying to install Glassfish tools in eclise Luna but I keep getting this error message:
Cannot complete the install because one or more required items could not be found.
Software being installed: GlassFish Tools 7.3.3.201412231459 (oracle.eclipse.tools.glassfish.feature.group 7.3.3.201412231459)
Missing requirement: GlassFish Tools 7.3.3.201412231459 (oracle.eclipse.tools.glassfish.feature.group 7.3.3.201412231459) requires 'org.eclipse.sapphire.feature.group [8.1.0,8.2.0)' but it could not be found
What should I do? Thanks.
It looks like they somehow messed up the plugin dependencies while packaging the plugin version which is currently referenced by the .
To fix it you have to install an slightly older version of the Glassfish Tools manually. To do this in Eclipse click on Help -> Install new software and put the following URL in the upper input field:
http://download.oracle.com/otn_software/oepe/12.1.3.1/luna/repository
Then click enter, after it has fetched the installable packages, choose the Glassfish Tools package and the Oracle Java EE Tools package (both should be version 7.2.0.xxx) and install. The installation can take a while because the oracle repository site is often slow.
See also:
How to configure Glassfish Server in Eclipse Luna manually
Define a New Server choosing GlassFish 3.1 gives Internal Error - Eclipse Luna
see on eclipse marketplace the minimum version of Java required to run GlassFish Tools.
Mars - Java 8
Luna - Java 8
Kepler - Java 7
Juno - Java 6
See more at:
https://marketplace.eclipse.org/content/glassfish-tools
Go with Eclipse Luna + RedHat JBoss WildFly 8.2, which is working just fine.

IBM Worklight 6.0 - Installation fails on Eclipse 4.3 "Kepler"

I'm getting the following problem while trying to install Worklight 6 into Eclipse 4.3 "Kepler":
Cannot complete the install because one or more required items could not be found.
Software being installed: IBM jQuery Mobile Tools 6.0.0.201306140658 (com.ibm.webtools.jquery.tools.feature.feature.group 6.0.0.201306140658)
Missing requirement: IBM Web Editor Common 1.2.0.v20130514_1852 (com.ibm.etools.webtools.webedit.common 1.2.0.v20130514_1852) requires 'bundle com.ibm.icu [4.2.1,5.0.0)' but it could not be found
Cannot satisfy dependency:
From: IBM Worklight Studio 6.0.0.201306140657 (com.ibm.imp.tools.feature.feature.group 6.0.0.201306140657)
To: com.ibm.imp.webtools.core.feature.feature.group 1.0.0
Cannot satisfy dependency:
From: Web Tools Core 1.2.0.v20130514_1852 (com.ibm.imp.webtools.core.feature.feature.group 1.2.0.v20130514_1852)
To: com.ibm.etools.webtools.webedit.common [1.2.0.v20130514_1852]
Cannot satisfy dependency:
From: IBM jQuery Mobile Tools 6.0.0.201306140658 (com.ibm.webtools.jquery.tools.feature.feature.group 6.0.0.201306140658)
To: com.ibm.imp.tools.feature.feature.group 6.0.0
I've tried both the marketplace method and installing from a local archive produces the same error. Sounds like a dependency issue but I'm not clever enough to workout what I'm missing.
Worklight 6.0 supports ONLY Eclipse for Jave EE Developers 4.2.2 ("Juno" SR2) or Eclipse Classic 4.2.2 ("Juno" SR2).
Worklight 6.0 will not work on prior versions of Eclipse.
Worklight 6.0 will not work on Eclipse 4.3 "Kepler" - there is no support for it, yet.
After you installed Worklight on 4.2.2 if it does not show up inside of eclipse, try the following
run eclipse withe the -clean option from the command line/terminal
ex.
$ ./eclipse -clean
then restart eclipse as normal, YMMV but it seem to do the trick for most folks with this problem.
This issue is due to corporate proxy.
Main requirement is it supports ONLY Eclipse for Jave EE Developers 4.2.2 ("Juno" SR2) or Eclipse Classic 4.2.2 ("Juno" SR2).
Apart from this you have to do following things to make it work
Window-->Preferences-->General-->Network connection
In drop down list changes Active Provider to Manual and in http/https put address and port number of your proxy.
Worklight 6.1 was released on the 6th of December, and now Kepler is supported.
http://marketplace.eclipse.org/content/ibm-worklight-developer-edition#.UqcEQZNQHIc