How check JAVA / JDK version?

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,399
I'm a bit concerned about whether I have the Oracle version (which I cannot use commercially without paying) of Java JDK installed on my Windows computer.

How do I check what I have?
 
Open a terminal.
If it's in the system path just type either java -version or
Code:
java -XshowSettings:properties -version
With Cerberus. Setting the JDK_PATH will always override any system installed java.
 
If you are using the in-build JDK of Android Studio (default JDK_PATH), this is a fork of OpenJDK called Jetbrains runtime
 
Thanks, I use Win10 / Win11 with Cerberus-X, Visual Studio, and Android Studio installed. I don't think I ever installed any Java manually.

Java -version showd that I have OpenJDK 11 installed, which is eactly what I needed.
What is the difference between the two ways of specifying the -version parameter?

I also saw that you can do javac -version, does that work as well? How is JDK and Java different?
 
What is the difference between the two ways of specifying the -version parameter?
Passing the show setting properties will show everything on that java installation.
I also saw that you can do javac -version, does that work as well? How is JDK and Java different?
The difference is that Java is solely a runtime, where as the other is the Java Development Kit, which not only contains the compiler and development files, but also contains a runtime.
I also saw that you can do javac -version, does that work as well?
Not normally with it being the java compiler, e.i. compiles java sources into byte code (aka p-code) and will only show the java version number.
 
Thanks for clearing that up, I find java to be a mess to install Java manually when there's a version missmatch.
 
I find java to be a mess to install Java manually when there's a version missmatch.
If you have multiple version installed. It's best to write a batch file to set the binary and class path that then opens a new shell or application.
 
I reinstalled with win11 now and first i checked Java -version it said "Java is not reconized as an internal or external operable program or batch file". So I installed Android Studio ontop of that, but I still got the same answer? I don't get it?

I noticed Android Studio had alot of opening and closing DOSboxes saying requiring admin access a thousand times but the seemed different and Win11 and this version of Android Studio is new to me so I cant say if thats standard bevhaviour. Either way it seems that Java / JDK isnot available on my machine. Is there a chance to get this back to the state it was with Win10and OpenJDK11?
 
You won't see java if it's installed with Android Studio. The JDK that comes with it, is only for that version.
You will only see it system wide if the environment paths are set to the installation of the one in Android Studio.
The process is some thing like this:
From the task bar search, type environment: environment and select the Edit the system environment variables button.
In the System Properties dialogue box, under the Advanced tab click the Environment Variables button.
In the User variables for .... click New
Enter in the Variable name: JAVA_HOME
Enter in the Variable value: C:\Program Files\Android\Android Studio\jbr

In the User variables for .... Select the item called Path and click the Edit button.
Select the Variable value edit box and add %JAVA_HOME%\bin; to the beginning of the line.
Tip: Hit the Home key on the keyboard to go to the front of the line after selecting the edit box.

Click the OK button and open up a terminal and test out if the path works.
 
Last edited:
Is there a chance to get this back to the state it was with Win10and OpenJDK11?
Check the Microsoft web site on how to revert back to a previous version of Windows. You usually something like a 30 day time limit.
 
I was trying something that needed JDK11 but there was something wrong with Gradle or whatever. Iknow that have so much to learn and I never get to it so it gets frustrating instead.

I got JDK 11 fianlly and as Cerberus-X broke down I reverted it to 8 again.

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)


But Cerberus-X still somehow got affected I do not even understand how.

Code:
Compiling log
-------------
TRANS cerberus compiler V2023-04-06
Parsing...
Modpath error - import=functions, existing=impo
Semanting...
Translating...
Building...
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: root project 'android', project ':app'
> Task :app:clean
> Task :app:preBuild UP-TO-DATE
> Task :app:preReleaseBuild UP-TO-DATE
> Task :app:compileReleaseAidl NO-SOURCE
> Task :app:compileReleaseRenderscript NO-SOURCE
> Task :app:generateReleaseBuildConfig
> Task :app:javaPreCompileRelease
> Task :app:writeReleaseApplicationId
> Task :app:analyticsRecordingRelease
> Task :app:checkReleaseAarMetadata
> Task :app:generateReleaseResValues
> Task :app:generateReleaseResources
> Task :app:createReleaseCompatibleScreenManifests
> Task :app:extractDeepLinksRelease
> Task :app:processReleaseMainManifest FAILED
> Task :app:mergeReleaseResources

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
11 actionable tasks: 11 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseMainManifest'.
> 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 @33c57701

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 20s
TRANS FAILED: Android build failed.
Done.
 
