R is looking for the wrong version of java

I installed / uninstalled java jre / jdk now many times and finally installed an older version 1.6.0_17, which is now located in the folder "C: \ Program Files \ Java \ jre6 \ bin". In the end, if I call 'java -version' inside R, I see that R is looking for Java along the old path, which is now incorrect. The question arises: why is R looking for Java on the wrong path, even if the file path is set correctly? So far I do not see double entries in the window path, and I have run R again as well as Windows, and then once since. Any ideas where R is taking the wrong path?

In the windows shell:
$>set
[..]
OS=Windows_NT
Path=C:\Program Files\Java\jre6\bin;
[..]

$> java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01, mixed mode)

inside R:
$>system("java -version")
Error: could not open `C:\Program Files (x86)\Java\jre6\lib\i386\jvm.cfg'

+3
source share
4 answers

64/32 .
32- R, 32- 32- java. 64- R, 64- promt java.

, 32- promt ( ):

  • "".
  • %windir%\SysWoW64\cmd.exe " ".
  • Enter.
  • java -version

, 32- java. cmd.exe .

. 32- R 32- Java 64- R ( 2.11) 64- Java. (64- Windows 7) , 32- :

> system("java -version")
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

64-:

> system("java -version")
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)

64- 32- Java, 32- cmd:

shell(
    "java -version",
    shell = file.path(Sys.getenv("windir"),"SysWoW64/cmd.exe")
)
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

, , R 32- cmd. 64- cmd 32- R.

+2

, , JDK 64- , , PATH JAVA_HOME 32- .

, R, ( )

http://www.tipandtrick.net/2008/how-to-open-and-run-32-bit-command-prompt-in-64-bit-x64-windows/

, 'cmd' '% windir%\SysWoW64\cmd.exe'. , JDK , ( , ).

+2

, R , , . : R - .

Windows "java -version", :

C:\>java -version
java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, mixed mode, sharing)

PATH , ( ):

C:\>set path
Path=;C:\JDKs\jdk1.6.0_13\bin;

If I open R version 2.8.1 and start the system ("java -version"), I get the following:

> system("java -version")
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) Client VM (build 14.1-b02, mixed mode, sharing)
>

So, as I said, R does not use my path to search for java.exe. He is using something else.

+1
source

You may also need to check the registry, R may have its own parameter. You can also run regedit and search for the path to the binary file that it runs.

+1
source

Source: https://habr.com/ru/post/1737397/


All Articles