1

I have downloaded the Apache Commons Math Package from their website, and extracted the .jar files. Specifically, I took commons-math3-3.6.1.jar, and added it to my /Libraries/Java/Extensions directory ( on OSX ).

I then added this .jar file as an External Jar in my Eclipse Project's Build Path.

What I would like to do is use the WeightedObservedPoints class. But when I write the following line:

import org.apache.commons.math3.fitting.WeightedObservedPoints;

I see the following error:

Access restriction: The type 'WeightedObservedPoints' is not API (restriction on required library '/Library/Java/Extensions/commons-math3-3.6.1.jar')

Does anybody know how I might solve this problem? It doesn't make sense that this class would not be in the public API. Am I missing a .jar file to add? There were several in the original package, but they all seemed like documentation and other optional features like testing.

Thank you for any advice.

Gerold Broser
  • 14,080
  • 5
  • 48
  • 107
jujumbura
  • 425
  • 3
  • 9
  • 1
    Possible duplicate of http://stackoverflow.com/questions/25222811/access-restriction-the-type-application-is-not-api-restriction-on-required-l – Ivan Pronin Apr 01 '17 at 13:38
  • Thank you for that link! The answer is inside it, although not set as the correct one >_ – jujumbura Apr 02 '17 at 13:18

1 Answers1

1

Thanks to Ivan, I did find the answer inside his link. The steps to fix it for me were:

  • Edit the JRE System Library on the Build Path option from the Project Properties.

  • Change the "System Library" option to "Use Alternate JRE", but to leave it with the default choice ( which is the same as what was set for Execution Environment )

The error is gone. Definitely don't know why this works though.

jujumbura
  • 425
  • 3
  • 9