error: no class roots are found in the JDK path: /usr/lib/jvm/java-9-openjdk-amd64 - kotlin

I install kotlin and JDK in Ubuntu 16.04 by following the guidelines here https://kotlinlang.org/docs/tutorials/command-line.html
After that created a file Hello.kt,
but when I run this,
kotlinc Hello.kt -include-runtime -d Hello.jar
I got this error
error: no class roots are found in the JDK path: /usr/lib/jvm/java-9-openjdk-amd64
This is the first time of me so basically I don't have any idea what to do.
Do you have?

Ubuntu 16.04 doesn't have Kotlin in the base repositories, so the default Java installation is unlikely to be Kotlin-aware.
If you use SDKMAN! to install Kotlin, you probably need to use the SDKMAN! installation of Java as well.
sdk install java
sdk install kotlin
Verify that you are not using the Ubuntu-stock Java...
$ which java
~/.sdkman/candidates/java/current/bin/java ## you should see '.sdkman' in the path here

For me, this arose because brew upgrade removed one jdk version in favor of another.
Gradle, meanwhile, had cached the reference to the jdk version.
I resolved the issue by removing the gradle cache (rm -r .gradle) and then recompiling.

I think the problem is with your java version.Remove the existing jdk and reinstall the latest one and set the jdk path properly it will resolve your problem.

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

chirp-react-native run-android failing for Java 11 and 12?

Tried to build chirp-react-native with Java 12 and Java 11. Will not build.
If I drop down to Java 1.8 AND set my gradle distributionUrl to gradle-4.8-all.zip in chirp-react-native/android/gradle/wrapper/gradle-wrapper.properties, the package compiles and installs correctly and I think it runs correctly.
However if it's an easy fix I'd prefer to use a current JDK. Has anyone successfully built chirp-react-native using Java 12?
Steps to reproduce:
With Java 12 set in my JAVA_HOME env variable (/Library/Java/JavaVirtualMachines/jdk12-0.1.jdk)
react-native run-android fails with this error:
Could not determine Java version from 12.0.1
If I drop down to Java 11 as JAVA_HOME, I get a similar error message:
Could not determine Java version from 11.0.3
With Java 1.8 and Gradle 4.8, everything appears to build, install and run properly.
This comment describes the reason for this error - https://github.com/facebook/react-native/issues/22487#issuecomment-443759776
You might be able to upgrade the gradle version in the android/build.gradle file.
Can you try to run ./gradlew build from the command line and check for additional log messages in console? It might be that there are some missing dependencies required by your project. What is happening if you remove ChirpSDK from the project? Can you build it with Java 11/12 and without ChirpSDK?

Redhawk IDE will not display Components

When I launch the REDHAWK IDE via Eclipse, I cannot see the installed components (SigGen, fastFilter, etc). I can see the components just fine if I use the command line to create a project. I'm convinced it has to be a path or variable issues, but I just don't know what to reconfigure.
I'm using REDHAWK Version 2.1.0 and on CentOS7
OSSIEHOME is set to the /usr/local/redhawk/core
SDRROOT is set to /var/redhawk/sdr
Any suggestions?
I found a solution by reinstalling and including every Redhawk package that I could find using "yum list redhawk*"
I have the same problem and it turns out I was using a Java version higher than 8 which is not supported by RedHawk. Make sure you use Java 8 to launch the IDE otherwise it does not work. Submitted a DR but because JDK8 still supported they do not feel the need to fix it.
I followed the official installation instructions for RedHawk 2.3.0 on Centos 7.9 and had this same issue, I fixed it by opening a terminal in the Redhawk installation directory and running
sudo yum install redhawk-basic-components-2.3.0-5.el7.x86_64.rpm
After which the components appeared in the IDE without a restart

iReport 5.5.0 won't start

I want to use iReport on ubuntu 12.04. When I try to start it, it stands still and just gives me this error:
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library /tmp/jna4023560596826437553.tmp which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
How can I solve this problem ?
Edit: I tried: execstack -c /tmp/jna4023560596826437553.tmp but that didn't help.
This error seems more related to a JVM problem instead of jasper. Indeed, Java 7 on linux has a feature which blocks code written in C (or other languages like Ruby etc) and linked into Java (the so-called Java Native Interface - JNI) from halting the whole VM if it’s written badly or maliciously.
So, if you're using java version 1.7, getting back to 1.6 should do the trick. But if you want to keep this version, then try a clean uninstall and re-install of java:
Uninstall,
Install
Notice that if you're not running on 1.7 , it could be a compatibility problem. Try to match the right jars required for iReport to get it work on linux.
I'm using ubuntu and I did below,
Opened the ireport.conf
and uncomment jdkhome
and added java 7 paths (since my default is java 8)
jdkhome=/home/bhanuka/Apps/jdk-7u80-linux-x64/jdk1.7.0_80

Undefined symbol: apr_crypto_init during Apache restart?

I attempted to update my version of SVN from 1.7 to 1.8 as per this guide:
http://snippets.khromov.se/subversion-1-8-centos-6/
All seemed to install fine, however now I have an issue when I try to restart Apache:
/usr/sbin/httpd: symbol lookup error: /usr/sbin/httpd: undefined symbol: apr_crypto_init
Does anyone know how to solve this?
Which packages need to be updated?
I had same issue after installing some perl modules.
I did the following to resolve it:
yum remove vulture-common-3.2-185.1.x86_64
cd /usr/lib
ln -sf libaprutil-1.so.0.2.9 libaprutil-1.so.0
ln -sf libapr-1.so.0.2.9 libapr-1.so.0
apr_crypto_init is new with APR-Util 1.4.x. CentOS 6 should already have APR-Util 1.4.x. So either you're not using CentOS 6 which those instructions are made for or you're not using the apr-util/httpd version that comes with CentOS 6.
If you're not using CentOS 6 then I suggest you go get a version built for your distribution from WANdisco's download site (the script that the site you linked to actually is from WANdisco).
If you're using your own httpd version you'll either have to switch or you'll have to build your own copy of Subversion.
I have had similar experiences with other applications using this library and Centos 6.x. I have tracked most of the problems down to using the 'minimum install' version of the OS. From what I have been able to determine, the minimum or light install versions of Centos have a tendency to have older versions of the binaries. For example, my version of APR-Utils are 1.3x even though I am using version 6.6.
This is supposedly done for better stability and backward compatibility from what I can find but it causes some headaches if you aren't aware. You may need to use a more 'complete' version of the OS in order for this library to be the latest version, provided you are starting from scratch.