Cannot import twitter4j classes in Eclipse - java

I added twitter4j 3.0.3, into an Eclipse project but it does not import any classes from the jar. I copied in some code samples from the twitter4j jar files but eclipse can't find any of the classes in those files - e.g. Twitter, ConfigurationBuilder, TwitterFactory etc... I've added twitter4j-core-3.0.3-sources.jar to my build path. But Eclipse doesn't suggest to import any classes in these files. Is there anything I'm missing?

You need to add the twitter4j-core-3.0.3.jar JAR to your build path, it can be found under the lib directory of the download.
The twitter4j-core-3.0.3-sources.jar JAR only contains source code.

Related

java how to import JAK API/library with eclipse

this is the API i want to use: https://labs.micromata.de/projects/jak/quickstart.html
i tried to download and unzip the files (including JAXB) but i have no idea what to do with them. how do i add it to my project?
i searched for how to add API/library but all results told me to import the jar file. did not find any jar file. the unzip folder just looks like a regular project folder. i also tried to export that folder into a jar file, it did not solve the problem, tried to copy and paste the folder into my project, also did not help.
in the doc it says:
Download the Java API for KML JAR at GitHub and add the JAR to your
classpath.
If there are any dependencies, resolve them and add JAXB to
your classpath, too. Version 2.1.xx should be fine.
to add what JAR? i'm really confused

Import of excuting jar doesn't work in eclipse

I deleted my project permanently and I want to import my old executing .jar into eclipse.
Eclipse import function does not find anything it the jar file.
Can someone give me a tip or recover the file?
Here is a screenshot of eclipse
Thank you
Click here for the file to recover
You cannot recover the project. You did not set to export source files while exporting, there are only .class files.
For future reference select Export Java source file and resources while exporting the project.
Reference: http://www.albany.edu/faculty/jmower/geog/gog692/ImportExportJARFiles.htm
I am curious to know if it's jar why do you want to import as a project?
You can import external jar as a "APP Client Jar File" which is under Java EE.
I tried this with your attached jar and I am able to import it and able to see the content in it.
You are mixing a few things. If you deleted your project source you won't be able to recover it unless you decompile it, and it will be obfuscated even though.
What you have is the compiled project, resulting from taking your source (.java) and compiling it to .class files.
The Import option in Eclipse is made for importing .project files, that hold your project's information. Also you could create a new project from your existing code but as far as I know you just can't create/recover a project from it's compiled jar.

Issue adding Coinbase Exchange API Library to Eclipse Project

I'm trying to add the Coinbase Exchange Java API to my eclipse project.
The zip API file has the following file folder setup
source/main/java/com/coinbase/excahnge/api
All the source files are in the API folder. The rest of the folders are empty.
At first I tried to import it as a project but got a error saying 'no project found'.
I did not see any options under import to import the source files into my project.
Any help would be great, could not find any documentation on Coinbase Exchange website on how to use their Java API.
The Eclipse Import function expects either Eclipse projects, or something that can be converted to Eclipse projects (like Maven .pom files etc.).
All you have is a zip file containing some .java files.
Just place these .java files in your project folder, under com/coinbase/exchange/api.

How do I fully include the Batik library in my Java project?

I am trying to add the Batik library to my Java project. I added the unzipped binary to my lib folder, and added all of the JARs in the top level to the build path.
However, when I make the following import statement:
import org.apache.batik.dom.svg.SAXSVGDocumentFactory; I get the following error:
"The import org.apache.batik.dom.svg.SAXSVGDocumentFactory cannot be resolved"
Other import statements do not exhibit this problem, such as the following:
import org.apache.batik.util.XMLResourceDescriptor;
As far as I understand, the SAXSVGDocumentFactory class exist somewhere in the binary I added to the lib folder, so the issue must be with adding JARs to the build path. How can I make sure that all of the Batik source files are added to the build path correctly and are usable?
It cannot be resolved because it doesn't present in 1.8 jar. It exists in 1.7.
http://www.findjar.com/class/org/apache/batik/dom/svg/SAXSVGDocumentFactory.html
The easy way to find this out is to find the right jar and click to open it by the package: org.apache.batik.dom.svg.SAXSVGDocumentFactory. You wont see this class in 1.8 jar, but you will see it in 1.7 jar.
To fix, download a 1.7 jar and add it to your project again.
http://apache.mirrors.hoobly.com/xmlgraphics/batik/source/
If somebody can't find SAXSVGDocumentFactory after updating Batik in legacy project, just change the import:
import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
with
import org.apache.batik.anim.dom.SAXSVGDocumentFactory;

Android+Ant external jar library

I'd like to try org.apache.commons.lang.StringUtils in my Android project. I have downloaded commons-lang3-3.1.jar and placed it in my project's libs directory. However importing it fails with the library not being found. I have used many variations of
import org.apache.commons.lang.StringUtils;
with no success. My environment is the linux console and I'm using ant to compile, no Eclipse. My understanding is that Ant picks up any library in the project libs directory.
Please help. Android/java coding noob.
Lang 3.0 (and subsequent versions) use a different package (org.apache.commons.lang3) than the previous versions (org.apache.commons.lang), allowing it to be used at the same time as an earlier version. ref: http://commons.apache.org/lang/
import org.apache.commons.lang3.StringUtils;
Just put the jars in the libs/ directory. Silly me, I was putting them in the lib/ directory until I ran into the same issue and found the answer here:
How to build an android app with external libraries using ant?

Categories