Netbeans Platform and Default User Directory Settings
August 16th, 2007 | by Tonny Kohar |If you build application on top of Netbeans Platform, the default user directory setting will be in .app-name/dev. Well, this will quickly turn become problem when you deploy your next version of application, because the next version will read that directory settings for any persistence object and try to load it. If the new version is compatible then everything will works ok, if not then it is become big problem.
Note: This should not become a problem if you are using the version info (major, minor, spec) correctly.
So far, I have not find any methods to automatically delete the existing directory. So I must come up with a workaround. This workaround is basicly try to change the value in etc/app-name.conf file default_userdir=”${HOME}/.${APPNAME}/dev” to something like “${HOME}/.${APPNAME}/${APP-VER}”, in order to avoid persistence setting clashing.
The simplest way is to change the default one in [Netbeans-IDE-install-dir]/harness/etc/app.conf, but every application build with that Netbeans IDE will use the that settings. Since, we have more than 1 application build with Netbeans IDE, this approach is no go.
The alternative approach is slightly more complex
First edit the suite project.properties
In the suite project.properties, add the following
app.version=2.0
Second edit the suite ant build.xml file
This is basically just override the build-zip ant target to change the value of app-name.conf by:
1. unzip the build-zip result
2. change the value
3. zip again
<target name="build-zip" depends="suite.build-zip"> <property name="nbdist.dir" value="dist"/> <property name="release.dir" value="${nbdist.dir}/${app.name}"/> <unzip src="${nbdist.dir}/${app.name}.zip" dest="${nbdist.dir}"/> <replace file="${release.dir}/etc/${app.name}.conf" token="/dev" value="/${app.version}"/> <zip destfile="${nbdist.dir}/${app.name}-updated.zip"> <zipfileset dir="${release.dir}" prefix="${app.name}"/> </zip> <echo message=" "/> <echo message="cleaning and finalizing release" /> <delete dir="${release.dir}"/> </target>
Finally
Your are done, make sure you test it ![]()









2 Responses to “Netbeans Platform and Default User Directory Settings”
By Sarah Kho on Sep 22, 2009 | Reply
Thank you for providing the link. I copied the exact content of the code provided in the blog entry into my build.xml file and I get the following error:
/opt/Networking/build.xml:92: Replace: source file /opt/Networking/release/etc/networking.conf doesn’t exist
Line 92 is the line which has the replace task in.
By Tonny Kohar on Sep 28, 2009 | Reply
@Sarah
Please make sure the path is correct in your environment and adjust the above 2 variable nbdist.dir and release.dir accordingly