Error with installing or-tools for java- example not working

91 views
Skip to first unread message

Omar

unread,
Jun 13, 2022, 6:11:26 AM6/13/22
to or-tools-discuss
Hi !

I had a problem with the installation of or-tools for Java, I went through the steps given by the guide and tried lots of suggestions given in some posts here and on stackoverflow, but the problem persists. I downloaded the binary files and followed the installation steps exactly and the tests (make java_test) ran fine, then I added the jar files given I found in the zipped folder to the libraries in my project and I wanted to run the example given in the guide as test that my setting was correct, but I come across the error given in the picture below. I also attached a photo of the libraries I included. I hope someone can help me with that problemerror.jpglib.jpg

Daniel Rogers

unread,
Jun 13, 2022, 12:44:30 PM6/13/22
to or-tools-discuss
If make test_java ran fine and all tests passed, you should have ortools installed correctly. 

On the Getting Started (For Java) guide (https://developers.google.com/optimization/introduction/java), are you following the "Running the Java program" part correctly? 

```
You can run the program above as follows:

  1. Copy and paste the code above into new file, and save it as my_program.java.
  2. Open a command window at the top level of the directory where you installed OR-Tools, and enter:
    make run SOURCE=relative/path/to/my_program.java where relative/path/to/ is the path to the directory where you saved the program.
Note: You must run the above command from the top level of the directory where you installed OR-Tools (where the Makefile is located).
```

Daniel Rogers

unread,
Jun 13, 2022, 12:46:45 PM6/13/22
to or-tools-discuss
You shouldn't have had to add the jar files manually, as I do not see that in any of the steps in the guide.

Omar

unread,
Jun 14, 2022, 2:30:06 AM6/14/22
to or-tools-discuss
Thanks for your reply. I have tried running make run SOURCE=relative/path/to/my_program.java  as specified in the guide, but it returns an error as well (photo of the error in terminal attached below) . I also tried to remove the jar files from the libraries of the project, and the program cannot resolve the Variables then (photo of the error also attached below)err2.jpgmake_SOURCE_err.jpg

Daniel Rogers

unread,
Jun 14, 2022, 3:29:48 PM6/14/22
to or-tools-discuss
What is the output of `make test_java`?

Omar

unread,
Jun 15, 2022, 2:36:55 AM6/15/22
to or-tools-discuss

Here are some screenshots of the output. The output is rather long, so I took screenshots of some of it, but as I said before everything went fine.ter_1.jpgter_2.jpgter_3.jpgter_4.jpg
Reply all
Reply to author
Forward
0 new messages