![]() |
How Do I Publish My Working Project (corresponding dot jar doesn'twork on other's PCs)
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 myproject. 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, |
Re: How Do I Publish My Working Project (corresponding dot jardoesn't work on other's PCs)
clusardi2k@aol.com <clusardi2k@aol.com> wrote:
> 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.) Maybe a trivial question, but do they have Java installed? (I mean, they shouldn't need netbeans, but they will need at least a Java Runtime Environment (jre) to run jar files.) |
Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs)
In article <slrnk4jpsa.u9l.avl@gamma.logic.tuwien.ac.at>,
Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> wrote: > clusardi2k@aol.com <clusardi2k@aol.com> wrote: > > 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.) > > Maybe a trivial question, but do they have Java installed? > > (I mean, they shouldn't need netbeans, but they will need > at least a Java Runtime Environment (jre) to run jar files.) Java Web Start appears to address this on supported platforms in the href provided to the version attribute of the j2se tag. I've never actually tried it, as my platform vendor supplies the JRE. <http://stackoverflow.com/tags/java-web-start/info> -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews> |
Re: How Do I Publish My Working Project (corresponding dot jar doesn'twork on other's PCs)
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 |
Re: How Do I Publish My Working Project (corresponding dot jardoesn't work on other's PCs)
Nigel Wade wrote:
> 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 Not exactly. You can certainly edit the manifest in a normal JAR project or normal Java project. I haven't worked with the "Java Application" NetBeans project, but I've seen some complaints about it in this forum. Just set "Main-Class:" Read the Oracle site docs about JARs and JAR manifests. Your customers can run JARs via Java WebStart, as mentioned, or directly by associating "java -jar" with JAR files (might need "javaw -jar" on Windows platforms). http://docs.oracle.com/javase/tutori...festindex.html > 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. The manifest's "Class-Path:" header, which specifies paths relative to the JAR location on the target system. > 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. You don't need to futz with NB-specific files if you edit manifests yourself, and also you should build from "build.xml", not IDE-specific artifacts. -- Lew |
Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs)
In article <a678337b-f349-4648-8ac6-3b854de9545c@googlegroups.com>,
Lew <lewbloch@gmail.com> wrote: > > 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. > > You don't need to futz with NB-specific files if you edit manifests > yourself, and also you should build from "build.xml", not > IDE-specific artifacts. I like the flexibility NetBeans affords in this area: For convenience, I can use the stock, NB-generated build.xml, even from the command line, and hook into it as needed: <http://stackoverflow.com/q/3955299/230513> Alternatively, I can add a small number of targets to my custom build.xml, and NB will happily adopt it in a free-form project: <http://netbeans.org/kb/articles/freeform-config.html> For example: <https://sites.google.com/site/drjohnbmatthews/manifesto> -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews> |
Re: How Do I Publish My Working Project (corresponding dot jar doesn't work on other's PCs)
On Fri, 7 Sep 2012 05:15:00 -0700 (PDT), clusardi2k@aol.com wrote,
quoted or indirectly quoted someone who said : >Once my NetBeans project is finalized what do I have to do to create an exe= >cutable others can execute without having NetBeans directly installed on th= >e computer. You can bundle it up into a jar. see http://mindprod.com/jgloss/jar.html You can compile the Java with jet to an exe see http://mindprod.com/jgloss/jet.html -- Roedy Green Canadian Mind Products http://mindprod.com A new scientific truth does not triumph by convincing its opponents and making them see the light, but rather because its opponents eventually die, and a new generation grows up that is familiar with it. ~ Max Planck 1858-04-23 1947-10-04 |
Re: How Do I Publish My Working Project (corresponding dot jardoesn't work on other's PCs)
Help, all I need is:
(1) the JDK (which one, The jars were created with NetBeans 7.1.2), (2) put /dist/lib/*.jars" into my classpath environment variable, and (3) possibly use "java -jar" and "javaw -jar"? Thank you, |
Re: How Do I Publish My Working Project (corresponding dot jardoesn't work on other's PCs)
(unknown) wrote:
> Help, all I need is: > > (1) the JDK (which one, The jars were created with NetBeans 7.1.2), That depends on how you have NetBeans and the particular project configured. Which JDK did you configure the project to use? > (2) put /dist/lib/*.jars" into my classpath environment variable, and What? Huh? You shouldn't be messing around with root-level directories like that. Put your project directory under your home directory or in some suitable location like /projects/. > (3) possibly use "java -jar" and "javaw -jar"? What do you mean? The "-jar" parameter to those commands specifies a JAR file for Java to run, if that's what you're asking. -- Lew |
Re: How Do I Publish My Working Project (corresponding dot jardoesn't work on other's PCs)
On Tuesday, September 11, 2012 2:49:00 AM UTC-4, Lew wrote:
> (unknown) wrote: > Help, all I need is: > > (1) the JDK (which one, The jars were created with NetBeans 7.1.2), That depends on how you have NetBeans and the particular project configured. Which JDK did you configure the project to use? > (2) put /dist/lib/*.jars" into my classpath environment variable, and What? Huh? You shouldn't be messing around with root-level directories like that. Put your project directory under your home directory or in some suitable location like /projects/. > (3) possibly use "java -jar" and "javaw -jar"? What do you mean? The "-jar" parameter to those commands specifies a JAR file for Java to run, if that's what you're asking. -- Lew On NetBeans, how do I determine what JDK I'm using. I forgot which one I loaded. Thanks, |
| All times are GMT. The time now is 12:48 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.