How to set up twitter4j appropriately? - java

I'm new using the library twitter4j and I've some doubts about it. First of all I have some doubts importing the jar from twitter4j, I've reading many websites and I think that in order to make a java application that just shows the timeline of an user on twitter, I just need to import to netbeans the jar twitter4j-core-4.0.3.jar or do I need the other lib's? If that was the case is there any way to import the full .zip that I downlaoded from twitter4j just to use all the libraries?
Secondly I've trying to configure appropriately the file twitter4j.properties with oAuth identification as I says here http://twitter4j.org/en/configuration.html
but I don't understand where I should place the file that I've created (using a .txt and renaming it as twitter4j.properties, where does means root of the classpath directory? I mean in the case of netbeans would it be name project >source packeges > application > twitter4j.properties ? . Moreover will these information will be available to read for other users?
Excuse me for my ignorance, but I'm really noob building app's.
Thank you in advance.

The twitter4j-core jar should be all you need for retrieving a timeline and interacting with most of the API.
I am not familiar with Netbeans but if you can place twitter4j.properties under the 'default package' then that may work. Twitter4j is using getResouceAsStream to load the file:
Configuration.class.getResourceAsStream("/" + "twitter4j.properties")
(See here for the full source).
Finally, if you haven't already seen them, take a look at the timeline examples provided by Twitter4J. (All the examples are executable, check out the bin directory.)
I hope that helps.

Related

Business Objects 'bcm.jar' error when exporting Java app

I have been working on creating a simple Java desktop app using the RESTful API for Business Objects and have run into an issue. Whenever I run my app in Eclipse in works fine; whenever I export it as a 'Runnable Jar' and select the Library handling option 'Package required libraries into generated JAR' it works fine. However, whenever I try to export it using the Library handling option 'Extract required libraries into generated JAR' I get the following error after running the app:
java.lang.NoClassDefFoundError: Could not initialize class com.businessobjects.bcm.BCM
I have the 'bcm.jar' file added under a 'res' Source Folder and have it added to the Build Path. At one point I added all the JARs under the 'SAP BusinessObjects' java folder, and external folder, but it still throws the error. The problem stems from this line of code:
enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userID, password, CMS, auth);
Would anyone know why I am getting said error? I really want to use the Extract option as it will improve performance as my app becomes larger. Any help resolving this issue would be greatly appreciated :)
EDIT: I would be happy to provide clarification or further detail upon request!
Seems this was introduced in SP04 and SAP has no intent of fixing it as the RESTful API wasn't designed to be used with Desktop apps.
Have you included the cryptojFIPS.jar? Leaving it out can cause the error.

IInAppBillingService.java does not generate Java file in Android Studio

I am following this tutorial:
https://developer.android.com/google/play/billing/billing_integrate.html#billing-permission
No InAppBillingActivity file is generating. I'm not sure why. I checked to make sure everything is placed correctly but no luck. Here is what my folder structure looks like:
Click this for picture
Now I know there are similar questions like this but none of them were able to solve my problem. I have already imported googles billing library as well. No file generates when I run / build the app.
The problem is that the docs are not very accurate in specifying where it is that you will find the java file that should be in the gen folder. I had faced the same problem and had broken my head over it, until I found that the .java file was infact generated and it was in the path :
\app\build\generated\source\aidl\debug\com\android\vending\billing\IInAppBillingService.java
Its not a headache issue and your code runs smoothly itself without any interventions required. Hope this helps!
In android studio double click on your package name:
click in New and then on AIDL
Hope it helps
Its usually generated but not put where the tutorial tells you. If you do a Ctrl+N and type in the class name in intelliJ you may be able to find it

Require jar for Oracle XML XDK

I am trying to compare two XML files in Java. I also found the code here
https://docs.oracle.com/database/121/ADXDK/adx_j_diff.htm#ADXDK198
But I could not find the jar file for oracle.xml.diff.DiffOp and oracle.xml.diff.DiffOpReceiver.
Oracle XML Developer's Kit for Java is included with Oracle database. These is no external link for these libraries to download. Look at this Installing XDK. This link will show you where is the jar for XDK located in Oracle Database see Installing Oracle XDK for Java Components.
I found Maven Dependency for Oracle-xdb& Oracle-xsql. Also these is one link which contains oracle.xml.differ.Diff - Jars. I am not sure about the jar given in oracle.xml.differ.Diff - Jars are from which version of Oracle. But, you can checkout them too.
I hope this helps you.
Maybe this is a tricky work around but if this is useful to someone, well just my two cents.
Search for oracle.xml.differ.Diff in findjar.com, then you get the
jar name: xml.jar and xmlcomp.jar
Search for "xmlcomp.jar index of" in google,
then you will get a public route in somepage with the publicated non
restricted jar ready to download.
I got this xml.jar and this xmlcomp.jar, and even this xmlcomp2.jar under oracle/product/11.2 folder. Maybe the link will die over the time, but you can always get the jar doing step 2.
Info for people like me, who are only checking for the Jar:
First of all, please tell that, this is a commercial licence product. That's the reason, we are unable to found the XML.jar in internet. Even in documentation also, they are always mentioning it is under the lib folder. But, you can't get the lib folder directly accessible on internet.

