matlab deploytool to java package javac error

試著忘記壹切 提交于 2019-12-24 00:58:36

问题


I'm trying to wrap a program of mine to work with java. I tried a simple "hello world" first,

-hello world.m-

disp('hello world');

I used deploytool and selected java package.

when it reached this line: Executing command: "javac -verbose -classpath "C:\Program Files\MATLAB\R2009b\toolbox\javabuilder\jar\javabuilder.jar" -d "C:\Users\shachar\Documents\MATLAB\deployTutorial\deployTutorial2\src\classes" "C:\Users\shachar\Documents\MATLAB\deployTutorial\deployTutorial2\src\deployTutorial2\helloworld.java" "C:\Users\shachar\Documents\MATLAB\deployTutorial\deployTutorial2\src\deployTutorial2\DeployTutorial2MCRFactory.java" "C:\Users\shachar\Documents\MATLAB\deployTutorial\deployTutorial2\src\deployTutorial2\helloworldRemote.java" "C:\Users\shachar\Documents\MATLAB\deployTutorial\deployTutorial2\src\deployTutorial2\package-info.java""

I got this error: 'javac' is not recognized as an internal or external command, operable program or batch file. Error: An error occurred while shelling out to javac (error code = 1). Unable to build executable.

btw: when I tried standalone application / c/c++ shared library it has been compiled successfully.

thanks in advance


回答1:


Possibly the Java SDK is not installed or properly configured on your machine. Open a system terminal and execute the following two commands:

java -version
javac -version

If they both work you should proceed with the examples from the MATLAB help. If not install the Java SDK.




回答2:


First you should install JAVA.
Then you must set the environment variable in "my computer"
Add a new variable named "JAVA_HOME" and set its value to your jdk path
like D:\Program\Java\jdk1.6.0_25
Then restart your matlab
and type

getenv JAVA_HOME  

you should get
ans=

D:\Program\Java\jdk1.6.0_25  


来源:https://stackoverflow.com/questions/4455161/matlab-deploytool-to-java-package-javac-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!