1
votes

I recently moved my NetBeans projects to a new laptop and have run into this problem. When I 'Clean & Build' my project two new folders are created, c:\build and c:\dist, and the classes and jar etc. are placed in them instead of in {project-folder}\build and {project-folder}\dist.

This is where the build.dir and dist.dir are set in the project's build.xml

<property name="build.dir" value="\build"/>
<property name="build.classes.dir" value="\build\classes"/>
<property name="build.test.classes.dir" value="\build\test\classes"/>
<property name="build.test.results.dir" value="\build\test\results"/>
<property name="dist.dir" value="\dist"/>
<property name="dist.javadoc.dir" value="\dist\javadoc"/>
<property name="build.classes.excludes" value=""/>
<property name="dist.jar" value="\dist\build.jar"/>

This is the build output;

ant -f "E:\My Projects\NetBeans\Java_5x" -Dnb.internal.action.name=rebuild clean jar init: deps-clean: Updating property file: C:\build\built-clean.properties Deleting directory C:\build clean: init: deps-jar: Created dir: C:\build Updating property file: C:\build\built-jar.properties Created dir: C:\build\classes Created dir: C:\build\empty Compiling 116 source files to C:\build\classes Copying 116 files to C:\build\classes

Anyone got any ideas as to why this may be happening?

Thanks!

1

1 Answers

2
votes

Remove the leading slashes from all your properties.

<property name="build.dir" value="build"/>
<property name="build.classes.dir" value="build\classes"/>
<property name="build.test.classes.dir" value="build\test\classes"/>
<property name="build.test.results.dir" value="build\test\results"/>
<property name="dist.dir" value="dist"/>
<property name="dist.javadoc.dir" value="dist\javadoc"/>
<property name="build.classes.excludes" value=""/>
<property name="dist.jar" value="dist\build.jar"/>

You can see this yourself if you write a test method:

public static void main(String[] args) {
    System.out.println(new File("/build").getCanonicalPath());
}

The leading slash indicates that it's supposed to be at the root of the working directory's device, even on Windows.