简体   繁体   中英

How to configure IntelliJ Idea with CPLEX

I have read many forums but I have not found anything about it for IntelliJ Idea.

I'm not a developer but I manage a Tomcat8 server on Debian.

A developer wants to use IBM ILOG CPLEX in its Grails application. He uses the IDE "IntelliJ Idea." He would make it work by creating objects like this:

// Create the shape / object solver
            IloCplex CPLEX IloCplex = new ();
            System.out.println ( "\ n IloCplex CPLEX IloCplex = new ();");
        ...
        ...

The PC user is a windows and IntelliJ IDEA and CPLEX are installed. With this configuration the program works.

When the program is exported .war and transferred to the tomcat server, it no longer works.

we have the error:

Error 500: Internal Server Error

    line | method
- 1145 >> | runWorker in java.util.concurrent.ThreadPoolExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 615 | run in java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 | run. . . in java.lang.Thread

Caused by ControllerExecutionException: Runtime error executing actions
- 1145 >> | runWorker in java.util.concurrent.ThreadPoolExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 615 | run in java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 | run. . . in java.lang.Thread

Caused by InvocationTargetException: null
- 1145 >> | runWorker in java.util.concurrent.ThreadPoolExecutor
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 615 | run in java.util.concurrent.ThreadPoolExecutor $ Worker
^ 745 | run. . . in java.lang.Thread

Caused by UnsatisfiedLinkError: ilog.cplex.Cplex.CPXopenCPLEX ([I) J
- 6594 >> | init in ilog.cplex.CplexI
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 629 | <Init> in '
| 11067 | <Init>. ilog.cplex.IloCplex in
| 11082 | <Init> in '
| 93 | save. . agriplan.APProjectController in
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run. . . java.util.concurrent.ThreadPoolExecutor $ Worker in
^ 745 | run in java.lang.Thread

The developer told me it was from the line IloCplex CPLEX IloCplex = new (); that it does not work.

I guess the problem is the program that does not find CPLEX So I add the path of CPLEX in Grails Options "VM options":

-Djava.library.path = / Opt / IBM / ILOG / CPLEX_Studio126 / CPLEX / bin / x86-64_linux

But I have the same error

The user has not forgotten to implement the cplex.jar in the program library

The problem is it on the server side or within the application? There he has something to say elsewhere in IntelliJ Idea?

Should we declare something else in IntelliJ Idea?

thank you very much

Do you get the same error if you run the java examples shipped with CPLEX? To test this, you can do the following (assuming your path's are correct from above):

$ cd /Opt/IBM/ILOG/CPLEX_Studio126/CPLEX/examples/x86-64_linux/static_pic
$ make execute_java 2>&1 | tee output.txt

This will save the output in output.txt so that you can look at it later. It should give you an idea of what the required command line arguments are.

For example, on my system, I see this in output.txt for one of the examples:

java  -d64 -Djava.library.path=../../../bin/x86-64_linux -classpath ../../../lib/cplex.jar: LPex3

You many simply need to add -d64 and -classpath (with the correct path) to your "VM Options" section (I have not used IntelliJ, but "VM Options" sounds reasonable).

Finally, see Configuring the Eclipse Java IDE to use CPLEX libraries (an IBM tech note that should give you a good idea of what's required in an IDE).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM