[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-graal-dev
Subject:    Re: Reading from static resource file
From:       Marco Bungart <m.bungart () gmx ! net>
Date:       2019-02-14 20:44:34
Message-ID: 99dce289-6137-1eae-2177-857bef756417 () gmx ! net
[Download RAW message or body]

Hi Codrut,

I will do so on monday, thank you for your response :)

Cheers,
Marco

On 14.02.2019 20:54, Codrut Stancu wrote:
> Hi Marco,
> 
> Can you please file an issue at https://github.com/oracle/graal? I was
> not able to replicate it using the details in your email, so please
> include a reproducible example.
> 
> Thanks,
> 
> Codrut Stancu
> 
> 
> On 2/14/19 1:32 AM, Marco Bungart wrote:
>> Hello!
>>
>> Please excuse me if you got this eMail twice. I sent it yesterday via
>> graalvm-users@oss.oracle.com, but did not receive any answer soo... I
>> decided to send it out via graal-dev :)
>>
>>
>> I have a problem with resource files when building native images. I
>> would like to read the content of a resource file. The snippet of code
>> accessing the file is:
>>
>>          String PATH = "/wordCount/le_grand_cyrus.txt";
>>          try (
>>              BufferedInputStream is =
>>                      new
>> BufferedInputStream(getClass()
>>
>> .getClassLoader().getResourceAsStream(PATH));
>>              BufferedReader reader = new BufferedReader(new
>> InputStreamReader(is))) {
>>              System.out.println(is.available()); // Exception occurs here
>>              [...]
>>          }
>>
>> running the program on the JVM works just fine.
>>
>> When I, however, compile the jdk to an native image, the program
>> terminates with
>>
>>          Exception in thread "main" java.io.IOException: Stream closed
>>
>> I compiled the native image with -H:IncludeResources='...'
>> -H:Log=registerResources to verify that the files are included in the
>> native image.
>>
>> Am I doing something wrong or is this a known issues? Any help is much
>> appreciated :)
>>
>> Thanks in advance,
>> Marco Bungart
>>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic