Matlab and Java integration

前端 未结 1 665
遇见更好的自我
遇见更好的自我 2021-01-06 11:33

I have done image processing in MATLAB and build my GUI in Java. I want to integrate MATLAB into Java. I want to use MATLAB Builder for this purpose. I want also to use neur

相关标签:
1条回答
  • 2021-01-06 11:46

    The first error message which you get when you type java -version is a bit misleading; instead of

    java -version
    

    you need to say

    !java -version
    

    since you want to call an external program and not a MATLAB script or function. As stated in the comments by Amro this will only work if the directory containing java.exe is on your path. See Running External Programs in the MATLAB help for more info.

    The error message you get comes from the fact that

    • there happens to be a file java.m and MATLAB thinks you are trying to call this file
    • that file only contains comments, since java is actually a sort of keyword in MATLAB, see doc java.
    • MATLAB realizes that you are not using the keyword in its correct form (which would be to call java.something to create an object of class something) since you give a parameter
    • MATLAB ends up telling you in a strange way that java doesn't accept parameters (even though java.m does not contain the script, only its documentation)

    Note that if you don't want to add the directory containing java.exe and javac.exe to the path, you could also try calling them with their full path name:

    !C:\Program Files\Java\jdk1.6.0_21\blablabla\bin\javac.exe
    
    0 讨论(0)
提交回复
热议问题