Quarkus Install Error [jbang] [ERROR] java.nio.charset.MalformedInputException - quarkus

I am following the Getting Started Guide from the Quarkus site to try out Quarkus. But, when I execute this curl command
curl -Ls https://sh.jbang.dev | bash -s - app install --fresh --force quarkus#quarkusio
the following error is displayed.
[jbang] [ERROR] java.nio.charset.MalformedInputException: Input length = 1
Running quarkus install on Mac (Intel) running Monterey OS and here's my java info:
java --version
java 11.0.6 2020-01-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode)
whereis java
java: /usr/bin/java
which java
/Library/Java/JavaVirtualMachines/jdk-11.0.6.jdk/Contents/Home/bin/java
Can somebody please let me know what I might be doing wrong?
Thanks

I used SDKMAN! to install Quarkus and that seemed to work.

Related

E: Unable to locate package openjdk-11-jdk

I try to create docker image:
It is my Dockerfile:
FROM maven:3-jdk-11
# Common files and utils for build
RUN apt-get update && apt-get install -y make fakeroot rpm dpkg-dev apt-utils wget unzip
RUN apt-get install -y -q software-properties-common desktop-file-utils
# Then Wine with all deps
RUN dpkg --add-architecture i386 && apt-get update
RUN apt-get install -y --install-recommends wine
RUN apt-cache search openjdk
RUN apt-get install -y openjdk-11-jdk
RUN apt install -y openjfx11 libopenjfx-java libopenjfx-jni
RUN apt-get install -y --install-recommends wine32
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64
ENV JAVAFX_HOME /usr/share/java/openjfx11
# And we ready to play with our code
ARG SRCDIR=.
ARG DSTDIR=/usr/src/CryptoStock
ARG CACHEDIR=./cache
# Subject to be used here but should be command line, sic!
# ADD ${CACHEDIR} /root/.m2
# ADD ${SRCDIR} /mnt/src
RUN mkdir -p /root/.m2/repository
COPY settings.xml /root/.m2/settings.xml
COPY settings-security.xml /root/.m2/settings-security.xml
COPY jdk11-build-in-docker.sh ${DSTDIR}/jdk11-build-in-docker.sh
COPY ./static/. ${DSTDIR}/static
COPY ./3rdparty/. ${DSTDIR}/3rdparty
COPY ./winjdk11/. ${DSTDIR}/winjdk
ENV SOURCES /usr/src/CryptoStock
ENV OUTSIDE /mnt/src
RUN dpkg -l '*openjfx*'
RUN dpkg -l '*jdk*'
WORKDIR ${DSTDIR}
CMD [ "sh", "/usr/src/CryptoStock/jdk11-build-in-docker.sh" ]
When I try to build I don't to watch java 11:
Step 6/27 : RUN apt-cache search openjdk
---> Running in e03b4c69fa69
jtreg - Regression Test Harness for the OpenJDK platform
openjdk-8-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-8-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-8-doc - OpenJDK Development Kit (JDK) documentation
openjdk-8-jdk - OpenJDK Development Kit (JDK)
openjdk-8-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-8-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-8-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-8-jre-zero - Alternative JVM for OpenJDK, using Zero/Shark
openjdk-8-source - OpenJDK Development Kit (JDK) source files
openjdk-8-jre-dcevm - Alternative VM for OpenJDK 8 with enhanced class redefinition
uwsgi-plugin-jvm-openjdk-8 - Java plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-jwsgi-openjdk-8 - JWSGI plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-ring-openjdk-8 - Closure/Ring plugin for uWSGI (OpenJDK 8)
uwsgi-plugin-servlet-openjdk-8 - JWSGI plugin for uWSGI (OpenJDK 8)
Removing intermediate container e03b4c69fa69
---> 1fae3b35c58b
Step 7/27 : RUN apt-get install -y openjdk-11-jdk
---> Running in 288fb5247ce6
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package openjdk-11-jdk
The command '/bin/sh -c apt-get install -y openjdk-11-jdk' returned a non-zero code: 100
There is only java 8, there is no java 11.
OpenJDK 11 is installed by default in the maven:3-jdk-11 image:
$ docker run maven:3-jdk-11 java --version
openjdk 11.0.16 2022-07-19
OpenJDK Runtime Environment 18.9 (build 11.0.16+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.16+8, mixed mode, sharing)
It is also available via the Debian package system:
$ docker run maven:3-jdk-11 sh -c 'apt update && apt-cache search openjdk-11'
[...]
openjdk-11-dbg - Java runtime based on OpenJDK (debugging symbols)
openjdk-11-demo - Java runtime based on OpenJDK (demos and examples)
openjdk-11-doc - OpenJDK Development Kit (JDK) documentation
openjdk-11-jdk - OpenJDK Development Kit (JDK)
openjdk-11-jdk-headless - OpenJDK Development Kit (JDK) (headless)
openjdk-11-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-11-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-11-jre-zero - Alternative JVM for OpenJDK, using Zero
openjdk-11-source - OpenJDK Development Kit (JDK) source files
[...]
Today the maven:3-jdk-11 image is using Debian 11 (Bullseye), but when you wrote your question the maven:3-jdk-11 image was probably using a Debian 9 (Stretch) image with OpenJDK 11 installed but not available through the Debian package system. This explains your error.

