Two Laptop Bag*
The moose likes Java in General and the fly likes dll in a Jar File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "dll in a Jar File" Watch "dll in a Jar File" New topic
Author

dll in a Jar File

Bora Sayiner
Greenhorn

Joined: Aug 21, 2011
Posts: 2
Hello. I' m using JNI for comminicate some native c++ methods. And I wanna make a distribution include this dll file to jar. How can i do this. Is there ant exam?
Thank for your answers.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14158
    
  19

Welcome to the Ranch.

I don't think it is possible to include the DLL file inside the JAR file, if that is what you mean. Windows doesn't understand JAR files by itself, so it doesn't know how to find the DLL inside the JAR file. You'll need to distribute the DLL along with your JAR file, as a separate file. If you want to make it easy for your users, you could make an installer for your program which sets it up as it should. See Open Source Installer Generators for programs that can make an installer for your program.

What do you mean with "is there ant exam"?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41904
    
  63
I don't think it is possible to include the DLL file inside the JAR file, if that is what you mean. Windows doesn't understand JAR files by itself, so it doesn't know how to find the DLL inside the JAR file. You'll need to distribute the DLL along with your JAR file, as a separate file.

I gotta disagree here. It's perfectly possible to distribute JNI libs via jar files. For example, signed jar files are the way to distribute JNI libs for use with JNLP and applets.


Ping & DNS - my free Android networking tools app
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38902
    
  23
Question too difficult for "beginning". Moving.
Bora Sayiner
Greenhorn

Joined: Aug 21, 2011
Posts: 2
ok i said any example about include dll to jar file. How can i do this. Thanks for your reply
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dll in a Jar File