Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Unable to call external Java functions

Unable to call external Java functions

Hi. I'm having problems calling external Java functions. I get errors such as the following:

Code:

[CodegenC.tpl:4968:14-4968:14] Error: Template error: Unsupport external language: JAVA

[CodegenC.tpl:4960:14-4960:14] Error: Template error: Unsupport external language: JAVA

The specific examples above are from an attempt to run the example in the OpenModelica manual:

Code:

package test

  function ExternalJavaLog
    input Real x;
    output Real y;

    external "Java" y = 'java.lang.Math.log'(x)     annotation(JavaMapping = "simple");
  end ExternalJavaLog;
  model ExternalJavaLib
    Real x(start = 1.0);
  equation
    der(x) = -ExternalJavaLog(x);
  end ExternalJavaLib;
end test;

I'm using Linux Mint (based on Ubuntu for those who don't know it) and I have the OpenJDK JRE and JDKs installed (both versions 6 and 7). I've tried the version from the nightly repository and also compiling from source, with the same results. I've also tried on Windows 7 (1.9.0 download from this site) and my colleague has tried on Mac (I'm not sure of the specifics there)

I'm quite confused as it seems like this should be a problem with my setup (I can't find anyone else talking about problems, and external Java support seems to have been added in the 1.5 series), but as stated I can't get it to work on any platform.

Does anyone have any pointers as to what could be the problem (or is able to confirm the problem using the above example)?

Thanks.

Edited by: Kemp - Nov-27-13 14:04:31

Re: Unable to call external Java functions

external Java support was deleted in like... 1.6 series. The manual is lying. But it's in a proprietary format, so I can't update it current/smile

Anyway, you could just write your own JNI wrapper. It's not that difficult.

Re: Unable to call external Java functions

Oh. I guess that makes sense then...

Just to be clear, I'm working from the user guide for OpenModelica 1.9.0 Beta3, updated on 28th January 2013 and linked from https://openmodelica.org/index.php/user … umentation. Someone might want to look into updating that if, as you say, the functionality was removed 3 years ago.

Anyway, thanks for the reponse.

There are 0 guests and 0 other users also viewing this topic
You are here: