I have an Android project and a web application project.
I want to send an Object between them. I opened a new project with a class called SharedObj.
this class I exported to a jar file and I imported it to both project as external library's.
In the web application project it's recognized the class SharedObj and in the android project it's not.
what is the problem?
I had the same problem weeks ago. I created "libs" folder and placed the *.jar there with other external. It works for me.
I strongly suspect you put your jar into the wrong folder. The jar should go into the /libs folder, at the top level of your project directory.
If you are using Windows..
Copy your jar file by doing right click -> copy, then open eclipse and paste it in the libs folder. Then right click on the pasted file and click on Build Path -> Add to build path
Related
I'm developing a RestFul services and I have my jar client that contains all my DTOs to communicate with the android application(client side). I can have reference to my jar client in the eclipse editor, but when I generate the APK and run the application in my emulator or my cellphone the class doesn't exist because the jar wasn't imported to the APK.
I test many things, adding the jars into the library and export them, also, I created a User Library and included all my jars into this and export that library, but neither of these work.
Anybody can help me please?
First of all, create a folder called "lib" inside your eclipse project and put all your jar files in that folder.
Then. go to:
Project->Properties->Java Build Path->Libraries
Just click into "Add JARs..." and select the jar files inside the lib folder.
Click and OK and Clean/Build your project
You will probably need to export the JAR file you are referencing if it hasn't already been added to the "Android Private Libraries" group in Eclipse.
I am using SHERLOCK-ACTION-BAR in my project
I successfully am able to run the project using the library refered in eclipse
What i am not able to do::
I am trying to add JAR file to libs in my project and run it
(removing the reference i made earlier to my previous library)
So i copied the JAR from Libs of Sherlock library project and added
to my project
When i do this i am not able to import the class file from JAR
Where can i download the correct JAR
You can add JAR from Project - Properties.
Then go to Java Build Path and add your JAR or External JAR.
Clean your project after add it ;)
I have create a simple program using Eclipse 4.1.. I wanted to build or deploy my project into a .jar. I also added external libraries in my project. I wanted the output same as in Netbeans with the .jar file and lib folder in the dist folder, but there should be also a folder named help and lang.. How can I do this with eclipse?!
Follow the steps provided here.
Or if you don't want to complex things up, select Runnable JAR file instead of JAR file set the directory where the .jar is to be written then click Finish.
Eclipse will create the [Project Name]_lib directory for the external libraries included in the project.
I am trying to use external jar file in android application. The jar file is running well in another java application but when I am trying to use the Jar file with Android Application by BuildPath-> Add External Jars; it is showing following errors
"could not find class referenced from method ".
Please help me out from this.
Thanks
Shorav
Maybe the ADK update has messed-up with your project's build-path. Try removing the JAR and add it again to your libs folder, and do a Clean Project.
following poster's comment about not having a libs folder:
You should try this:
Remove all references to the JAR in your project -> your code should not build without error anymore
Create à libs folder at the root of your project
Copy the JAR into the libs folder
(If still not running OK) Right click your project > Android Tools > Fix Project Propertie
If you want to use a Jar in android application you may create it like this:
Open your IDE
Click on new
Choose new Android project
Give the name of your project
Check option make this project as library
I am using Eclipse and I have just started working on a project that needs another project (say pjkt) to function. The pjkt project files are stored in a specific folder. I would like to create a jar from pjkt and then add this jar to my project buildpath. How do I do this? Do I need create first in Eclipse a new project from the pjkt code, build it and then select the export command?
Yes create a new project and export as .jar.
To answer the question about the build path:
Create a project directory (in the using project) for library files - it's common to create it in parallel to /src and /bin and call it /lib;
Once you've created (by exporting) your jar from the used project, copy it into the /lib directory;
If you did any of this creating and copying outside of eclipse, refresh your project so everything will show up in the Project Explorer;
In the Project Explorer, right-click on the .jar in the /lib folder and do "Build Path | Add to Build Path".
Done!
If you need to work on both projects, and have them open in Eclipse at the same time, another approach is to open Properties -> Build Path for the new project, and add pjkt on the Project Dependencies tab. This will provide all the exported resources from pjkt to the master project.