Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31070 > unrolled thread

Convention for location of jar files

Started byNoman Shapiro <normanzshapiro@gmail.com>
First post2015-02-07 07:09 -0800
Last post2015-02-08 22:17 +0000
Articles 8 — 6 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Convention  for location of jar files Noman Shapiro <normanzshapiro@gmail.com> - 2015-02-07 07:09 -0800
    Re: Convention  for location of jar files Knute Johnson <eternal@knutejohnson.com> - 2015-02-07 09:57 -0800
      Re: Convention  for location of jar files Arne Vajhøj <arne@vajhoej.dk> - 2015-02-07 15:44 -0500
    Re: Convention  for location of jar files Jeff Higgins <jeff@invalid.invalid> - 2015-02-07 14:52 -0500
      Re: Convention  for location of jar files Fredrik Jonson <fredrik@jonson.org> - 2015-02-08 08:56 +0000
      Re: Convention  for location of jar files Martin Gregorie <martin@address-in-sig.invalid> - 2015-02-08 11:40 +0000
        Re: Convention  for location of jar files Arne Vajhøj <arne@vajhoej.dk> - 2015-02-08 10:54 -0500
          Re: Convention  for location of jar files Martin Gregorie <martin@address-in-sig.invalid> - 2015-02-08 22:17 +0000

#31070 — Convention for location of jar files

FromNoman Shapiro <normanzshapiro@gmail.com>
Date2015-02-07 07:09 -0800
SubjectConvention for location of jar files
Message-ID<0d521fb0-7bef-45f3-8f43-a084e75f0e8c@googlegroups.com>
Is there a convention, or perhaps conventions, for the location of jar files,
for use by scripts with commands like "java -jar someDirectory/foobar.jar" ?

[toc] | [next] | [standalone]


#31071

FromKnute Johnson <eternal@knutejohnson.com>
Date2015-02-07 09:57 -0800
Message-ID<mb5jld$29b$1@dont-email.me>
In reply to#31070
On 02/07/2015 07:09 AM, Noman Shapiro wrote:
> Is there a convention, or perhaps conventions, for the location of jar files,
> for use by scripts with commands like "java -jar someDirectory/foobar.jar" ?
>

There is a package convention. 
com.yournameoruniqueidentifier.packagename...

So that would be your directory hierarchy too.  I keep them under my 
home directory on both Windows and Linux.  So on Windows my directory 
structure is:

C:\Users\Knute Johnson\com\knutejohnson\customer\packagename\...

on Linux

/home/knute/com/knutejohnson/customer/packagename/...

When I deliver a program to a customer, I can use this same directory 
structure or a simpler one where just the end package directory is 
created in the customer's home directory.  I store all data files in the 
same place too.

When you create your program and the manifest file for your program jar 
file you can use relative paths to define the location of any library 
jar files.

I hope that is the question you wanted answered.

-- 

Knute Johnson

[toc] | [prev] | [next] | [standalone]


#31077

FromArne Vajhøj <arne@vajhoej.dk>
Date2015-02-07 15:44 -0500
Message-ID<54d67945$0$286$14726298@news.sunsite.dk>
In reply to#31071
On 2/7/2015 12:57 PM, Knute Johnson wrote:
> On 02/07/2015 07:09 AM, Noman Shapiro wrote:
>> Is there a convention, or perhaps conventions, for the location of jar
>> files,
>> for use by scripts with commands like "java -jar
>> someDirectory/foobar.jar" ?
>>
>
> There is a package convention.
> com.yournameoruniqueidentifier.packagename...
>
> So that would be your directory hierarchy too.  I keep them under my
> home directory on both Windows and Linux.  So on Windows my directory
> structure is:
>
> C:\Users\Knute Johnson\com\knutejohnson\customer\packagename\...
>
> on Linux
>
> /home/knute/com/knutejohnson/customer/packagename/...
 >
 > When I deliver a program to a customer, I can use this same directory
 > structure

That is the location of the class files.

It is not that logical to put the jar files there as very often
a jar file contains multiple packages.

I would say that both main class jar file and lib jar files
should go to an application specific dir.

 >           or a simpler one where just the end package directory is
 > created in the customer's home directory.  I store all data files in 
 > the same place too.

Yes.

 > When you create your program and the manifest file for your program
 > jar file you can use relative paths to define the location of any
 > library jar files.

Same dir or a lib sub dir are two very common options.

Arne

[toc] | [prev] | [next] | [standalone]


#31075

FromJeff Higgins <jeff@invalid.invalid>
Date2015-02-07 14:52 -0500
Message-ID<mb5ql8$u9v$2@dont-email.me>
In reply to#31070
On 02/07/2015 10:09 AM, Noman Shapiro wrote:
> Is there a convention, or perhaps conventions, for the location of jar files,
> for use by scripts with commands like "java -jar someDirectory/foobar.jar" ?
>
My Debian system puts a lot of them in /usr/share/java

[toc] | [prev] | [next] | [standalone]


#31081

FromFredrik Jonson <fredrik@jonson.org>
Date2015-02-08 08:56 +0000
Message-ID<slrnmde961.417.fredrik@biggles.jonson.org>
In reply to#31075
In Jeff Higgins wrote:
>  On 02/07/2015 10:09 AM, Noman Shapiro wrote:
> > Is there a convention, or perhaps conventions, for the location of jar
> > files, for use by scripts with commands like "java -jar
> > someDirectory/foobar.jar" ?
>
>  My Debian system puts a lot of them in /usr/share/java

Yes, but do note that the location /usr/share/java in Debian is global and
solely intended for system wide jar files installed from debian packages. Do
not manually put random jar files there, neither as a user, nor from a
custom application installation script.

https://www.debian.org/doc/packaging-manuals/java-policy/x110.html

If you're including jar dependencies in your privately packaged file, I'd
recommend that you put the jar files in a 'lib' subdirectory of the
installation directiory, or directly in the same directory as your main
application jar.

-- 
Fredrik Jonson

[toc] | [prev] | [next] | [standalone]


#31083

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2015-02-08 11:40 +0000
Message-ID<mb7hv0$8lb$1@dont-email.me>
In reply to#31075
On Sat, 07 Feb 2015 14:52:55 -0500, Jeff Higgins wrote:

> On 02/07/2015 10:09 AM, Noman Shapiro wrote:
>> Is there a convention, or perhaps conventions, for the location of jar
>> files,
>> for use by scripts with commands like "java -jar
>> someDirectory/foobar.jar" ?
>>
> My Debian system puts a lot of them in /usr/share/java

Fedora puts Java stuff in /usr/java. I've added the /usr/lava/jarlib 
directory and put my own and third party jarfiles in it. 

Since this puts an application's main jarfile and its supporting jarfiles 
in a simple side-by-side relationship, it means that manifests in 
application jarfiles should work anywhere provided only that they use 
relative pathnames.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [next] | [standalone]


#31084

FromArne Vajhøj <arne@vajhoej.dk>
Date2015-02-08 10:54 -0500
Message-ID<54d786a7$0$282$14726298@news.sunsite.dk>
In reply to#31083
On 2/8/2015 6:40 AM, Martin Gregorie wrote:
> On Sat, 07 Feb 2015 14:52:55 -0500, Jeff Higgins wrote:
>
>> On 02/07/2015 10:09 AM, Noman Shapiro wrote:
>>> Is there a convention, or perhaps conventions, for the location of jar
>>> files,
>>> for use by scripts with commands like "java -jar
>>> someDirectory/foobar.jar" ?
>>>
>> My Debian system puts a lot of them in /usr/share/java
>
> Fedora puts Java stuff in /usr/java. I've added the /usr/lava/jarlib
> directory and put my own and third party jarfiles in it.
>
> Since this puts an application's main jarfile and its supporting jarfiles
> in a simple side-by-side relationship, it means that manifests in
> application jarfiles should work anywhere provided only that they use
> relative pathnames.

It is a simple approach and simple is usually good.

But it will not work with different versions of the same
library if the jar file name does not include version number.

Arne

[toc] | [prev] | [next] | [standalone]


#31091

FromMartin Gregorie <martin@address-in-sig.invalid>
Date2015-02-08 22:17 +0000
Message-ID<mb8naa$8st$1@dont-email.me>
In reply to#31084
On Sun, 08 Feb 2015 10:54:15 -0500, Arne Vajhøj wrote:

> It is a simple approach and simple is usually good.
> 
> But it will not work with different versions of the same library if the
> jar file name does not include version number.
>
True enough, but easily fixed by adding version info to file names that 
don't include it. I also have a fairly simple shell script that can build 
a manifest and package up the required jar files in a zip archive.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web