matlab java 版本_切换matlab使用的JAVA版本

How do I change the Java Virtual Machine (JVM) that MATLAB is using on Windows?

Accepted answer

MATLAB ships with one specific version of the JVM software on Windows depending on the release. MATLAB is fully supported only on these shipped versions of the JVM software. Some components might not work properly under a different version of the JVM software. For example, calling functions in a dynamically linked library that was created with a different JVM software version than that used by MATLAB might cause a segmentation violation error message.

If you choose to change the JVM software version used by MATLAB, you must:

Download and install the desired version of the JRE (Java Runtime Environment) or the JDK (Java Development Kit). The latter contains the JRE and development tools.

Determine the path of the JRE directory within that installation. This varies by platform and whether you downloaded the JRE or JDK (see below).

Set the MATLAB_JAVA environment variable to this path (see below).

Start MATLAB while that environment variable is set (see below).

Setting MATLAB to use new Java

Make sure you download the 32 or 64-bit version of the JDK or JRE, depending on your platform. To determine which platform you have, you can issue the following in MATLAB:

computer(‘arch’)

The JRE is at the parent directory of the directory that contains the file “rt.jar”. For example, if “rt.jar” is at:

C:\Program Files\Java\jre6\lib\rt.jar

you should set the MATLAB_JAVA environment variable to:

C:\Program Files\Java\jre6

To set MATLAB_JAVA:

Click Start

Right click Computer and choose Properties

Click Advanced System Settings and then click the Environment Variables button.

In the system variables section, set (or add) the MATLAB_JAVA system environment variable to the JRE path determined above

This change takes effect on the next launch of MATLAB from an icon, or from a subsequently opened command prompt window.

Verifying the Installation

To verify that MATLAB is using the correct version of the JVM software, type the following at the MATLAB prompt:

version -java

If MATLAB is not using your value of MATLAB_JAVA, you may need to logout and log back in again.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值