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


Groups > comp.lang.java.programmer > #18800

Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Nigel Wade <nmw@ion.le.ac.uk>
Newsgroups comp.lang.java.programmer
Subject Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs)
Date Mon, 17 Sep 2012 10:10:39 +0100
Lines 41
Message-ID <abo7ofF12kU1@mid.individual.net> (permalink)
References <08dcc4bb-ac13-4992-b576-1d4f51a28d2e@googlegroups.com> <aauhg0F26rkU1@mid.individual.net> <a678337b-f349-4648-8ac6-3b854de9545c@googlegroups.com> <83333a34-5a38-4199-a83b-db2c2c39658b@googlegroups.com> <c2b23e07-fdba-4b91-850a-1c2d104b59db@googlegroups.com> <734d3450-00d4-45cf-a760-f78a10613945@googlegroups.com> <k2nom9$gap$1@dont-email.me> <84caa856-f49b-4ae3-8ae8-e7c5b6579b11@googlegroups.com> <k2o4d5$1rv$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net RyWPnFswIMg1JXYk+DQRpQJJCC88Q42fKVP+Ot2CfUgaHIqj/oom4du2Kr/TrRrAJR
Cancel-Lock sha1:9eUI0B/VcFKh6ELJuwJLrtGoDUg=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0
In-Reply-To <k2o4d5$1rv$1@dont-email.me>
Xref csiph.com comp.lang.java.programmer:18800

Show key headers only | View raw


On 11/09/12 20:45, markspace wrote:
> On 9/11/2012 11:08 AM, Lew wrote:
>> markspace wrote:
>>> To run, you use java -cp <path to all needed jars> -jar <path/your jar>
>>
>> The problem with that is that the command will ignore the "-cp"
>> parameter.
>>
>> "-cp" and "-jar" is either/or proposition.
>>
>
>
> Yes I totally forgot about that. I guess I don't actually run java from
> the command line very often.
>
> That leaves setting the classpath in the jar itself, which is kind of
> tricky if you are going to be moving the jar to other people's
> computers. Java WebStart and OneJar come in handy here.

It's not tricky at all if you setup the correct type of NetBeans 
project, as I already said. NetBeans will do it all for you. There's no 
need to start messing with jar's, manifests or Ant. It's very often 
easier to re-create the project as a Java Application than it is to 
"fix" a broken one.

With a NetBeans Java application all you need is the contents of the 
dist/ directory. The main project jar will have a properly constructed 
manifest to allow the jar to be executed with "java -jar project.jar". 
Dependency jar's will be in the dist/lib directory, and a Class-Path: 
entry in the manifest will include that directory. When you build the 
project NetBeans very helpfully tells you exactly how to run it:

"To run this application from the command line without Ant, try:
java -jar "/path/to/project/dist/project.jar".

All you need to distribute to anyone else is the dist/ directory. 
There's even a clue in the name.

-- 
Nigel Wade

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-07 05:15 -0700
  Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-09-07 12:24 +0000
    Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) "John B. Matthews" <nospam@nospam.invalid> - 2012-09-07 09:54 -0400
    Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-13 06:40 -0700
      Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-09-13 17:20 +0000
        Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-13 11:00 -0700
        Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Gene Wirchenko <genew@ocis.net> - 2012-09-13 15:36 -0700
      Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Arne Vajhøj <arne@vajhoej.dk> - 2012-09-13 20:34 -0400
  Re: How Do I Publish My Working Project (corresponding dot jar doesn't   work on other's PCs) Nigel Wade <nmw@ion.le.ac.uk> - 2012-09-07 16:17 +0100
    Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Lew <lewbloch@gmail.com> - 2012-09-07 11:11 -0700
      Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) "John B. Matthews" <nospam@nospam.invalid> - 2012-09-07 21:28 -0400
      Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-10 23:29 -0700
        Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Lew <lewbloch@gmail.com> - 2012-09-10 23:49 -0700
          Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-11 05:12 -0700
            Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) markspace <-@.> - 2012-09-11 09:25 -0700
              Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Lew <lewbloch@gmail.com> - 2012-09-11 11:08 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) markspace <-@.> - 2012-09-11 12:45 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 07:24 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 08:00 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) markspace <-@.> - 2012-09-12 08:21 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 08:58 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 09:02 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) markspace <-@.> - 2012-09-12 09:15 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 09:44 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 10:24 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Lew <lewbloch@gmail.com> - 2012-09-12 10:19 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 11:10 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 11:26 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 11:47 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Lew <lewbloch@gmail.com> - 2012-09-12 12:56 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Lew <lewbloch@gmail.com> - 2012-09-12 12:58 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 20:45 -0400
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-12 23:28 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Arne Vajhøj <arne@vajhoej.dk> - 2012-09-12 20:43 -0400
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't   work on other's PCs) Nigel Wade <nmw@ion.le.ac.uk> - 2012-09-17 10:10 +0100
              Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) clusardi2k@aol.com - 2012-09-11 16:21 -0700
                Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) markspace <-@.> - 2012-09-11 17:33 -0700
  Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs) Roedy Green <see_website@mindprod.com.invalid> - 2012-09-07 22:26 -0700

csiph-web