在Mac上以八度为单位更改JDK版本

时间:2015-07-19 15:14:51

标签: java macos octave

Octave 3.8.2,OS X 10.10.4

我用过

describe('shellController', function() {

  var locals,
      shellController,
      $q;

  beforeEach(module('app'));

  beforeEach(inject(function($controller, $location, $rootScope, _$q_) {

    $q = _$q_;

    locals = {
      $location: $location,
      $rootScope: $rootScope,
      $scope: $rootScope.$new(),
      authenticationService: {
        authenticate: jasmine.createSpy('authenticate')
      },
      authService: {
        loginConfirmed: jasmine.createSpy('loginConfirmed')
      },
      common: {}
    };

    shellController = $controller('shellController', locals);

  }));

  describe('event:auth-loginRequired', function() {

    it('should authenticate user', function() {

      locals.authenticationService.authenticate.and.returnValue($q.when());
      locals.$rootScope.$broadcast('event:auth-loginRequired');

      expect(locals.authenticationService.authenticate).toHaveBeenCalledWith({
        userName: 'visitor',
        password: 'visitor'
      });

    });

    describe('when user authentication succeeds', function() {

      var spy,
          result;

      beforeEach(function() {

        result = {};
        locals.authenticationService.authenticate.and.returnValue($q.when(result));

        spy = jasmine.createSpy('event:username-changed');
        locals.$scope.$on('event:username-changed', spy);

        locals.$rootScope.$broadcast('event:auth-loginRequired');
        locals.$rootScope.$digest();

      });

      it('should broadcast an event `event:username-changed` to all scopes', function() {
        expect(spy).toHaveBeenCalled();
      });

      it('should call authService.loginConfirmed()', function() {
        expect(locals.authService.loginConfirmed).toHaveBeenCalled();
      });

    });

    describe('when user authentication fails', function() {

      var spy;

      beforeEach(function() {
        locals.authenticationService.authenticate.and.returnValue($q.reject());

        spy = jasmine.createSpy('event:username-changed');
        locals.$scope.$on('event:username-changed', spy);

        locals.$rootScope.$broadcast('event:auth-loginRequired');
        locals.$rootScope.$digest();

      });

      it('should not broadcast an event `event:username-changed` to all scopes', function() {
        expect(spy).not.toHaveBeenCalled();
      });

      it('should not call authService.loginConfirmed()', function() {
        expect(locals.authService.loginConfirmed).not.toHaveBeenCalled();
      });

    });

  });


});

检查java版本,我得到了

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

但是,我希望Octave使用JDK 1.7,因此我键入了

ml_jar_version = Java 1.6.0_65

setenv("JAVA_HOME","/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home"); 没有改变。

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

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

ml_jar_version

1 个答案:

答案 0 :(得分:0)

似乎octave读取符号链接'dafault-java',这里: / usr / lib中/ JVM /默认-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

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

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

之后它会继续工作。

八度音阶:

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