netbeans & java, resourceMap.getString returning null -
product version: netbeans ide 6.8 (build 200912041610) java: 1.6.0_17; java hotspot(tm) client vm 14.3-b01 system: windows 7 version 6.1 running on x86; cp1252; en_gb (nb)
hello, newbee java programmer here , wondering if can help, have been having problems updating gui desktop application in netbeans, here details:
my current application gui works great, appearing correctly.
when update gui adding new label netbeans toolbox onto form, , use netbeans preview function, looks great
however when run application new label has disappeared..
to try , understand problem ran app in debug mode , stepped through auto-generated initcomponents() code
from debugging believe problem comes line of code:
test_lbl.settext(resourcemap.getstring("test_lbl.text")); // noi18n
after line of code has executed test_lbl.settext equal null..
so label disappearing when run app because has no text value display...
i opened resource map file in notepad (the .properties file) , contains entry "test_lbl.text=jlabel1" among entries other working controls...
so properties file has correct value, resourcemap.getstring not retrieving it
i can work around problem changing "automatic resource management" option of form "all resources" "off"
as result changes auto-generated "settext" code line to:
test_lbl.settext("jlabel1");
and makes label display correctly when application runs
my first question be, known bug? or have done silly , accidently changed setting someware?
if not bug, how correct problem without changing resource management setting?
if bug, implications of turning off automatic resource management?
thanks help, - gaz
i assume you're running under nb (run > run main project)?
try clean build (run > clean , build main project). fix it.
it's issue of how build system structured.
when run project in clean repository (run > run main project):
- the .class files written $project/build/classes
- the non-class files copied tree
- the whole thing run there.
that works fine.
if "build" project (run > build main project): 1. .class files written $project/build/classes 2. non-class files copied tree 3. whole thing rolled jar file.
that works fine.
however, if subsequently make changes , run project, class files , resources appear in 2 places:
- in build/classes
- in dist/project.jar
this works ok far finding class files. resources, however, found in jar first. so, @ runtime, code finds outdated copy of properties file in jar, not new 1 in filesystem.
also: nb ignores case when finding resource, sun's jvm not (not sure icedtea). so, if wrong case used nb may insist file there, jvm not able find it.
Comments
Post a Comment