Re: How to include an external (binary) file into a java program at compile (!) time ???
From: Ankur Bulsara (hotmail_at_N0_SPAM_gmail.com)
Date: 10/01/04
- Previous message: Paul Lutus: "Re: How to include an external (binary) file into a java program at compile (!) time ???"
- In reply to: Tobias Merler: "How to include an external (binary) file into a java program at compile (!) time ???"
- Next in thread: Dave Glasser: "Re: How to include an external (binary) file into a java program at compile (!) time ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Sep 2004 17:07:11 -0700
One way to archieve resource bundling at compile time is to package the
resources in a jar. Then at runtime, you read in the resource using the
classloader.
Here is a file that gets a resource from the classloader:
http://www.koders.com/java/fid92BF1D1C6E5D4FF57B19FE8B65A49A98E0E77FF1.aspx?s=getresourceasstream
-Ankur
"Tobias Merler" <merlin@gmx.net> wrote in message
news:cji0gu$fpt$00$1@news.t-online.com...
> I have a java class and a second file which contains some binary data
(assume a zip archive or a gif picture).
>
> At the moment when I compile the class I would like to include this file
into a variable of this class.
> I think of a variable declaration like:
>
> byte[] mybinaryfile = <include dummy.zip>
>
> How can I implement this idea?
> Remember again: I don't want to load this file at runtime but this file
should be
> internal part of the one and only java class.
>
> Tobias
>
- Previous message: Paul Lutus: "Re: How to include an external (binary) file into a java program at compile (!) time ???"
- In reply to: Tobias Merler: "How to include an external (binary) file into a java program at compile (!) time ???"
- Next in thread: Dave Glasser: "Re: How to include an external (binary) file into a java program at compile (!) time ???"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|