2

I have Tapjoy sources sources, which have such sructure: Tapjoy/src/com/tapjoy/*.class

It must be compiled with Android API Level 9 and higher. My project is in version Android API Level 8.

So I need to make from sources of Tapjoy -> tapjoy.jar file and include it to my main project.

How can I make .jar file properly with command line or from eclipse?

Mat
  • 202,337
  • 40
  • 393
  • 406
yozhik
  • 4,644
  • 14
  • 65
  • 98
  • 1
    If Tapjoy requires API Level 9, it's very likely that you will not be able to complile with API Level 8, because some required symbols will not be present. Just recompiling from source doesn't help if a certain required functionality isn't present. – Aleks G Feb 03 '12 at 13:38
  • 1
    Thanks all for help, I checked out the most appropriate answer, and will write details as soon as possible to help avoid problems for other developers – yozhik Feb 03 '12 at 15:54

4 Answers4

8

In Eclipse IDE, it's very easy to create a JAR file.

Just right click on your package > Export > Java > JAR File (and follow the wizard!)

Aurélien Guillard
  • 1,203
  • 8
  • 20
  • I know this, but when I am adding Tapjoy to project it prompts many errors. How to connect it properly? – yozhik Feb 03 '12 at 13:41
6

Or from command line

jar cvf tapjoy.jar Tapjoy.class
Dave
  • 121
  • 4
  • I put it to D:\ , the classes in com.tapjoy.*.class. After that I used cmd: "jar cvf tapjoy.jar com" And it have included all classes in tapjoy.jar file. But when I connected it to eclipse project - It don't see these files(( – yozhik Feb 03 '12 at 14:12
  • How are you importing the jar into your project? You might have to add it to the class path also. Project -> Properties -> Java build path -> Libraries -> Add External Jars. Browse for the jar and click Finish – Dave Feb 03 '12 at 14:45
1

both are possible

you can also use ant or maven for this kind of functionality.

check for the jar tool for commandline approach!

check eclipse ant build for eclipse approach and check the ant jar task for ant approach

MozenRath
  • 9,652
  • 13
  • 61
  • 104
0

In Netbeans IDE, you can easy create own jar library,

Projects on Right click -> Clean and build

Thats it. You can use it now your "Project Location"/dist/MyApplication.jar

All you need to do create new project and import your jar file How to import Jar File ?

Community
  • 1
  • 1
Ferhat KOÇER
  • 3,890
  • 1
  • 26
  • 26