Solved

No lib folder and no class-path in manifest when compiling a NetBeans project on a machine which just has Ant

Posted on 2008-09-29
2
933 Views
Last Modified: 2013-12-14
I am writing a Java application using NetBeans. As part of an automated build process, I need to be able to build the projects on a machine that does not have NetBeans installed. It has Ant, however.

For now, I am just creating a new Java Desktop Application, which uses Swing.

When I compile using NetBeans (or using Ant on the machine where NetBeans is installed), the manifest.mf file in the jar contains a class-path entry which is not present when installing on the other machine. Also, a lib folder is created with the two utility jars required for Swing.

There is a difference in the steps that Ant performs on each machine.

On NetBeans machine, -do-jar-with-libraries is executed.
On server, -do-jar-with-mainclass is executed.

This appears to be why the extra steps aren't being performed, so how do I get Ant to perform the correct steps?

I don't want to modify any files in the project, but I have had to create a .properties file outside the project anyway to specify libs.swing-app-framework.classpath and libs.CopyLibs.classpath, so if there is something simple I can add to this file that would solve the problem, that would be great.

Something to do with mkdist.available?

TIA!
0
Comment
Question by:scuzzie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Expert Comment

by:wwnosal
ID: 22599235
Try to include attached snippet somewhere in -do-jar-with-mainclass target before jar is actually created.
<manifest>
  <attribute name="Main-Class" value="${main.class}"/>
  <attribute name="Class-Path" value="${jar.classpath}"/>
</manifest>

Open in new window

0
 
LVL 1

Accepted Solution

by:
scuzzie earned 0 total points
ID: 22601006
It seems that once I had specified libs.CopyLibs.classpath in an additional build.properties file, this was enough to switch conditions and cause the correct path to run.

I just had to specify the path on the ant command-line:
ant -propertyfile ../build.properties jar

worked for me.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SHA2 certs for IIS AND Java? 2 136
throw exception 21 79
eclipse console opening separately 2 50
Setup Eclipse for Andriod development 2 21
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question