Not able to find JAVA in schroot - ubuntu-18.04

I am trying compile AOSP code using schroot in ubuntu 18.04 64 bit.
Not able to find java in schroot.
$java -version
bash: java: command not found
If I open another terminal and enter java version command its working. like below
java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

Do you have the jdkX repo synced in? AOSP provides the prebuilts, for android 10, it is jdk9. For example, if I run the following command I get openjdk9:
. build/envsetup.sh && lunch aosp_blueline-userdebug
which java && java --version
Output:
prebuilts/jdk/jdk9/linux-x86/bin/java
openjdk 9
OpenJDK Runtime Environment (build 9+181-android4685155)
OpenJDK 64-Bit Server VM (build 9+181-android4685155, mixed mode)
Try running your java commands after lunch.

Related

Cordova Android build error “Cannot read property 'version' of null”

I'm trying to run the the cordova build Android command and it's failing. Error message output:
$> cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Android (recommended setting)
ANDROID_HOME=C:\Android (DEPRECATED)
Cannot read property 'version' of null
I have the latest version of cordova, gradle and the Java 8 JDK installed. And all the environments are set. I have no idea what could be the issue.
$ gradle -v
------------------------------------------------------------
Gradle 7.1.1
------------------------------------------------------------
Build time: 2021-07-02 12:16:43 UTC
Revision: 774525a055494e0ece39f522ac7ad17498ce032c
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_301 (Oracle Corporation 25.301-b09)
OS: Windows 10 10.0 amd64
$ cordova --version
10.0.0
$ java -version
java version "1.8.0_301"
Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)
Removing and re-adding the platform resolved my issue.
cordova platform rm android
cordova platform add android

Application Crashing:A fatal error has been detected by the Java Runtime Environment:[libsystem_platform.dylib+0x15d2] _platform_strlen+0x12

I am running Sencha Cmd v6.7.0.63 and while running "Sencha app watch" the app is crashing with below error. I am running the app on Mac OS.
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0x00007fff2039c5d2, pid=2170, tid=26375
JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build 1.8.0_45-b14)
Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode bsd-amd64 compressed oops)
Problematic frame:
C [libsystem_platform.dylib+0x15d2] _platform_strlen+0x12

Installing Android SDK Manager on Ubuntu 18.04

I'm trying to install Android SDK (not Studio) following this tutorial - https://linoxide.com/linux-how-to/install-android-sdk-manager-ubuntu/
When running sdkmanager --list I was getting the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
So amended the file ~/android-sdk-tools/bin/sdkmanager and amended the following line to be:
DEFAULT_JVM_OPTS='"-Dcom.android.sdklib.toolsdir=$APP_HOME" -XX:+IgnoreUnre cognizedVMOptions --add-modules java.se.ee'
Now the error doesn't show, but when I run sdkmanager --list it just hangs without any response.
If it helps, here's my versions of java etc:
$ java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.2)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.2, mixed mode)
$ javac -version
javac 10.0.2
Java version 9 and 10 are not supported for android sdk, downgrade your java version 8 or less.

Which release is stable?

i am trying to play with apache-flink, with the set of examples and i am trying to compile them from scratch using GitHub code in order to run them using the flink install from brew command.
It's funny but the brew installation does not include any of the examples, so I am forced to install them from the sources in GitHub.
The problem is i cannot compile the examples because of some errors. I understand that this compiling error can happen, i only need one stable branch to run the projects as described in the official link.
I am using this settings:
java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
mvn -version
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
Maven home: /usr/local/Cellar/maven/3.5.0/libexec
Java version: 10.0.1, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
Default locale: es_ES, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.4", arch: "x86_64", family: "mac"
This is the link of release-1.5 compile.
This is the link of release-1.3 compile.
This is the link of master compile.
Which release is stable?
EDIT
After #FabianHueske advice, i downgraded the maven version:
flink aironman$ mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: /usr/local/Cellar/maven#3.2/3.2.5/libexec
Java version: 10.0.1, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home
Default locale: es_ES, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.4", arch: "x86_64", family: "mac"
MacBook-Pro-Retina-de-Alonso:flink aironman$ jenv versions
system
1.7
1.7.0.51
1.8
1.8.0.172
10.0
10.0.1
oracle64-1.7.0.51
* oracle64-1.8.0.172 (set by /Users/aironman/.jenv/version)
oracle64-10.0.1
MacBook-Pro-Retina-de-Alonso:flink aironman$ java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
This is the output of the compiling of the tag release-1.5.0.
I realize that maven is trying to use version 10.0.1 of the jdk, although the command java -version says I'm using version 1.8, it might be a problem with my maven and jdk configuration?
You can only compile Flink with java 8, according to the exceptions during the build you're using java 9+.

How to find if it's 32 or 64 bits? Tomcat

I recently downloaded Tomcat 7.x as a zip. Running the version.bat gives the following:
c:\apache-tomcat-7.0.19\bin>version
Using CATALINA_BASE: "C:\apache-tomcat-7.0.19"
Using CATALINA_HOME: "c:\apache-tomcat-7.0.19"
Using CATALINA_TMPDIR: "C:\apache-tomcat-7.0.19\temp"
Using JRE_HOME: "C:\Program Files (x86)\Java\jdk1.6.0_29"
Using CLASSPATH: "c:\apache-tomcat-7.0.19\bin\bootstrap.jar;C:\apache-tomcat- 7.0.19\bin\tomcat-juli.jar"
Server version: Apache Tomcat/7.0.19
Server built: Jul 13 2011 11:32:28
Server number: 7.0.19.0
OS Name: Windows Server 2008 R2
OS Version: 6.1
Architecture: x86
JVM Version: 1.6.0_29-b11
JVM Vendor: Sun Microsystems Inc.
Since it's using the 32 bit version of JRE, is it a safe assumption the Tomcat itself is 32-bit?
In the Tomcat bin folder, there is version.bat (version.sh for linux) script. Run it to get version and architecture information. Here is example output for Tomcat 7.062 running 32 bit (x86) on Windows:
C:\KBData\Software\apache-tomcat-7.0.62\bin>version
Using CATALINA_BASE: "C:\KBData\Software\apache-tomcat-7.0.62"
Using CATALINA_HOME: "C:\KBData\Software\apache-tomcat-7.0.62"
Using CATALINA_TMPDIR: "C:\KBData\Software\apache-tomcat-7.0.62\temp"
Using JRE_HOME: "C:\Program Files (x86)\Java\jdk1.7.0_25\"
Using CLASSPATH: "C:\KBData\Software\apache-tomcat-7.0.62\bin\bootstrap.ja
r;C:\KBData\Software\apache-tomcat-7.0.62\bin\tomcat-juli.jar"
Server version: Apache Tomcat/7.0.62
Server built: May 7 2015 17:14:55 UTC
Server number: 7.0.62.0
OS Name: Windows 7
OS Version: 6.1
Architecture: x86
JVM Version: 1.7.0_25-b17
JVM Vendor: Oracle Corporation
The Windows distributions contain executables and a DLL to run Tomcat as a service. You can unzip the download & run Dependency Walker (free) or dumpbin.exe (comes with MS Visual Studio) on the executable to see which processor architecture they support.
See this question for more details: In windows,how do we identify whether a file is 64 bit or 32 bit?
Java programs aren't 32-bit or 64-bit as native programs are. They run in a virtual machine with a standard architecture. Only the JRE, which implements the virtual machine, is 32-bit or 64-bit.

Resources