Importing Libraries not working in eclipse - java

I have a project that requires me to import a library, and I am doing it in eclipse. I have imported the library, and it doesn't seem to recognize that I have the library imported.
My user libraries.
The build path for the project.
A picture of my java project. The part highlighted corresponds to the import statement.
How can I make it so that eclipse can see that I have the library imported?
I tried changing java versions and also changing the build path as well.

Adding the below Dependency in pom.xml for importing the libraries.
<dependency>
<groupId>org.openpnp</groupId>
<artifactId>opencv</artifactId>
<version>3.2.0-0</version>
</dependency>

Related

How do you import GeoTools into an existing project in Intellij IDEA?

I have an existing project that was not built using Maven, and I would like to import the GeoTools library.
From the GeoTools website, the startup guide for Intellij involves creating a Maven project and modifying the pom file. But my project already exists and isn't a Maven project so it doesn't have a pom file.
I tried downloading all of the jar files for GeoTools 18.3 from https://sourceforge.net/projects/geotools/files/GeoTools%2018%20Releases/18.3/ and placing them into my lib folder, but I was still unable to import from com.geotools.
I tried adding GeoTools using the "Download Library from Maven Repository" feature, but searching "GeoTools" results in over 100 results from non-official sources, so I am unsure if any of them are what I'm looking for.
How do I import GeoTools into my project?
GeoTools is a not for profit org so you need to import from org.geotools not com.geotools.
If you insist on not using Maven to manage your dependencies (and I don't recommend this approach) the you can tyr following the NetBeans instructions which should apply to intelliJ too. The trick is to remove 3 of the 4 epsg jars otherwise they fight.

Adding a aar in eclipse

i'm trying to add a aar file for the first time in my project :
http://hiteshsondhi88.github.io/ffmpeg-android-java/
But i can't manage to make it work on eclipse, i tried to copy the aar file in my /libs than i do add to build path like i'm used to.
But my project can't import ffmeg. It is said in the documentation :
Or Maven
<dependency>
<groupId>com.github.hiteshsondhi88.libffmpeg</groupId>
<artifactId>FFmpegAndroid</artifactId>
<version>0.2.5</version>
</dependency>
Where do i need to put this ? or this is the case you use Maven with android studio ?
How can i import this aar?
Thank you very much

How to import a Java library in Eclipse?

I have downloaded and am trying to import this library: https://github.com/sachin-handiekar/jInstagram in one of my projects. However, whenever I point to the directory where this project is located and try to import it, Eclipse says "No projects are found to import." I even tried importing it as Android code but it didn't recognize it either. How do I import and use this library in my Android project?
Just to use this library within your project add it as a Maven dependency
<dependency>
<groupId>com.sachinhandiekar</groupId>
<artifactId>jInstagram</artifactId>
<version>1.0.9</version>
</dependency>
If you don't know how to do this check this plugin: maven-android-plugin
You can also checkout the complete source tree for the project and then go to the directory containing the pom.xml file and using Maven run mvn install to build this project and then import it to the Eclipse.
It says no projects are found to import because it is looking for the eclipse .project file which is not included in git repositories. Try the import file system option
Or better yet, try out the git plugin for eclipse
Its easy, in Activity press Ctrl + Shift + O

Cannot import javax.ejb.* packages

I am having trouble in building an EJB session bean.
The following packages cannot be found:
import javax.ejb.LocalBean;
import javax.ejb.Stateful;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
Some solutions implied adding the libraries j2ee.jar and javaee.jar to the java build path.
I am using jdk-7u75-windows-x64 and java_ee_sdk-7-windows-ml and cannot find any of these libraries at the given location($JAVA_HOME\lib). I am using eclipse(kepler) on a Windows 7 x64 machine
javaee.jar ships with neither eclipse nor java(jdk). The file must be manually downloaded and added to the project build path. The java ee 7 api can be found here.
Alternatively, a maven dependency can be used:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
The EJB API is found in the JavaEE libraries which are, as you correctly pointed out, distributed with the j2ee.jar library. If you're using Eclipse, its classpath may be pointing to the standard Java libraries and not the Enterprise libraries. You can try two things:
Compile and run your code from the command line. Set %JAVA_HOME% to point to the installation directory of java_ee_sdk-7-windows-ml and add %JAVA_HOME%/bin to the %PATH%.
Find the Enterprise library and add it to your CLASSPATH in Eclipse. The CLASSPATH is set by going to the project properties and selecting the option "Add an external library/jar file". Add any jar files found in the EE installation directory to the build path.

How can I import javax.json in eclipse

I have installed eclipse ide for EE developers and I am receiving an import error for
import javax.json.Json;
import javax.json.JsonReader;
etc.
I have right clicked on project folder -> clicked properties -> clicked Java build path -> add library -> JRE System Library,
but the dependencies that show up are already imported. How can I import the javax.json package?
If using Maven, add this dependency to your pom.xml
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.0</version>
</dependency>
For Gradle, add this to your build.gradle
compile 'javax.json:javax.json-api:1.0'
Going to assume that you are not using Java 7 and thus need to add the JAR file directly to your project path:
Here's the link to the
JAR
And where it came from:
http://jsonp.java.net/
Download and add to your project build path.
You need to get a hold of the Jar from https://java.net/projects/jsonp/
Then got to project folder -> clicked properties -> clicked Java build path -> Add External Jars...
From here you can import the downloaded Jar (library) into your project.
Using javax.json group (what is in the accepted version) doesn't work for me. I get this:
javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
Instead, what does work for me is the following (put this in the dependencies section of build.gradle if you're using Gradle):
implementation "org.glassfish:javax.json:1.1.4"
To find the latest version of the library, see the library's search.maven.org page.
You will have to download the Jar from https://java.net/projects/jsonp/ as they are not yet part of main Java runtime, download the jar and add it to your classpath and it should work
JSR http://jcp.org/en/jsr/detail?id=353

Categories