Gentoo Forums
Gentoo Forums
Quick Search: in
jar file locations
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
seddes
n00b
n00b


Joined: 21 Nov 2004
Posts: 12

PostPosted: Wed Dec 22, 2004 6:26 pm    Post subject: jar file locations Reply with quote

Hi,
If an application uses "jar" files, where should they be placed? What is the convention?

Option 1) Create a directory under /usr/lib, and place them there. This is similar to how "mono" files/dll libs are to be handled. I see that there is a
/usr/lib/mozilla, /usr/lib/MozillaFirefox that comply with this.

Option 2) Create a directory under /usr/share/, and place them there. I see a /usr/share/gettext, /usr/share/largorecipes

Options 3) Put jar in /usr/lib, no subdir. I see a db-4.1.jar that does this.

Thanks for your help.
Back to top
View user's profile Send private message
roka
n00b
n00b


Joined: 03 Jul 2004
Posts: 18
Location: Bern, Switzerland

PostPosted: Wed Dec 22, 2004 7:14 pm    Post subject: Reply with quote

If the app provides the jar files, they should be made avaliable under /usr/share/<appname>-<version>/lib
e.g. /usr/share/xerces-2/lib
Apps requiring a jar would ideally link to the lib from the providing package.
Back to top
View user's profile Send private message
seddes
n00b
n00b


Joined: 21 Nov 2004
Posts: 12

PostPosted: Wed Dec 22, 2004 7:42 pm    Post subject: jar file locations Reply with quote

Ok, but with a mono app, per bug http://bugs.gentoo.org/show_bug.cgi?id=75192

this was the advice:

------- Additional Comments From latexer@gentoo.org 2004-12-21 10:12
PST -------
1) Use the mono eclass to avoid this MONO_SHARED_DIR problem.

2) As much as possible, *.exe should avoid going into /usr/bin. *.dll
*definitely* shouldn't be there. Please see how muine or blam handle the
placement of their files.


blam created a /usr/lib/blam, and put the dll's there. Seems like mono dlls and java jar files should be consistant....

To me, a jar and dll are similar, non-native libraries
Back to top
View user's profile Send private message
roka
n00b
n00b


Joined: 03 Jul 2004
Posts: 18
Location: Bern, Switzerland

PostPosted: Wed Dec 22, 2004 7:53 pm    Post subject: Reply with quote

There seems to be different practices on installing shared libs between java and mono apps.

Here is an extract from the gentoo java policy
Quote:

In general, the directory policies are handled for you by the helper functions in the java-pkg eclass.
These functions adhere to the following pathname conventions:
* .jar files created from source code are installed in /usr/share/${PN}-${SLOT}/lib/
* .jar pre-built files not compiled by the ebuild go into /opt/${PN}/${SLOT}
* Javadoc documentantation is installed in /usr/share/doc/${PF}/html/api/
* user-runnable scripts are installed in /usr/bin
* system-wide env files are in /usr/env.d/java
* user-specific env files are in ${HOME}/.gentoo/env.d/

I am not familiar with mono so I cant figure out what that MONO_SHARED_DIR problem is about.
Back to top
View user's profile Send private message
latexer
Retired Dev
Retired Dev


Joined: 05 Mar 2003
Posts: 239
Location: NYC

PostPosted: Wed Dec 22, 2004 8:40 pm    Post subject: Reply with quote

I've apparently been asked to weigh in on this.

Before i bother, people should read this which is a blog post by Todd Berman, one of the main authors of the monodevelop port of #develop. Second, I'll reference FHS spec found here in several places.

Really, the only discussion is about /usr/lib/ vs. /usr/share/:
The FHS states this:
/usr/lib/: /usr/lib includes object files, libraries, and internal binaries that are not intended to be executed directly by users or shell scripts.
/usr/share: The /usr/share hierarchy is for all read-only architecture independent data files.

With this in mind, jar files and dll files aren't *exactly* the same. In particular, *many* .NET libraries and executables use P/Invoke to call to C functions. See how muine uses libmuine.so to create a glue between .NET and native libraries. To my knowledge this happens a *lot* less frequently in Java.

That said, /usr/share/${subdir}/ makes tons of sense for compiled from source jar files (obviously /opt is optimal for non-compiled stuff). However, for .NET libraries that often times will have needed architecture *dependant* items, /usr/share is not the best. /usr/lib/${subdir}/ is better suited. Beyond that, often an app for simplicity sake will install the foo.exe in the same location, so that no extra work with env. vars is needed when executing to find the linked libraries (see muine or blam again for an example of this).

This does not break the requirement on /usr/lib/ not containing things executed by the user, as these exe files should be being called by a wrapper script in /usr/bin that uses mono to execute them.

Further complicating things is the use of the GAC (Global Assembly Cache), which is used by mono to store/retrieve/look-up assemblies. These get placed under /usr/lib/mono, and thereby adhere to the standard. Precompiled DLLs may also want to be registered in the GAC though, so this is a grey area (in my mind).

That's the best i can do right now, I'll write more later if people want me to expand on anything i said.
_________________
overlays - Use at your own risk. File bug reports on this stuff and i'll kick you in the junk. Ask me before asking upstream if these fail. I mean it. No, really.

#gentoo-dotnet on freenode
Back to top
View user's profile Send private message
seddes
n00b
n00b


Joined: 21 Nov 2004
Posts: 12

PostPosted: Thu Dec 23, 2004 3:11 am    Post subject: Reply with quote

Thanks for clearing that up. The idea of C# using glue/leveraging the existing libraries makes alot of sense to me.
Back to top
View user's profile Send private message
Ox-
Guru
Guru


Joined: 19 Jun 2003
Posts: 304

PostPosted: Thu Dec 23, 2004 6:04 am    Post subject: Reply with quote

I put together an ebuild for myself of a project that is a server and some api libraries to connect to the server. One of the api's is java of course, so I had a heck of a time figuring out how to get the jar files installed (I'm not a java programmer so have almost no experience with it).

"ant install" tried to install the jar's in /usr/lib/java.

Another similar ebuild, the one for cyryus-sasl, put jar files into /usr/lib/java, but all the other ebuilds seemed to do the /usr/share/${PN}-${SLOT}/lib/ thing so I went that route.

Now one of these days I'll figure out how CLASSPATH gets set for all those zillions of /usr/share paths :)
Back to top
View user's profile Send private message
iulica
n00b
n00b


Joined: 28 Jul 2004
Posts: 34

PostPosted: Wed Feb 16, 2005 1:55 pm    Post subject: Reply with quote

Ox- wrote:
Now one of these days I'll figure out how CLASSPATH gets set for all those zillions of /usr/share paths :)

If you figure it out, please share with us :). I'm interested. I need to use connectorj in tomcat5, and the only way was to link the /usr/share/connectorj-3/lib/...jar in the /opt/blackdown.../jre/lib/ext.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum