[graalvm-users] [External] : java.lang.Thread.sleep() supported in GraalVM?

Gilles DUBOSCQ gilles.m.duboscq at oracle.com
Mon Oct 16 16:48:29 UTC 2023


Hi Eric,
Yes Thread.sleep() should work in GraalVM native-image.
It would help to know what kind of error you're seeing exactly.
 Gilles
________________________________
From: Eric Samson via GraalVM-Users <graalvm-users at oss.oracle.com>
Sent: Monday, 16 October 2023 18:38
To: graalvm-users at oss.oracle.com <graalvm-users at oss.oracle.com>
Subject: [External] : [graalvm-users] java.lang.Thread.sleep() supported in GraalVM?

Hi everyone,

I'm totally new to GraalVM.
I've set up the whole environment for Windows this morning.

I'm now trying to natively compile a Groovy app (with neither dynamic nor meta programming).
I've been able to compile it and use the native-image-agent to generate the /conf files.

Now I'm trying to generate the executable and I get an error message due to the fact I'm using Thread.sleep(x) in my main loop.

Sleep is a static method of the Thread class. I understand there must be some kind of conflicts between the class being initialized at build-time or runtime. But I'm not sure how to fix it. I've spent a lot of time in the GraalVM documentation and several Web sites (stackOverflow, etc.) but could not find a good example of how to use Thread.sleep in GraalVM.

Sorry for the noob question. Any hint would be greatly appreciated. Thanks in advance.
Best regards, Erix.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://oss.oracle.com/pipermail/graalvm-users/attachments/20231016/17928d4f/attachment-0001.html>


More information about the GraalVM-Users mailing list