[Scilab-users] Calling a java method in a Scilab function

Pierre Vuillemin contact at pierre-vuillemin.fr
Wed Dec 7 10:04:51 CET 2016


Hi all,

I have to create unique IDs for some object in Scilab. For that purpose, 
someone kindly guided me towards the UUID class of java, which lead me 
to create this function in Scilab,

function id = make_id()
    UUID     = jimport("java.util.UUID", %f)
    tmp      = jinvoke(UUID,"randomUUID")
    id       = jinvoke(tmp,"toString")
endfunction

It works fine.

An a priori similar function is

function id = make_id_err()
    UUID     = jimport("java.util.UUID", %f)
    tmp      = UUID.randomUUID()
    id       = tmp.toString()
endfunction

where the methods are called without jinvoke. While the instructions of 
the latter function work well in the terminal, they lead to an error 
when trying to exec the function 'make_id_err'.

I was wondering if it is a normal behaviour?

Best regards,

Pierre



More information about the users mailing list