I've been trying to find the so-called lib folder, to install some 3rd-party tools (this) there. They tell you to: "place it (downloaded jar file) in your Android app’s libs/ folder". But, in Eclipse, I could not find the lib folder even after expanding all of the directories shown in the navigator area. Will someone tell me where this lib folder is? Thanks.
If you use Eclipse do the following:
Right-click your project and hit 'Project Properties'.
Choose 'Java Build Path'.
Choose the 'Libraries' tab.
Hit 'Add External JARs...'.
Navigate to your desired .jar-file and hit 'Open'.
Click 'OK'.
Then you should be able to reference your external library.
You have to create it if it's not already there. It should be in the top level of your project folder, at the same level as the src and res folders.
Your lib folder is indeed used for storing external libraries.
This is commonly used to hold external .jars for external libraries, similar to how a .dll works.
You need to place the files in this folder yourself, then add them to the project as an existing archive to use them.
Let me know if this is unclear or you have any more questions!
EDIT:
You need to make sure you're putting this in your imports:
import myLib.fullyQualifiedClassName.*;
Hope this helps!
Related
I've been working on some project that involves Jar files to be added to build path. but one of my colleagues said that adding the jars to lib folder is advantageous compared to adding it normally.
Now my problem is, in eclipse, I right click and add a java project, but to my surprise I don't find a lib, earlier when I used to do J2EE apps, I used to find that. please let me know how can I fix this.
Thanks
In eclipse when you create a Java project, it doesn't create the lib folder along with it. This is something you want to do manually. At project level you can right click and add the folder. Then you can paste the jars into the folder, select the jars, right click, build path, Add to Build path.
Alternatively you can directly drag and drop to your Referenced Library. Both the ways are similar in effect, no difference.
I have my project, say project Bob. This project needs to be exported.
Project Bob needs libraries, so I need to export those too. I do not, however,
wish to extract the libraries into Bob's jar itself.
When exporting with libraries in a folder next to the jar, the lib folder is called Bob_lib. My question is simply how to make that folder into just lib.
I could rename the folder and update the manifest file, but that's a bit of a
hassle for every time I export.
You can simply use "FileSync" plugin for Eclipse to sync your JARs (or any other files) to the project export folder (or any required folder).
Please refer below URL for "FileSync" plugin for Eclipse:
http://andrei.gmxhome.de/filesync/
I suggest you could check "save as ANT script" in the export dialog, and then edit the script and do the desired replacing.
Notice that all the paths within this script are absolute, in case you want to move/copy it to another folder.
I'm building a Java Swing Application. This project requires a jar file called JCalender. I've added this to Libraries folder and everything works fine on my computer in NetBeans. But when i open the same project in my friends NetBeans, it doesn't recognizes this library. I've to manually select the file placed inside the projects dist/lib folder. How to avoid this? please help!
But when i open the same project in my friends NetBeans, it doesn't
recognizes this library. I've to manually select the file placed
inside the projects dist/lib folder. How to avoid this?
You can't avoid this because it's not a problem actually. To compile and run a project you need to have access to the external libraries involved in the development, so if you open your NetBeans project in a different computer than yours you will definitely need to resolve the reference to the external libraries. There's no way for the IDE to do it automatically as far as I know.
Can't i give the relative path to the lib folder for that specific
library somewhere in project properties?
You could just give it a try. IMHO if the real goal is to share a project with other developers then I'd change the strategy. I'd create a Library (Tools -> Libraries) and tell my mates to create the very same library including the JCalendar JAR files in the library's classpath. I'd include this library in the project properties and finally I'd use a versioning tool like Git or SVN to share the project.
By doing this your mates still need a copy of the JAR file wrapped in a NetBeans Library, but the project properties won't point to a fixed/relative path looking for a JAR file but wil include a reference to a given Library. The Library itself will resolve the dependency to the JAR file. If you take a look to the project.properties file you'll see something like this:
javac.classpath=\
${file.reference.jcalendar-1.4.jar}
But if you as I've suggested then you'll see something like this:
javac.classpath=\
${libs.JCalendar.classpath}
Here libs.JCalendar.classpath will resolve the dependency so your mates can have the actual JAR file located in whatever folder they like and the project should compile just fine.
Another option is using Maven to manage the projects dependencies but honestly I'm not a Maven expert so I can't help you in this path.
You need to do a "clean and build" and your jar will be in the dist folder. It will include the external jars
You can read more about it here
I think your problem is due to you are providing absolute path of jar file.
while choosing jar on write side of filechooser there is option of
Relative path and Absolute path there you should click on Absolute path.
i am new to java , but anyway , i have faced the same problem and found a solution for my project
If you are in Netbeans , its would be very easy for you
Let you project name is ABC and all your dependent jar file is under the
the folder MyResourceCollection
now we need to permanently import all jars under this folder ,
So from Netbeans ,
right click on your project name
go to properties
go to library
in the library page , check the "libraries folder" label
you can find a browse button at the right side of the label
click browse and select the MyResourceCollection folder
a new window will come , just press Next-->Next--->Finish
all is done , now check yourself by moving the folder into different location
I have a problem, I need to add a .jar file into android dependencies folder in eclipse. I have looked for similar stack posts but none of them worked for me.
I have tried pasting the jar file into the libs folder but it gives an error
cannot copy the clipboard content into the selected items"
I have to deliver my work by tomorrow. Please help. Thanks in advance
Add it to the classpath, which is specified by the "Java Build Path" menu in the project properties.
More info here: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-properties-build-path.htm
If you're using the ADT plugin for Eclipse, you must add it to your classpath. Simply right-click on your project, choose 'Properties', go to the 'Java Build Path' tab, and, in the 'Libraries' tab, click "Add External JARs" and import your JAR. This will auto-import the file and allow you to use it in your projects.
Your problem may be similar to this one: Difference between Libraries & lib folders ? How do we add jar files to lib folder?
I have an Eclipse/Java project (Eclipse 3.5.2) that I am trying to add some JARs to. In the root project directory I have 3 sub-directories, src, bin, and lib and all 3 sub-directories are present in the Package Explorer list. I put the needed JARs into lib. However, when I go to Project Propertes -> Java Build Path -> Libraries (tab) -> Add JARs, and the file dialog comes up, it only shows the src and bin directories in the file picker, not the lib directory. I'm guessing it is something really simple, but can someone tell me why the file picker dialog doesn't show the lib directory?
-- roschler
After you copy a jar file to your lib folder, you need to refresh the project in Eclipse (use F5) so Eclipse knows about it.
It will then show you the lib folder in that dialog.
Note: You are correct in your answer that the said dialog doesn't reread the directory structure, but you are missing the point - it is not supposed to. That's what you have "add external jar" for. Further more, Eclipse is trying to be smart and not show you jars that you have already added (think about a folder with 50 jars and you just want to add one). That's why it didn't show you the lib folder - it thought the folder was empty.
This is to help others. I had to do File -> Refresh to get Eclipse to see the files. Apparently file picker dialogs do not reread the disk structure. I guess they are pulling from Eclipse's main file directory image which has to be refreshed before new files are visible anywhere else in the program.
This is how I resolved this problem.
I created a lib folder in my java project.Then I added some jar to lib folder.
But it doesn't appear in my eclipse IDE.Then I selected my project and right clicked on it. Then refreshed.
It works for me. I think this will help you.