Using Gradle with OpenJDK 1.9

I cannot seem to use Gradle with OpenJDK 1.9.
When I run the following command:
react-native run-android
I end up getting this error.
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '9-internal'.
Running java -version shows me:
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
Any ideas how I can fix this?
Which version of gradle are you using?
cd android
./gradlew -version
I think there was a bug determining versions for java 1.9 which was fixed in Gradle 2.10.
Another option is to try spoofing a java.version that Gradle can parse
export JAVA_TOOL_OPTIONS='-Djava.version=1.9'
react-native run-android
#see JavaVersion.java and JavaVersionSpec.groovy
This seems to be an incompatibility with your build of OpenJDK 9 and Gradle.
Your OpenJDK version is:
openjdk version "9-internal"
And it appears Gradle can't parse it:
Could not determine java version from '9-internal'.
Looks like gradle is prepared to accept 9-ea, but not 9-internal.
You will have to modify your build of OpenJDK to have it return "9-ea" or something similar for java -version.
The following configure options when building OpenJDK 9 should do the trick:
configure \
--with-version-pre="ea" \
--with-version-opt="" \
... your other options ...
I had the same exact issue and, in my case, it worked by removing OpenJDK:
sudo rm /var/lib/dpkg/info/openjdk-*
sudo apt-get purge openjdk-*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update
and installing the Oracle Java SDK:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
I know this is not the exact answer (using Gradle with OpenJDK 1.9), but I managed to keep going and run the app both in a virtual device and in my smartphone. Hope it helps.
Note: I am running react-native: 0.40.0 and react-native-cli: 2.0.1 in Ubuntu 16.04

hadoop -version giving me wrong result why? Hadoop 1.2.1

I executed below command: hadoop -version on hadoop version 1.2.1
vishrant#ubuntu:~$ hadoop -version
java version "1.7.0_79"
OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu0.12.04.1)
OpenJDK Server VM (build 24.79-b02, mixed mode)
I was expecting hadoop version but I got the version of JDK installed on my system. I know that correct command is hadoop version [without hyphen] but instead of getting error I got the version of JDK why?
It looks like the hadoop script for 1.2.x has much less checking than more recent versions, at this point (2016) its about 3 years old. You can see the source for it here.
In the 1.2.x script if you type hadoop -version the script will hit the final else statement where it works out what class to run and sets $CLASS to $COMMAND (line 338) instead of a class.
You can see what it will run on line 434:
exec "$JAVA" -Dproc_$COMMAND $JAVA_HEAP_MAX $HADOOP_OPTS -classpath "$CLASSPATH" $CLASS "$#"
So if you type hadoop version it will run (removed classpath stuff to keep it short):
java -Dproc_version -Xmx1000m -classpath <LIBS> org.apache.hadoop.util.VersionInfo
If you type hadoop -version you get:
java -Dproc_-version -Xmx1000m -classpath <LIBS> -version
So because the default behavior is to set $CLASS to $COMMAND you basically end up with it running:
java -version
Which is what you're getting.

gradle -v does not work and gives java errors