Go into your user home directory and look for .gradle and delete it.
 
I deleted the .gradle and when that did not work i delete Android Studio and reinstalled and update it,still same error?
 
Did you delete the build folder before a new build? This often helps.
From the compiler message I think you don't use the latest version of CX. I think I removed jcenter there.
 
Got it working now, thanks for the help both of you!

Code:
"/Applications/cerberus/bin/transcc_macos" -target=Android_Game -config=Release -run "/Users/**************/test.cxs"
TRANS cerberus compiler V2023-04-06
Parsing...
Modpath error - import=functions, existing=impo
Semanting...
Translating...
Building...
Starting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for details
WARNING:: Please remove usages of `jcenter()` Maven repository from your build scripts and migrate your build to other Maven repositories.
This repository is deprecated and it will be shut down in the future.
See http://developer.android.com/r/tools/jcenter-end-of-service for more information.
Currently detected usages in: root project 'android', project ':app'
> Task :app:clean UP-TO-DATE
> Task :app:preBuild UP-TO-DATE
> Task :app:preReleaseBuild UP-TO-DATE
> Task :app:compileReleaseAidl NO-SOURCE
> Task :app:compileReleaseRenderscript NO-SOURCE
> Task :app:generateReleaseBuildConfig
> Task :app:javaPreCompileRelease
> Task :app:writeReleaseApplicationId
> Task :app:analyticsRecordingRelease
> Task :app:checkReleaseAarMetadata
> Task :app:generateReleaseResValues
> Task :app:generateReleaseResources
> Task :app:createReleaseCompatibleScreenManifests
> Task :app:extractDeepLinksRelease
> Task :app:mergeReleaseResources
> Task :app:processReleaseMainManifest
> Task :app:processReleaseManifest
> Task :app:mergeReleaseJniLibFolders
> Task :app:mergeReleaseNativeLibs NO-SOURCE
> Task :app:stripReleaseDebugSymbols NO-SOURCE
> Task :app:extractReleaseNativeSymbolTables NO-SOURCE
> Task :app:mergeReleaseNativeDebugMetadata NO-SOURCE
> Task :app:mergeReleaseShaders
> Task :app:compileReleaseShaders NO-SOURCE
> Task :app:generateReleaseAssets UP-TO-DATE
> Task :app:mergeReleaseAssets
> Task :app:checkReleaseDuplicateClasses
> Task :app:compressReleaseAssets
> Task :app:desugarReleaseFileDependencies
> Task :app:processReleaseManifestForPackage
> Task :app:mergeExtDexRelease
> Task :app:processReleaseJavaRes NO-SOURCE
> Task :app:collectReleaseDependencies
> Task :app:mergeReleaseJavaResource
> Task :app:processReleaseResources
> Task :app:sdkReleaseDependencyData

> Task :app:compileReleaseJavaWithJavac
Note: /Users/************/test.buildv2023-05-26/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/***********/test.buildv2023-05-26/android/app/src/main/java/com/cerberus/cerberusgame/CerberusGame.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :app:compileReleaseSources
> Task :app:lintVitalRelease
> Task :app:dexBuilderRelease
> Task :app:validateSigningRelease
> Task :app:writeReleaseAppMetadata
> Task :app:writeReleaseSigningConfigVersions
> Task :app:processApplicationManifestReleaseForBundle
> Task :app:configureReleaseDependencies
> Task :app:optimizeReleaseResources
> Task :app:parseReleaseIntegrityConfig
> Task :app:mergeDexRelease
> Task :app:bundleReleaseResources
> Task :app:buildReleasePreBundle
> Task :app:packageRelease
> Task :app:assembleRelease
> Task :app:packageReleaseBundle
> Task :app:signReleaseBundle
> Task :app:produceReleaseBundleIdeListingFile
> Task :app:bundleRelease

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 47s
41 actionable tasks: 40 executed, 1 up-to-date
installing /Users/***********/test.buildv2023-05-26/android/app/build/outputs/apk/release/app-release.apk ...
* daemon not running; starting now at tcp:5037
* daemon started successfully
Performing Streamed Install
Success
Starting: Intent { cmp=com.cerberus.cerberusgame/.CerberusGame }
--------- beginning of main
--------- beginning of system
02-07 14:14:20.389 31472 31505 I [Cerberus]: 1384
02-07 14:14:20.389 31472 31505 I [Cerberus]: 720
 
Wow I forgot how amazingly fast Cerberus-X compiles to Android, it's way faster than any other environment that I've tried. It will really speed up my evelopment time. Thanks again
 
Back
Top Bottom