Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java configuration in Ubuntu 20.04 and CPLEX 20.1 #5

Open
IgnacioRubioScola opened this issue Nov 24, 2021 · 2 comments
Open

Java configuration in Ubuntu 20.04 and CPLEX 20.1 #5

IgnacioRubioScola opened this issue Nov 24, 2021 · 2 comments

Comments

@IgnacioRubioScola
Copy link

Before running correctly the Readme example I had to do some JavaCall.jl related configurations for Ubuntu and CPLEX:

  1. add in the java.library.path the path /opt/ibm/ILOG/CPLEX_Studio201/opl/bin/x86-64_linux/
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ibm/ILOG/CPLEX_Studio201/opl/bin/x86-64_linux/

  2. set the environment variable JULIA_COPY_STACKS=1 before running Julia

@dourouc05
Copy link
Member

The first point should be achieved by calling cpo_java_init (at least, that's sufficient on Windows). Did you do it?

For the second one, I understand that it is no more required for recent versions of Julia (hence the requirement for Julia 1.5), that's strange, because you seem to use 1.6 :/. What kind of errors do you get without this setting?

@IgnacioRubioScola
Copy link
Author

IgnacioRubioScola commented Nov 25, 2021

I got the following errors with cpo_java_init

julia> using CPLEXCP
┌ Warning: JavaCall needs the environment variable `JULIA_COPY_STACKS` to be `1` or `yes`.
│ Calling the JVM may result in undefined behavior.
└ @ JavaCall ~/.julia/packages/JavaCall/tjlYt/src/JavaCall.jl:53
julia> cpo_java_init()
┌ Warning: JVM already initialised. This call has no effect
└ @ JavaCall ~/.julia/packages/JavaCall/tjlYt/src/jvm.jl:155
ERROR: JavaCall.JavaCallError("JVM already initialised")

The second problem is relate to VSCode terminal, because i got the following error

ERROR: JavaCall.JavaCallError("Either the environmental variable JULIA_COPY_STACKS must be 1 OR JavaCall must be used on the root Task.")
Stacktrace:
assertroottask_or_goodenv at /home/ign/.julia/packages/JavaCall/tjlYt/src/jvm.jl
jfield(typ::Type{JavaCall.JavaObject{Symbol("ilog.cp.IloCP\$ConflictStatus")}}, field::String, fieldType::Type) at /home/ign/.julia/packages/JavaCall/tjlYt/src/core.jl
JavaCPOModel at /home/ign/.julia/packages/CPLEXCP/jbgSe/src/api_java.jl
CPLEXCP.Optimizer() at /home/ign/.julia/packages/CPLEXCP/jbgSe/src/MOI/wrapper.jl
top-level scope at /home/ign/Test.jl

but in a linux terminal it runs well without "JULIA_COPY_STACKS=1" but with a Warning:

┌ Warning: JavaCall needs the environment variable `JULIA_COPY_STACKS` to be `1` or `yes`.
│ Calling the JVM may result in undefined behavior.
└ @ JavaCall ~/.julia/packages/JavaCall/tjlYt/src/JavaCall.jl:53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants