Re: How Do I Publish My Working Project (corresponding dot jar doesn't
work on other's PCs)
On 07/09/12 13:15, firstname.lastname@example.org 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.)
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
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.