I can't seem to get gradle to install on work on opensuse 13.2.
Installed by:
sudo unzip -oq gradle-2.2.1-all.zip -d /opt/gradle
sudo ln -sfn gradle-2.2.1 /opt/gradle/latest
export GRADLE_HOME=/opt/gradle/latest
export PATH=$GRADLE_HOME/bin:$PATH
running gradle:
$gradle -v
java.lang.NoClassDefFoundError: org.gradle.util.CollectionUtils
at java.lang.Class.initializeClass(libgcj.so.14)
at org.gradle.internal.classpath.DefaultClassPath.<init>(DefaultClassPath.java:37)
at org.gradle.api.internal.classpath.EffectiveClassPath.<init>(EffectiveClassPath.java:32)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.<init>(DefaultModuleRegistry.java:61)
at org.gradle.api.internal.classpath.DefaultModuleRegistry.<init>(DefaultModuleRegistry.java:55)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:44)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableList not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/opt/gradle/gradle-2.2.1/lib/gradle-launcher-2.2.1.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.ClassLoader.loadClass(libgcj.so.14)
at java.lang.Class.initializeClass(libgcj.so.14)
...7 more
Have you tried adding the symlink in /usr/bin?
Like this:
sudo ln -s /opt/gradle/latest/bin/gradle /usr/bin/gradle
It worked for me in openSuse 13.2
Make sure gradle is using Java 1.8
> $JAVA_HOME/bin/java -version
Should return
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (IcedTea 3.8.0) (build 1.8.0_171-b11 suse-24.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
My box had $JAVA_HOME linked to Java 1.5

tomcat7 UnsupportedClassVersionError when running with java7

problem: when deploying my war to tomcat7 i get the error
java.lang.UnsupportedClassVersionError: org.MyLibraryClass : Unsupported major.minor version 51.0
(this is the error one gets when compiling java with a newer version than the java used when running the code.)
situation, in order:
brand new ubuntu 12.04.1 server 64bit minimal, in a virtualbox
installed tomcat6
tried to deploy my war
realized the error, and that i need java7 because ubuntu 12 still comes with outdated java
installed oracle java 7 using this guide https://askubuntu.com/questions/197248/java-on-ubuntu-server-12-04
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
removed tomcat6 and installed tomcat7
sudo apt-get remove tomcat6-common
sudo apt-get install tomcat7
deployed my war to tomcat7
started tomcat
sudo service tomcat7 start
checked my app's log file. same error.
echo $JAVA_HOME is empty, java -version shows:
java version "1.7.0_07"
Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)
it's a default tomcat7 install, no modification. still i checked the startup scripts and config to make sure no custom java version is specified anywhere. also checked by asking catalina:
ubuntu#ubuntu:/home$ /usr/share/tomcat7/bin/catalina.sh version
Using CATALINA_BASE: /usr/share/tomcat7
Using CATALINA_HOME: /usr/share/tomcat7
Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
Using JRE_HOME: /usr
Using CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.26
Server built: Jul 19 2012 03:21:30
Server number: 7.0.26.0
OS Name: Linux
OS Version: 3.2.0-29-generic
Architecture: amd64
JVM Version: 1.7.0_07-b10
JVM Vendor: Oracle Corporation
now i'm stuck. i don't see how any java code could fail to run on oracle's jre7.
my war is a brand new very basic hello world grails 2.1 app with maven, which has a maven dependency (org.MyLibraryClass) that is compiled with jdk7. that's the one for which i get the error.
in grails i changed BuildConfig.groovy to have 1.7 instead of 1.6:
grails.project.target.level = 1.7
grails.project.source.level = 1.7
then did a grails clean, rebuild, war, redeploy. no change.
any idea what to try next?
Typical error when compiling code with Java7 and running it under Java6.
The critical line in your query is this one I think:
sudo service tomcat7 start
I think it may be triggering the inheritance of OpenJDK still in the system there. What you want to do is instead try tomcat from your own environment.
Login as your normal user
java -version
/usr/share/tomcat7/bin/startup.sh
and check. You should also login as a clean user, root or elsewhere and check java -version to check.
If all else fails, go to /etc/profile and make sure path to Oracle's Java/bin directory is the very first thing in the PATH variable for the environment.
I have the same problem just now,but now it's solved.
Please check this symbolic
/usr/lib/jvm/default-java
it's default link is open-jdk, reset the correct jdk dirctory.
good luck!

Resources