Version of Jdk on my machine

Hello,

Please, i ask what command linux used to know the version of jdk installed on my machine ?

Thank you so much.

 
java -version
1 Like

I have a question please about jdk, i have used in my code the function renameTo in my code java,
I ask please is that possible that a function in java operates correctly with a version of jdk and not with others (exp openjdk-6-jdk ) ?

you can get the java version using the below code

String version = System.getProperty("java.version");

then compare the version with your expected version, then do the rename

i have added this instruction to my code:
The version is 1.6.0_20
with this version of jdk the renameTo works well
but with openjdk-6 not
how can i do please ?
see this url please: http://docs.oracle.com/javase/7/docs/api/java/io/File.html\#renameTo(java.io.File)

can you explain more of the below line

but with openjdk-6 not

the same code run correctly on a machine with jdk: java version "1.6.0_20" OpenJDK Runtime Environment (IcedTea6 1.9.13) (6b20-1.9.13-0ubuntu1~10.10.1) OpenJDK Client VM (build 19.0-b09, mixed mode, sharing) but with other machine with jdk openjdk-6-jdk does not work :::

At run time the program does not rename the file (it does not moving the file).. i have an error when the programm will use the file in the new destination (when i insert command linux mv in my code java it works !!!)

can you post your code here

i am using this java version

$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.3) (6b24-1.11.3-1ubuntu0.11.10.1)
OpenJDK Client VM (build 20.0-b12, mixed mode, sharing)
1 Like

My code is so complicated , many classes with many .jars , just a question please:
what's the version of openjdk6 (when i write $ java -version)? for the moment i can't acced to the machine where i have installed openjdk6