Dropbox coreApi adding Java Source Attachment - dropbox-api

I read the https://www.dropbox.com/developers/core/sdks/android article, but i cant do the foolowing steps:
Attaching source in Eclipse
Find the dropbox-android-sdk JAR file in the Package Explorer under Referenced Libraries.
Right-click on the JAR and select Properties.
Select Java Source Attachment from the sidebar.
Click External File and browse to the downloaded SDK .zip file.
Is it change (in eclipse) or not required anymore?

Related

m2eclipse downloads source, but in eclipse I do not see a source attachment

I am confused about m2eclipse.
Sometimes while debugging, I see for example
The JAR file ~/.m2/repository/org/springframework/spring-beans/4.3.4.RELEASE/spring-beans-4.3.4.RELEASE.jar has no source attachment.
Then the plugin downloads spring-beans-4.3.4.RELEASE-sources.jar to my local repo, and the source appears in my eclipse editor.
But when I look in Build path, Libraries at the spring-beans-4.3.4.RELEASE entry, I see Source attachment: None.
Also at the Debug configuration, Source, I see nothing.
click here download here Java source attacher
and download the Java source attacher jar file and then paste to the plugin folder and restart the eclipse.
Then attach the java source shown in below. Done!!!!

How to display the source code of an external JAR in Eclipse?

In Eclipse, I just imported an external JAR. Viewing any of the classes in the Package Explorer will instead of showing a source code open a Class File Editor with saying "Source not found". The folder of the JAR I have downloaded, however, has only JAR, no lib, no src, no docs.
Is there still a way how to view/generate a view the source code so then I can view it in Eclipse properly?
.jar files don't contain source code but are more like binary files for Java.
You can either get the source code from the projects page (if it is an OpenSource project of course)
An other possible way to view the source code of a .jar file is by using a decompiler (http://jd.benow.ca/; Also has a Eclipse plugin I think). This method can be very painful though when an obfuscator has been used by the developer who generated the .jar file.
Try this :
Download java decompiler from http://jd.benow.ca/ and now double
click on jd-gui and click on open file.
Then open .jar file from that folder.
Now you get class files and save all these class files (click on file
then click "save all sources" in jd-gui) by src name.
You cannot view the source form a .jar files as it contains binaries.Use a java decompiler instead to decompile the .class files and view their sources.
If possible I suggest you to use Maven for manage dependencies of your project, in most cases it did the trick for you.
See: Get source JARs from Maven repository

jar file not working for imports in Eclipse

I am following a tutorial from AndroidHive on how to login to Twitter from my app.
The tutorial uses the twitter4j library, so I download it from here and save the zip file to my desktop. In my project I drag the twitter4j zip file into my projects libs folder. Then I Refactor -> Rename the file from a zip to a jar (only changing the extension)
However, when I want to import the classes into my project, it does not seem to be working. I try to do
import twitter4j.Twitter;
But this option is not available. See screen grab.
Can anyone please tell me where I am going wrong with this?
Also, as per the tutorial I have also just added the twitter4j-core file to the project but still imports wont seem to work.
The tutorial clearly says "Download and Extract" That does not mean "Download and Rename". It means download the file and then Use a file compress/uncompress utility to extract the zipped files format. Search in the extracted files to find the relevant jar file and import that file.
1. Download & extract twitter4j library from twitter4j-android-2.2.6.zip (slimmed version for Android platform). Here is the direct link
If you uncompressed correctly then do the following
Right sure that the folder where you copied the twitter library shows up in the Lib path for the project. Right click on the project --> Select 'Properties' ---> Select 'Java Build Path' From the Left hand Menu ---> Select Libraries Tab. Review List of Libraries(expand if needed ) to see if the twitter jar files show up here.
If not Select 'Add Jar' browse to the Jar file. Add it. Refresh your project. Clean it and build. You should now be able to import twitter components.

How can I browse the source code in a jar file containing source code in Eclipse?

I have a jar file that contains source code. How can I browse this source code in Eclipse?
At the moment, my Eclipse opens the jar file in a Text Editor, and it isn't that helpful.
When I look in the preferences "General" > "Editors" > "File Associations" I have no associations for *.jar and if I look in the available "Editors" I can't find anyone that seem to be a good fit for jar files.
How can I browse the source code in a jar file using Eclipse? Is there any Editor I should configure for jar files?
If you have the jar added to a project's classpath, you can view its source by:
Expanding Referenced Libraries in the Package Explorer view
Expand the jar you're looking at
Double clicking on a .class file
You need both the .class and .java file in the jar to view source, though.
If you have only the .java file, the class won't appear at all.
If you have only the .class file, the class will appear as bytecode.
Example:
Extract the jar in some source directory (it's a zip file), and create a project with this directory as source.
Or, if this source jar file contains the sources of a classes jar file that is used as a library in your Eclipse project, just right-click on this jar file, select "Properties", then "Java Source Attachment", then "External File", and select the source jar file. Then each time you browse a class from this classes jar file, Eclipse will automatically show you its source code.
If you want just to open jar o war files (and search or browse scripting code), install the Eclipse plugin called "Eclipse zip editor", from eclipse marketplace. Just in case it's the website to drag and drop to eclipse

Import Libraries in Eclipse?

I just recently downloaded the dom4j library, but for the life of me I have no idea how to access it. I dropped it in the plug-ins folder and rebooted Eclipse, without success. For some reason finding a straight answer for this is more difficult that I thought it would be.
No, don't do it that way.
From your Eclipse workspace, right click your project on the left pane -> Properties -> Java Build Path -> Add Jars -> add your jars here.
Tadaa!! :)
Extract the jar, and put it somewhere in your Java project (usually under a "lib" subdirectory).
Right click the project, open its preferences, go for Java build path, and then the Libraries tab. You can add the library there with "add a jar".
If your jar is not open source, you may want to store it elsewhere and connect to it as an external jar.
For the Android library projects, I do it as in the attached screenshot:
Right click the project, select Properties->Android and in the library section click Add. From here you can select the available libraries.
If you are importing a jar file, then importing them as jar or external jar, as other posters posted would work. I prefer to copy/paste jar file in the libs folder (create one if it doesn't exist) and then import as jar.
If you want to get this library into your library and use it, follow these steps:
You can create a new folder within Eclipse by right-clicking on your project, and selecting New Folder. The library folder is traditionally called lib.
Drag and drop your jar folder into the new lib folder, and when prompted select Copy Files.
Selecting the Project tab at the top of the screen, and click Properties.
Select Java Build Path followed by the Libraries tab.
Click the Add JARs… button and select your JAR file from within the lib folder.
Your JAR file will now appear in both the lib and Referenced Libraries folders. You can explore the JAR's resources by clicking Referenced Libraries.