jrgray
jrgray

Reputation: 415

How to install octave with java on OS X using homebrew?

I need to install octave with java 8 support, via homebrew, on OS X 10.12.2. I did brew install octave --with-docs, and it seemed to compile normally. I can start octave, but it lacks java support, which I need. From the octave console:

>> javaMethod('getProperty','java.lang.System','java.version')
error: javaMethod: support for Java was unavailable or disabled when Octave was built
>> octave_config_info ("features").JAVA
ans = 0

The only warning during the brew install was:

==> make install
Warning: homebrew/science/octave dependency gcc was built with a different C++ standard
library (libstdc++ from clang). This may cause problems at runtime.

I have previously installed: xcode and command line tools; brew update && brew upgrade; brew install gcc; brew install Caskroom/cask/java (and then command line java -version returns: "1.8.0_112"); and command line /usr/libexec/java_home returns: /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home

The only info that google finds is about how to compile withOUT java. The default is to compile with java, so I am suspecting that brew is not aware of the java 1.8 that is installed (despite it being installed by brew earlier today, and accessible by command line, and via /usr/libexec/java_home).

Upvotes: 1

Views: 660

Answers (1)

jrgray
jrgray

Reputation: 415

Apparently the process changed recently and the wider documentation has not caught up (that I could find).

Solution: You now need to brew install octave --with-java to get java support.

Now in octave I get:

>> javaMethod('getProperty','java.lang.System','java.version')
ans = 1.8.0_112

Upvotes: 3

Related Questions