gpt4 book ai didi

java - 在 Mac 上以 Octave 更改 JDK 版本

转载 作者:行者123 更新时间:2023-12-01 22:39:17 26 4
gpt4 key购买 nike

Octave 3.8.2,OS X 10.10.4

我用过

ml_jar_version=javaMethod('getProperty','java.lang.System','java.version');
ml_jar_version=['Java ' ml_jar_version];

检查java版本,我得到了

ml_jar_version = Java 1.6.0_65

但是,我希望 Octave 使用 JDK 1.7,所以我输入了

setenv("JAVA_HOME","/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home");

但是ml_jar_version没有改变。

我的问题是:如何让Octave使用JDK 1.7?

编辑1:我的Octave是通过自制软件安装的。我相信自制程序只是下载了预编译的二进制文件。以下是我的Octave安装配置:

homebrew/science/octave: stable 3.8.2 (bottled), HEAD
a high-level interpreted language for numerical computations.
https://www.gnu.org/software/octave/index.html
/usr/local/Cellar/octave/3.8.2_1 (2111 files, 54M)
Poured from bottle
/usr/local/Cellar/octave/3.8.2_2 (2111 files, 54M) *
Poured from bottle
From: https://github.com/homebrew/homebrew-science/blob/master/octave.rb
==> Dependencies
Build: pkg-config ✔, gnu-sed ✘
Required: pcre ✔, qscintilla2 ✔, qt ✔, pstoedit ✔
Recommended: gnuplot ✔, suite-sparse421 ✔, readline ✔, arpack ✔, fftw ✔, glpk ✔, gl2ps ✔, graphicsmagick ✔, hdf5 ✔, qhull ✔, qrupdate ✔, epstool ✔, ghostscript ✔
Optional: openblas ✘
==> Options
--with-jit
Use the experimental JIT support (not recommended)
--with-native-graphics
Use native OpenGL/FLTKgraphics (does not work with the GUI)
--with-openblas
Use OpenBLAS instead of native LAPACK/BLAS
--without-arpack
Build without arpack support
--without-check
Skip build-time tests (not recommended)
--without-curl
Do not use cURL (urlread/urlwrite/@ftp)
--without-docs
Don't build documentation
--without-epstool
Build without epstool support
--without-fftw
Do not use FFTW (fft,ifft,fft2,etc.)
--without-ghostscript
Build without ghostscript support
--without-gl2ps
Build without gl2ps support
--without-glpk
Do not use GLPK
--without-gnuplot
Do not use gnuplot graphics
--without-graphicsmagick
Build without graphicsmagick support
--without-gui
Do not build the experimental GUI
--without-hdf5
Do not use HDF5 (hdf5 data file support)
--without-java
Build without java support
--without-qhull
Do not use the Qhull library (delaunay,voronoi,etc.)
--without-qrupdate
Do not use the QRupdate package (qrdelete,qrinsert,qrshift,qrupdate)
--without-readline
Build without readline support
--without-suite-sparse421
Do not use SuiteSparse (sparse matrix operations)
--without-zlib
Do not use zlib (compressed MATLAB file formats)
--HEAD
Install HEAD version

最佳答案

Octave 似乎读取了符号链接(symbolic link)“dafault-java”,在这里:/usr/lib/jvm/default-java

$ls -al

drwxr-xr-x 5 root root 4096 нов 19 21:37 .
drwxr-xr-x 181 root root 12288 нов 19 20:45 ..
lrwxrwxrwx 1 root root 14 нов 19 21:37 default-java -> java-8-openjdk-amd64/
lrwxrwxrwx 1 root root 20 апр 23 2016 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64
-rw-r--r-- 1 root root 2600 окт 27 21:06 .java-1.8.0-openjdk-amd64.jinfo
drwxr-xr-x 8 root root 4096 нов 19 20:45 java-7-oracle
-rw-r--r-- 1 root root 2543 нов 19 20:45 .java-7-oracle.jinfo
drwxr-xr-x 7 root root 4096 нов 19 21:37 java-8-openjdk-amd64
drwxr-xr-x 2 root root 4096 нов 16 20:28 openjdk-8

您需要将其更改为指向您的 java 文件夹:

首先删除它:

$sudo rm default-java

然后创建一个新的符号链接(symbolic link)(在我的例子中是 java-7-oracle):

$ln -s java-7-oracle/ default-java

之后应该可以工作。

Octave 音阶:

>> javaMethod('getProperty','java.lang.System','java.version')
ans = 1.7.0_80

关于java - 在 Mac 上以 Octave 更改 JDK 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31502703/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com