1

I have a java app, which does not wont to work:

Please install Java JRE 1.7.0_45 or a more recent version

I think it checks java version and vendor. Does openJDK have special option to emulate vendor. I don't want to install Oracle Java.

Here is my output of java -version:

openjdk version "1.8.0_74"
OpenJDK Runtime Environment (build 1.8.0_74-b02)
OpenJDK 64-Bit Server VM (build 25.74-b02, mixed mode)

Not a cool solution but works

I have installed Oracle JRE near OpenJDK. On Manjaro (Arch) Linux it is very simple

yaourt -S jre

After instalation complete it will ask you to select default java. archlinux-java status shows installed Java Machines. I have written litle script to run my capricious app with oracle jre:

#!/bin/sh
## Get first JRE from 
jrepath=$(archlinux-java status | grep 'jre' -m1 )
## remove spaces
jrepath=$(echo $jrepath | grep -v -e '^$')
## Compose full path
jrepath="/usr/lib/jvm/$jrepath/bin/java"
## Check if it works DEBUG ${jrepath} -version
${jrepath} -jar path/to/STM32CubeMX

In addition I wanted to run app from the folder where script is:

## Where is script
pushd `dirname $0` > /dev/null
SCRIPTPATH=`pwd -P`  ## -P to resolve symlinks
popd > /dev/null

${jrepath} -jar $SCRIPTPATH/STM32CubeMX
1

No, OpenJDK doesn't do that. Each has a vendor property to identify itself.

The value itself is stored within the JAR-files, e.g., as part of the manifest (see Oracle's documentation for instance). Since the JAR-files are signed, and the API generally prohibits you from changing a system property, there is little to be done to change the version.

Further reading:

0

If your app is looking or Oracle's Java, have you considered that it might be for a reason? If you think that the java version really doesn't matter, you can write a script front end to your java and have it imitate the Oracle java when the version was asked. But I am quite sure version will not be the only thing your app will be checking and you will find yourself writing a very very complex script to filter a lot of different things. It is an idea but I personally do not suggest implementing it.

  • But I am quite sure that non-complicated app would work. And problem is only with Java version checker, which does not expect to see OpenJDK – kyb Oct 21 '16 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.