Compilation from JAR files, and "getResourceFromStream()"

Mohan Embar
Tue Nov 25 06:12:00 GMT 2003

Hi Steve,

>    I have found, and had sucess with, the available documentation for 
>explicitly referencing resource files at compile-time.  HOWEVER, I could 
>swear that I've heard discussion in the recent past about plans for 
>future versions of GCJ to offer much greater ease-of-use.  That is, when 
>you compile a native executable from a JAR file containing properties 
>files and other resources... those resources will be automatically 
>pulled into the executable, and can then be accessed via 
>"getResourceAsStream()" etc transparently without extra work.

>(1) Is this already available with GCJ, and I'm simply unaware of 
>certain steps needed to make use of it?  If it matters, I'm primarily 
>using the MinGW port of GCJ on Win32... which tends to lag a version or 
>two behind other platforms (I'm currently using 3.3.1).

>(3) Am I completely dreaming all of this?  If so, wouldn't that be a 
>very cool feature request?  :)

You're completely dreaming this. We all have no idea what you're talking about.

No, seriously. If you get my latest build, go to thisiscool-gcc/examples/ResJarTest.
It has exactly what you want. There's a little bit of noise in the Makefile, but
check out this line:

$(GCC_PREFIX)gcj -o test1j.exe --main=com.thisiscool.gcj.tests.resjar.test1.Test1 test1.jar

-- Mohan

More information about the Java mailing list