Import EMX into Eclipse via command line

I hope my question will be clear enough as I am not used to Eclipse environment.
My goal is to create a project in Eclipse with an already existing EMX file. I gather that file from a Git repository.
And I would like to create a command line (or a script, or anything I can run automatically from remote) that imports that EMX file into Eclipse, so I can use another script (already created) to work with this EMX.
My problem is that I don't know how to create this script or command line.
I've tried solutions found here at StackOverflow, without success. Maybe I'm just bad :p
As I am beginner in Eclipse stuff, if someone has a link to a clear tutorial or working example, it would be very nice.
Note: I just have the EMX file (no .project or whatever). So I guess I need to create a project with this file, and not just import an existing project.
Thank you very much for your help :)
Laurent
I finally managed to do what I wanted by creating a plugin which imports projects from a given path into my current workspace.
Main part of the code is from: http://code.google.com/p/headlesseclipse/source/browse/branches/JUnit/com.ind.eclipse.headlesseclipse/src/com/ind/eclipse/headlessworkspace/HeadlessProjectImport.java?r=88
I did not find any way to do this outside the plugin. Grovvy solution was giving plenty of errors and without CDT, the first simple solution I looked for was not available.

Cannot find the "GoogleAccountManager" in the google plus example

While trying the google plus API example from the project site I'm completely stuck with one import:
import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager;
This thing just doesn't seem to exist in the project.
The sample is a read-made Eclipse project I imported, and to be sure I checked if the massive amount of .jar's in the /lib directory are added to the build path. They are, I can see them listed in the Referenced Libraries part in my Eclipse project.
I can find mentions of com.google.api.client.googleapis.extensions.android2.auth but there just doesn't seem to be any GoogleAccountManager class around.
Several possibilities I have come up with, but can't find out which is it, let alone find a solution to them:
I have not set up my project correctly. I doubt it, but completely possible. This would mean that the example has a broken project set-up and/or I managed to not import all libraries?
The class or package or something like that is renamed // named differently. This would mean the example is broken out of the box, and that I still need to find the correct class (and change the import + calling code to that)
Something else :D
The following are the contents of the libs directory as you can also browse on the project page . Notice that it does containt google-http-client-extensions-android2-1.6.0-beta.jar
google-api-client-1.6.0-beta-sources.jar
google-api-client-1.6.0-beta.jar
google-api-client-extensions-1.6.0-beta-sources.jar
google-api-client-extensions-1.6.0-beta.jar
google-api-client-extensions-android2-1.6.0-beta-sources.jar
google-api-client-extensions-android2-1.6.0-beta.jar
google-api-services-plus-v1-1.3.0-beta-sources.jar
google-api-services-plus-v1-1.3.0-beta.jar
google-http-client-1.6.0-beta-sources.jar
google-http-client-1.6.0-beta.jar
google-http-client-extensions-1.6.0-beta-sources.jar
google-http-client-extensions-1.6.0-beta.jar
google-http-client-extensions-android2-1.6.0-beta-sources.jar
google-http-client-extensions-android2-1.6.0-beta.jar
google-http-client-extensions-android3-1.6.0-beta-sources.jar
google-http-client-extensions-android3-1.6.0-beta.jar
google-oauth-client-1.6.0-beta-sources.jar
google-oauth-client-1.6.0-beta.jar
gson-1.7.1.jar
guava-r09.jar
On the first page is a link to updated Google plus libraries google-plus-java-starter_v5.zip
Updated Link: google-plus-java-starter_v5.zip
It contains android/libs/google-api-client-extensions-android2-1.6.0-beta.jar, which contains GoogleAccountManager class.
As this is an extension it probably needs other jars too.
(summary of comments)
Manually adding /libs/google-api-client-extensions-android2-1.6.0-beta.jar to the build path and verifying that it is in the Referenced Libraries fixes the problem. It is unknown (to me (Nanne)) why this doesn't happen automagically when adding the libraries, but there you are.
Right-click on Project, select Properties->Java Build Path->Order and Export Tab->click on checkbox for “Android Private Libraries”. That worked for me.

Categories