Path: csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade 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: Fri, 07 Sep 2012 16:17:20 +0100 Lines: 36 Message-ID: References: <08dcc4bb-ac13-4992-b576-1d4f51a28d2e@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 4ttMqK5CorPOnSQY6oEI7QP0c5o1SwjOAl6+pQ5ftDOF3ENhdt1nUGnmHvXm4YKOgh Cancel-Lock: sha1:r81s/3msYYcoN+cRI2B7CNZ/4hY= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0 In-Reply-To: <08dcc4bb-ac13-4992-b576-1d4f51a28d2e@googlegroups.com> Xref: csiph.com comp.lang.java.programmer:18584 On 07/09/12 13:15, clusardi2k@aol.com wrote: > Hello, > > Once my NetBeans project is finalized what do I have to do to create an executable others can execute without having NetBeans directly installed on the computer. > > Currently, my project contains a dot jav file which I can run to execute my project. But, when others try to execute that same dot jar it doesn't work. (Am I missing something here or should executing the dot jar always work. How should I troubleshoot this problem.) > > Thank you, What type of project did you create in NetBeans? Was it a Java Application? Only this type of project creates the necessary manifest in the project jar for it to be run simply by the java -jar project.jar command. There are also some other constraints which if they are not met will cause NetBeans to not create an "executable" jar. Offhand I cannot remember what they are, and I've not had this problem re-occur for some time. A NetBeans Java Application should create a dist/ directory containing the actual project jar, and a dist/lib directory containing any required additional jars. It should also include an appropriate manifest in the project jar which makes the jar "executable" (i.e. has a Main-Class property). It also includes the lib/ directory in the jar Classpath. Check the contents of your dist/ directory, and the project jar. If it doesn't include these features then it's not a proper Java "application" jar. That may mean that you didn't create it correctly, or NetBeans has cocked up (technical term) the project properties (this does happen). If this does happen the simplest alternative is to create a new Java Application project and copy all your sources into it. Fixing it manually requires dexterous manipulation of, IIRC, project.properties and build-impl.xml. Creating a new project is simpler, quicker, and less likely to bite you back in the future. -- Nigel Wade