Eclipse cannot find twitter class - eclipse

I downloaded twitter4j-core-3.0.3-sources.jar and put under my project's lib folder.I did this step : project->Build Path-> ConfigureBuildPath->Add jar ... But now my project cannot find twitter class, I cannot import twitter.Status . I can import twitter.*;

You downloaded the sources file, which is full of .java files that Eclipse will use when you want to see the library's classes' source code.
In order for Eclipse to use the classes, you'll have to add the binary .jar to your build path (and remove the *-source.jar one). You can then link the binary .jar to the -source.jar to be able to navigate to the library classes' definitions.

Related

Eclipse IDE external library setup/changes

First of all, new to Java / Eclipse IDE, so please bear with me.
So, I have created my own project, and I have an external library (class files contained in jar files) in a "lib" folder of my project/workspace. I have created build path, and have the external library source code implemented as well. So, under Referenced library, I have editable .java files for the external library.
Implementation of the external library seems to have worked, as I do not get any "noclassfound" exceptions etc. However, it does not seem as changes I make to the referenced library source code has any effect.
My project is an OpenHab project, where I have a pom file which I run "mvn install. The resulting jar file is used for OpenHab installation. My classpath file has reference to lib files and source code.
Any idea why my source code changes will not take effect?

Eclipse build path: library with native library folder

I created an Eclipse project and I need to use the Super CSV library with Dozer. I downloaded the Super CSV and created a new folder "super-csv" in /usr/lib.
Now I have: /usr/lib/super-csv/super-csv that contains the super csv jar (+ javadoc and source),
/usr/lib/super-csv/super-csv-dozer that contains the super csv dozer jar, javadoc and source plus a "lib" folder.
Inside /usr/lib/super-csv/super-csv-dozer/lib there are many .jar files that are needed for super-csv-dozer to work, so I added it as native library for super-csv-dozer entry in library tab of java build path in Eclipse.
When I try to compile the project, I receive a java.lang.ClassNotFoundException pointing a class that is contained in one of the jar files in the lib folder.
Everything works only if I manually add every jar in lib folder as an external jar.
Can someone explain me where I am doing wrong?
I'd recommend using Maven - it's a widely used tool for Java builds. To start using Super CSV, it would be as simple as adding the 2 dependencies (listed on the Super CSV website), and your Eclipse project would be ready to go.
There's a bit of a learning curve though, so if you want to just add the jars to Eclipse's build path manually, I'd recommend creating a lib directory at the root of your project and putting all of the jars there.
my-project
|-src
| |- (your source in here)
|
|-lib
|-commons-beanutils-1.8.3.jar
|-commons-lang-2.5.jar
|-commons-logging-1.1.1.jar
|-dozer-5.3.2.jar
|-slf4j-api-1.7.1.jar
|-super-csv-2.0.1.jar
|-super-csv-dozer-2.0.1.jar
You can then add them to the build path (here's a good guide).
Just a note: if you're not using the Dozer extension, then you'll only need super-csv-2.0.1.jar on the build path.

how to use .swc file in flex project

I have a flex project in which I need to as3xls library (.swc file) in my project. Now I have downloaded that swc file and included it in flex-sdk\frameworks\libs and I am able to use the .as files of that swc file.
Now If I have tried to put the swc file in my local project, for e.g. in one of my package of components and added it to the class path (using eclipse project properties -> flex build path) and tried to use it from that location but I am unable to compile the project as its not able to import the .as files.
Can anybody suggest the location where I should add the .swc file and use it in my project ?
If you're using Flash Builder, I generally create a libs folder under the project:
Then, reference the SWC by selecting the project Properties, ActionScript Build Path where you can either add an individual SWC or SWC Folder:
Check out my blog post on How to use a SWC.
Here is the important points:
There are three different ways that you can use the classes that
reside in a SWC file:
* Library Path in Project Properties: This is how
I use SWCs most commonly.
* Libs folder: The libs folder was introduced
in Flex Builder 3. If you put a SWC into a libs folder it is
automatically added to your library path, and all the classes in the
SWC are available from your project
* Library Path command line
argument: You can use the library path argument to the mxmlc command
line compiler.

How to export GWT project classes into JAR file

I find it difficult to export classes from one project into JAR file, so that I could import it in another project.
How do I try?
I right-click on project in Package Explorer -> Export -> Java -> JAR file -> select all the packages I need. 'Export generated class files and resources' option is checked, other options are left unchecked. Then I click Finish.
When I import such generated .jar file into the dependent I encounter a list of errors:
The import pl.abc.xyz cannot be resolved
Xyz cannot be resolved to a type
It seems like the classes from the JAR file were not found by the compiler.
Please correct me, if I do it in a wrong way. Thanks.
It seems that you need to include in jar also java source files from the client package (sometimes also shared package depending on your GWT module structure as defined in *.gwt.xml file).
The GWT compiler requires java source for the part which has to be compiled into Java Script, to be availabe as classpath resources along with compiled classes. It is simple to achieve with ant or maven build.
You can also check Export Java source files and resources when exporting, but it will add all the source code, not only the client part.
Make sure you inherit the module in your .gwt.xml file. You want to inherit the .gwt.xml file from the GWT jar you are importing, for example:
<inherits name="com.example.youmodule.Name" />

how to setup the sphinx with netbeans

i have successfully configured sphinx4 with eclipse.
for that these steps i have used.
copy my java and config files to SRC folder
all the necessary jar files (in the lib). the lib folder added to the root of the project
build those jar files (jsapi files too)
change the configuration file and give the proper path
test the java file
but in Netbeans i really dont understand how to do the proper steps. can someone help me. the jar files should be added to "Libraries" rite.
then after adding them how to build them.
in the netbeans it dont show a SRC folder. so all the java files and configuration files should go to Source Packages folder rite.
can someone help me with this. please
If you have sphinx4-1.0beta6 then you can just open the folder up as a netbeans project. Open netbeans, click open project, then navigate to the sphinx folder and open it. It is already a netbeans project file type as of this version. I assume this will work in later versions also. I have no clue why sphinx doesn't say this on their website.
Sphinx4 is a Java library available in OSS repository, so you can use it as any library.
If your project uses maven/gradle, add repository in your project configuration, then add dependency on two packages - sphinx4 core and sphinx4-data. The former is the main library, the latter is required if you want to recognize US English. Then just start writing the code.
If you want to rely on jar files, just download sphinx4-core and sphinx4-data files from the repository and add them as dependency to the project, then start writing code.
If you want to modify or develop sphinx4 itself, install Gradle support in your IDE, then import latest sphinx4 sources as a Gradle project.
For more details and links see the tutorial
http://cmusphinx.sourceforge.net/wiki/tutorialsphinx4
click on Add JAR/Folder
select jar file you want to add