aspose file tools*
The moose likes Beginning Java and the fly likes Include other jar files in project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Include other jar files in project" Watch "Include other jar files in project" New topic
Author

Include other jar files in project

Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
Hi!

I think this is a rather simple question but I can get it right.
I need to include antoher jar file in my projects so that when a user downloads my jar no classpath needs to be set. There are altso properties files that a user needs to edit but they must reside outside the jars.

// Mathias


SCJP1.4
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

What do you mean by 'include' and 'projects'?
Sidd Kulk
Ranch Hand

Joined: Feb 20, 2007
Posts: 152
From your query, it seems that you want the user to be able to download your jar file, using some protocol. I don't think you need to do anything, you can just set the content type of your JSP as jar. I am not sure, but it should work.

It would be helpful for us if you can elaborate as to exactly what you are trying to do.

Njoy!!
Sid
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
I have compiled a jar file with my classes. It import classes from another jar.
How can I make it one clickable jar file for distribution without making a lot of bat files or sh files?

And most important, without messing with user classpath?
[ April 19, 2007: Message edited by: Mathias Nilsson ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41863
    
  63
Does it need to be one jar file? The manifest of a jar file can declare a classpath that includes other jar files. So if you distributed a zip file that unzips to a directory full of jars, everything should work nicely. You could even include the main class in all the jars, thus ensuring that it doesn't matter which jar file is double-clicked.


Ping & DNS - my free Android networking tools app
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
Ok I there any short example on how to do this?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14150
    
  18

Have a look at this part of The Java Tutorial:
Lesson: Packaging Programs in JAR Files


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Include other jar files in project