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.
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.
Related
I am working with a NetBeans project that has multiple packages. I will call them package_cam, package_demo, and package_drive. Inside of package_drive I have a class that requires a face recognition SDK that is a JAR and is clearly loaded in my libraries. However, when I run this file, I receive an unsatisfied link error stating that the sdk jar cannot be found. As I stated before, it is listed in my libraries and exists in my lib folder in the project folders. I have searched high and low in Netbeans trying to find a location where that lib must be specified but have come up short. Has anyone ever run into this before? Is there a reason that a certain package would not be able to see or use the library? I am importing the sdk at the head of the file with this
import Luxand.*;
import Luxand.FSDK.*;
import Luxand.FSDKCam.*;
Any help with this would be greatly appreciated!
(I assume you use Netbeans 8 from the question tag, and your project is Ant-based)
In general the recommended way is to use a library wrapper module. There is a wizard so it's very easy, menu File > New Project > NetBeans Modules > Library Wrapper Module. More details in these Netbeans FAQ entries: http://wiki.netbeans.org/DevFaqWhenUseWrapperModule and http://wiki.netbeans.org/DevFaqWrapperModules
If you don't use a wrapper module, you should update project.xml to add the library to the class path, for example:
<class-path-extension>
<runtime-relative-path>ext/hexedit.jar</runtime-relative-path>
<binary-origin>release/modules/ext/hexedit.jar</binary-origin>
</class-path-extension>
See this other FAQ entry: http://wiki.netbeans.org/DevFaqHowPackageLibraries
I have the Problem that i want to add OR-Tools into my project via eclipse IDE. I want to use the Linear Solver. I added the two jars form the downloaded Zip file. Now i want to run the SimpleLpExample from the OR-Tools site. I've got the Error that no jniortools in java.library.path. I see that at other posts they say you have to run make third_party and make java, but i don't know where i have to run these commands.
When somebody added it successfully into an IDE it would be glade when this person can explain how he does it. Thanks for help.
No. You need to add the path to the jniortools shared library I'm eclipse.
All dynamic libraries are located in the lib/ directory of the extracted archive.
To add the correct path, please follow these instructions:
I want to use this external library in my Intellij Maven project. I have tried to do it like official described and like often recommended here or here.
But always I try to type ReedSolomon or com.backblaze.erasure.ReedSolomon, ReedSolomon is marked red and Cntrl+b says "Cannot find declaration to go to". Also Alt+Enter gives me no posibility to import the class.
Other libraries are added and were recognized.
Isn't it possible to use this zip as external library? Do you have any ideas what I can try else?
Thanks!
You have to first unzip the library. It is not a .jar archive, but a package.
So you could create a new package in your project: com.backblaze.erasure. There you copy/paste all .java files from the unzipped directory javareedsolomon\com\backblaze\erasure.
Hope this helps you :)
I'm trying to upload a file via FTP client using Java, but when trying the:
import org.apache.commons.net.PrintCommandListener;
the PrintCommandListener is show in red. I verified my library and it does include commons.net. What should I do?
PrintCommandListener is in fact in Apache Commons Net. For example, if you download the current version, the jar you need to include in your build path is commons-net-3.3.jar. If this single jar is seen by your compiler, then the class should be recognized. Make sure there are no other classes called PrintCommandListener (for example custom ones that you might have written) in your build path.
If using an IDE (such as eclipse) make sure the jar is on your build path. For example, with Eclipse right click project, go to Java Build Path and click Add JARs. Navigate to the location of your jar file and add it.
I just downloaded Eclipse several hours ago, and needed to add Java3D to the classpath. Installing it went without a hitch, but Eclipse can't seem to find the documentation folders so that it can give super-IDE functionality, such as autocomplete and method signatures.
While I know how I would add them individually, this lead me to the question; what is the "correct" way to install a Java library in Eclipse? Is there a special directory format I should follow? Is there a plugin that already did this for me? (The answer to that is yes, but I don't know how to use it, or whether or not it's appropriate).
Thanks!
Edit 1: It seems to me that someone down-voted the question. May I ask why?
Edit 2: So after monkeying around with the JARs, it seems that manually setting the doc path for each JAR in the library seems to be the least-error prone way.
when you add a .JAR(library) to your project in the LIBRARIES tab for your project, you have the option of attaching the javadoc directory for the jar.
So, go to the LIBRARIES tab of the "java build path" for your projects. select your jar. expand the (+) sign and you will see that you can set the javadoc. path.
good luck,
I think I've got it (had the same issue as you). Better late than never.
Go here - http://java3d.java.net/binary-builds.html and download the documentation zip (j3d-1_5_2-api-docs.zip).
Extract the directory anywhere on your HD (Right in the Java3d folder is fine).
Link the Jar's JavaDoc listing to that Folder (java build path >> Libraries >> expand the Jar Listing >> JavaDoc Location >> browse to the folder location, then validate). Do it for each j3d Jar.
That should integrate the J3D Javadoc.
As far as I know (haven't used 3.4 very much thus far), Eclipse has two options for the automatic showing of Javadocs. The first is a JavaDoc jar to attach to the jar file. The second is having the javadoc in a source jar which is attached to the jar to show the source.
A directory, if I recall correctly, will not provide autocompletion of javadoc. However, if you press "F1", you will be able to access the javadoc via the help menu.
You might try placing the documentation directory into a jar file, and attaching it to the jar file and see if that tricks Eclipse.
I cheat; All my java projects are built with maven, so I use maven to generate an eclipse project, with classpaths etc already setup, with a simple 'mvn eclipse:m2eclipse'.