Closed amserra closed 2 years ago
You probably want JString("foo")
:
julia> using JavaCall
julia> JavaCall.init()
julia> JString("foo")
JString(JavaCall.JavaLocalRef(Ptr{Nothing} @0x000000000258c710))
julia> jcall(ans, "length", jint, ())
3
@amserra does the JString("foo")
work for you?
It does
I will close this then. I'll also look into calling jcall
directly on String
in the future.
@ahnlabb suggested a mechanism here: https://github.com/JuliaInterop/JavaCall.jl/pull/149#issuecomment-887341326
Good afternoon. I've been working on a project with JavaCall and may have stumbled across a bug. Calling the constructor of the wrapper class Integer, I get a reference to the object on variable _intobj, which I can use to call instance methods.
However, calling the constructor of class String, this results not in a reference to the String object (as expected), but in the String value itself.
I'm running this on a 64-bit Julia version in Mac OS with _JULIA_COPYSTACKS on. I use the code in the documentation to initialize the JVM: