I am trying to extract a jar file from Matlab code using javac from Library Compiler (java package).
I have set JAVA_HOME
to:
C:\Program Files\Java\jdk1.7.0_71
and added to PATH
:
C:\Program Files\Java\jdk1.7.0_71\bin
.
When I enter java -version
in my console, I get java version jdk1.7.0_71
and running javac -version
shows jdk1.7.0_71
.
However, it seems that matlab could not find javac, thus, I am not able to compile my .m
code into a .jar
file. When I tried to compile .m code I got the following:
Error: An error occurred while shelling out to javac (error code = -1).
Unable to build executable.
Executing command: ""C:\Program Files\Java\Java\jdk1.7.0_11\bin\javac" -verbose - classpath "...\MATLAB\R2014a\toolbox\javabuilder\jar\javabuilder.jar" -d "...\features_extraction\for_testing\classes" "...\features_extraction\for_testing\features_extraction\Class1.java" "...\features_extraction\for_testing\features_extraction\Features_extractionMCRFactory.java" "...\for_testing\features_extraction\Class1Remote.java" "...\for_testing\features_extraction\package-info.java""
This is the directory of my java bin folder and javac.exe exists : ...\Java\jdk1.7.0_71\bin\bin\javac
? I found this link for compatibility between Java and Matlab2014a(which is my version) here. What should I check in order to correctly link Matlab to Java? A few days ago Matlab was working correctly with Java.
In my PATH
I noticed the existence of the following path: C:\ProgramData\Oracle\Java\javapath
in which there are three wrong shortcuts to java.exe, javac.exe, and javax.exe. When I type in matlab console getenv JAVA_HOME
I am getting C:\Program Files\Java\jdk1.7.0_11
while when I wrote version -java
I got: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
. When I write javac
in matlab console I am getting: Undefined function or variable 'javac'.
When I try to built C++ library I got a similar issue: Error: An error occurred while shelling out to mbuild (error code = -1). Unable to build executable.
EDIT: Does the absence of the proper MCR counts in my case?