Native gcj: --resource does not work

Jens Fransson fransson@fransson.de
Thu Dec 16 13:46:00 GMT 2004


Hello everyone!

Currently I am trying to get a native, statically linked executable to
run under Windows. I encounter trouble when referencing resources
(properties files, that is) that are supposed to be statically linked
into the executable.


The environment I am using is MinGW with GCC 3.4.2 (mingw special).
More precise the result of "gcj -v":

Reading specs from C:/program/mingw/bin/../lib/gcc/mingw32/3.4.2/specs
Reading specs from C:/program/mingw/bin/../lib/gcc/mingw32/3.4.2/../../../libgcj.spec
rename spec lib to liborig
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw
 --enable-threads --disable-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --e
nable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --ena
ble-interpreter --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.2 (mingw-special)


I am building the application by the following commands:

gcj -v --resource com.fransson.app.myprog.localization.Language_de.properties -o Language_de.o -c com/fransson/app/myprog/localization/Language_de.properties
gcj -v --resource com.fransson.app.myprog.localization.Language_en.properties -o Language_en.o -c com/fransson/app/myprog/localization/Language_en.properties
gcj -v --resource com.fransson.app.myprog.localization.Language.properties -o Language.o -c com/fransson/app/myprog/localization/Language.properties

gcj @java-files.txt Language_de.o Language_en.o Language.o -v -mwin32 -Dfransson.debug=true -o MyProg.exe --main=com.fransson.app.myprog.MyProgLauncher


Compiling seems fine, but when trying to load a properties file via ResourceBundle.getBundle()
I get the following error:

C:\temp>MyProg.exe
Launching MyProg.
Properties file: 'com.fransson.app.myprog.localization.Language'
Resource not found: java.util.MissingResourceException: Bundle com.fransson.app.myprog.local
ization.Language not found
Properties File: 'com.fransson.app.myprog.localization.Language'
Locale: 'en_US'
Loader: 'gnu.gcj.runtime.VMClassLoader@ccdfc0'
java.util.MissingResourceException: Bundle com.fransson.app.myprog.localization.Language not
 found
   at __GLOBAL__I_com_fransson_app_myprog_localization_Language.properties_00000000_912BC110
_resource (C:\data\develop\java\projects\compare\build\gcj\com\fransson\app\myprog\localizat
ion\Language.properties)
   at __GLOBAL__I_com_fransson_app_myprog_localization_Language.properties_00000000_912BC110
_resource (C:\data\develop\java\projects\compare\build\gcj\com\fransson\app\myprog\localizat
ion\Language.properties)
   at __GLOBAL__I_com_fransson_app_myprog_localization_Language.properties_00000000_912BC110
_resource (C:\data\develop\java\projects\compare\build\gcj\com\fransson\app\myprog\localizat
ion\Language.properties)
   at __GLOBAL__I_com_fransson_app_myprog_localization_Language.properties_00000000_912BC110
_resource (C:\data\develop\java\projects\compare\build\gcj\com\fransson\app\myprog\localizat
ion\Language.properties)
   at __GLOBAL__I_com_fransson_app_myprog_localization_Language.properties_00000000_912BC110
_resource (C:\data\develop\java\projects\compare\build\gcj\com\fransson\app\antiplagiari
C:\temp>

This error does not occur when the properties files are available
externally in the classpath. It seems that gcj cannot find its
properties files within the executable, although they are linked in:

C:\temp>nm MyProg.exe | grep properties
00430440 t __GLOBAL__I_com_fransson_app_myprog_localization_Language.properties_00000000_912
BC110_resource
00430400 t __GLOBAL__I_com_fransson_app_myprog_localization_Language_de.properties_00000000_
498DC8C6_resource
00430420 t __GLOBAL__I_com_fransson_app_myprog_localization_Language_en.properties_00000000_
2A5E0676_resource
00659740 B __ZN4java4lang6System10propertiesE
006596c8 b _no_properties


Is this a bug in gcj? Am I missing anything?
Any help would be greatly appreciated!

Cheers,
Jens



More information about the Java mailing list