Re: [julia-users] Calling Julia from Java

2015-07-14 Thread Avik Sengupta
Yes to everything Isaiah said. 

If you cannot use JNI at all, then doing a network wrapper is your only 
option. The simplest way is to 
use https://github.com/tanmaykm/JuliaWebAPI.jl/ 

If your concern is merely writing C glue code, but you are happy to use JNI 
to call Julia functions directly, then that is a good possibility. JavaCall 
currently focusses on calling Java from C, but the JNI API is the same both 
ways. Which means you can use the code in JavaCall to make things easier. 
In particular, JavaCall will give you the representation of JNIEnv on the 
Julia side, and conversion functions from basic Java types to Julia types. 
Which means that once you call into the Julia function, you can then access 
java parameters and return Julia values back to java. All in all, it should 
simple to do all that ... I haven't done it yet since I don't need that 
functionality myself. 

Regards
-
Avik

On Tuesday, 14 July 2015 14:24:29 UTC+1, Isaiah wrote:
>
> You may need to roll your own as I haven't heard of any existing 
> solutions. Two possible approaches:
>
> - expose Julia functionality via RPC / network / etc. using ZMQ or similar.
>
> - call the Julia embedding API directly (JNA is likely sufficient -- no 
> intermediate C):
>   http://julia.readthedocs.org/en/latest/manual/embedding/
>   You might be able to do some bootstrap or marshalling with JavaCall:
>   https://github.com/aviks/JavaCall.jl
>
>   node-julia is probably the largest example of the embedding API in-use:
>   https://github.com/waTeim/node-julia
>
> On Tue, Jul 14, 2015 at 5:35 AM, Peilun Li  > wrote:
>
>> Hi,
>>
>> I'm trying to call Julia functions from Java. Limited by the project, it 
>> is not a good idea to use Java JNI to call a C function that calls Julia.
>>
>> Is there any relatively direct way to call Julia from Java?  I need to 
>> not only call Julia functions from Java, but also pass input data and 
>> retrieve output answers.
>>
>> Thanks,
>> Peilun
>>
>
>

Re: [julia-users] Calling Julia from Java

2015-07-14 Thread Isaiah Norton
You may need to roll your own as I haven't heard of any existing solutions.
Two possible approaches:

- expose Julia functionality via RPC / network / etc. using ZMQ or similar.

- call the Julia embedding API directly (JNA is likely sufficient -- no
intermediate C):
  http://julia.readthedocs.org/en/latest/manual/embedding/
  You might be able to do some bootstrap or marshalling with JavaCall:
  https://github.com/aviks/JavaCall.jl

  node-julia is probably the largest example of the embedding API in-use:
  https://github.com/waTeim/node-julia

On Tue, Jul 14, 2015 at 5:35 AM, Peilun Li  wrote:

> Hi,
>
> I'm trying to call Julia functions from Java. Limited by the project, it
> is not a good idea to use Java JNI to call a C function that calls Julia.
>
> Is there any relatively direct way to call Julia from Java?  I need to
> not only call Julia functions from Java, but also pass input data and
> retrieve output answers.
>
> Thanks,
> Peilun
>


[julia-users] Calling Julia from Java

2015-07-14 Thread Peilun Li
Hi,

I'm trying to call Julia functions from Java. Limited by the project, it is 
not a good idea to use Java JNI to call a C function that calls Julia.

Is there any relatively direct way to call Julia from Java?  I need to not 
only call Julia functions from Java, but also pass input data and retrieve 
output answers.

Thanks,
Peilun


Re: [julia-users] Calling Julia from Java (Java--->Julia)

2014-12-17 Thread cdm

for some additional context on the Java REPL:

  http://www.infoq.com/news/2014/09/repl-for-java


etc.


Re: [julia-users] Calling Julia from Java (Java--->Julia)

2014-12-17 Thread cdm

this may be relevant / interesting / inspirational:

   http://www.javarepl.com/console.html


the git repo is on:

   https://github.com/albertlatacz/java-repl



i may try to look into that code some ...

best,

cdm


On Wednesday, December 17, 2014 7:41:19 AM UTC-8, Isaiah wrote:
>
> I'm not aware of any examples of Java->Julia, but there are basically two 
> options:
>
> - RESTful API or other messaging-based interop
> - use the Julia C API via JNI (Julia functions can be exposed as C 
> function pointers). The potential advantage here is performance (no-copy 
> data transfer, avoid the network stack).
>
> A variation of the second would be to extend JavaCall.jl to wrap Julia 
> functions as Java callbacks and do as much of the conversion/bookkeeping as 
> possible via JavaCall. This would still entail using JNI for the actual 
> calls, but might avoid some code duplication and hairiness dealing with the 
> embedding API (see pyjulia for an example).
>
> On Tue, Dec 16, 2014 at 7:21 AM, Frank  > wrote:
>>
>> Hi,
>>
>> i am trying to find information on how to do the following:
>>
>>- expose Julia functions within/as Java Interfaces 
>>- Call Julia from Java
>>
>> I find a lot of Julia-->Java examples, but i would like to call Julia 
>> from Java.
>>
>> Any tackers?
>> Thanks
>> Frank
>>
>>

Re: [julia-users] Calling Julia from Java (Java--->Julia)

2014-12-17 Thread Isaiah Norton
I'm not aware of any examples of Java->Julia, but there are basically two
options:

- RESTful API or other messaging-based interop
- use the Julia C API via JNI (Julia functions can be exposed as C function
pointers). The potential advantage here is performance (no-copy data
transfer, avoid the network stack).

A variation of the second would be to extend JavaCall.jl to wrap Julia
functions as Java callbacks and do as much of the conversion/bookkeeping as
possible via JavaCall. This would still entail using JNI for the actual
calls, but might avoid some code duplication and hairiness dealing with the
embedding API (see pyjulia for an example).

On Tue, Dec 16, 2014 at 7:21 AM, Frank  wrote:
>
> Hi,
>
> i am trying to find information on how to do the following:
>
>- expose Julia functions within/as Java Interfaces
>- Call Julia from Java
>
> I find a lot of Julia-->Java examples, but i would like to call Julia from
> Java.
>
> Any tackers?
> Thanks
> Frank
>
>


[julia-users] Calling Julia from Java (Java--->Julia)

2014-12-16 Thread Frank
Hi,

i am trying to find information on how to do the following:

   - expose Julia functions within/as Java Interfaces 
   - Call Julia from Java

I find a lot of Julia-->Java examples, but i would like to call Julia from 
Java.

Any tackers?
Thanks
Frank