Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

how to run cplex concert with Java on unix server

  • 1.  how to run cplex concert with Java on unix server

    Posted 12/07/15 05:57 PM

    Originally posted by: geffer


    Previously I always use IDE directly, now I want to use command line to execute that.

    Can you please tell me how to set up to run this code(include jar file, and set -Djava.library.path=E:\ibmcplex\cplex\bin\x86_win32) in command ?

    example should be like javac --...

                                          java -.....

     

    Thanks

    Keji


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 01:19 AM

    The easiest way probably is to look at how the examples are run from the command line. To see that go to one of these directories

    cplex/examples/x86_windows_vs2010/stat_mda
    cplex/examples/x86_windows_vs2010/stat_mdd
    cplex/examples/x86_windows_vs2010/stat_mta
    cplex/examples/x86_windows_vs2010/stat_mtd
    cplex/examples/x86_windows_vs2012/stat_mda
    cplex/examples/x86_windows_vs2012/stat_mdd
    cplex/examples/x86_windows_vs2013/stat_mda
    cplex/examples/x86_windows_vs2013/stat_mdd

    and look at the file javamake or just type

    nmake -f javamake execute

    This will compile and run all examples. From the output of nmake it should be simple to figure out how to set java.library.path and classpath on your machine.


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 04:49 AM

    Originally posted by: geffer


    can you please tell me more details of how to how to set java.library.path on command line code?

    Fox example. I already click run.bat  and the result automatically displayed as follows. How can I get the the command lines that running by myself?


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 05:17 AM

    Now you are asking about running OPL. If you want to run OPL you should ask the question on the OPL Forum.

    In order to see the commands executed by a .bat file you only need to remove the '@echo off' at the beginning of the file.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 05:32 AM

    Originally posted by: geffer


    Thanks

    I dont ask OPL but just supposed click run.data is the way to run java code.

    Can you please give me more hint about how to check the command line?

    I am really not familiar what you writing below.

    and look at the file javamake or just type

    nmake -f javamake execute

    This will compile and run all examples. From the output of nmake it should be simple to figure out how to set java.library.path and classpath on your machine.


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 06:08 AM

    Sorry, I don't know how to make this any clearer. What you need to do is

    1. Open a command prompt
    2. Change directory to one of the folders I listed
    3. Run 'nmake -f javamake execute'

    What exactly is the step you are having trouble with?


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 06:33 AM

    Originally posted by: geffer


    I am confused,  the directory you listed cplex/examples/x86_windows_vs2010/stat_mda is for vc++and vc project.

    I cannot find any .java file in that. Is that directory same as java example? 


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 07:36 AM

    But can you find the file called 'javamake' in that directory?

    The java source files are located in a different directory (cplex/examples/src/java) but the javamake file correctly references them by way of relative pathnames.


    #CPLEXOptimizers
    #DecisionOptimization


  • 9.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 07:57 AM

    Originally posted by: geffer


    Yes, I can find the javameke but I dont have vc so I dnot have nmake.

    Can you tell me the typical way  to run cplex +java code on unix?

    Like how to include cplex.jar and set library path?


    #CPLEXOptimizers
    #DecisionOptimization


  • 10.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 10:02 AM

    I am not clear why you are asking for Unix commands when your OS seems to be Windows?

    Anyway, to run CPLEX+Java from the command line you have to

    1. Include cplex.jar in the classpath (environment variable $CLASSPATH or command line option -classpath)
    2. Include in java.library.path the directory that holds the cplexVERSION.dll (where VERSION is the version number of your CPLEX installation). The java.library.path can for example be set with the -D command line option.

    Note that for compiling a class file you only need 1, not 2.


    #CPLEXOptimizers
    #DecisionOptimization


  • 11.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 12:08 PM

    Originally posted by: geffer


    I have tried that successfully in Windows, but failed on OS.

    Is there any differences to run cplex java command  between unix and windows?


    #CPLEXOptimizers
    #DecisionOptimization


  • 12.  Re: how to run cplex concert with Java on unix server

    Posted 12/08/15 01:32 PM

    I don't think there is difference other than the different path names.

    What is the command you are trying to execute and what is the error you get?


    #CPLEXOptimizers
    #DecisionOptimization