On Fri, 1 Nov 2024 16:09:20 GMT, Magnus Ihse Bursie <i...@openjdk.org> wrote:

> I finally noticed that you are testing a precompiled HelloWorld class, and I 
> have been running with a source file argument to have java compile it on the 
> fly.
> 
> When I try using a pre-compiled HelloWorld, the linux port works for me too.
> 
> @jianglizhou Can you please verify if you can run this with a .java file 
> directly? To be clear: this works fine on my mac with this PR, and (as I 
> said), I'm pretty certain it used to work at least at some point during 
> development on this PR.
> 
> ```
> ihse@sthihse:/localhome/git/jdk-ALT$ cat > HelloWorld.java
> public class HelloWorld {
>   public static void main(String[] args) {
>     System.out.println("Hello, world!");
>   }
> }
> ihse@sthihse:/localhome/git/jdk-ALT$ javac HelloWorld.java 
> ihse@sthihse:/localhome/git/jdk-ALT$ 
> ./build/linux-x64/images/static-jdk/bin/java HelloWorld 
> Hello, world!
> ihse@sthihse:/localhome/git/jdk-ALT$ 
> ./build/linux-x64/images/static-jdk/bin/java HelloWorld.java
> Error: Unable to load main class com.sun.tools.javac.launcher.SourceLauncher 
> in module jdk.compiler
> Caused by: java.lang.UnsatisfiedLinkError: no jimage in system library path: 
> /localhome/git/jdk-ALT/build/linux-x64/images/static-jdk/bin
> Runtime.exit(1) logging failed: Could not initialize class 
> jdk.internal.module.SystemModuleFinders$SystemImage
> ihse@sthihse:/localhome/git/jdk-ALT$ 
> ```

I can reproduce the issue with running a `.java` directly using 
static-jdk/bin/java built from your branch. The issue does not exist with the 
`bin/javastatic` built from 
https://github.com/openjdk/leyden/tree/hermetic-java-runtime (I just tested). I 
have a hunch of where is problem might be. I'll do some debugging. 


$ bin/java /usr/local/google/home/jianglizhou/tests/HelloWorld.java
Error: Unable to load main class com.sun.tools.javac.launcher.SourceLauncher in 
module jdk.compiler
Caused by: java.lang.UnsatisfiedLinkError: no jimage in system library path: 
/usr/local/google/home/jianglizhou/github/jdk_pull_20837/build/linux-x86_64-server-slowdebug/images/static-jdk/bin
Runtime.exit(1) logging failed: Could not initialize class 
jdk.internal.module.SystemModuleFinders$SystemImage

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20837#issuecomment-2452668656

Reply via email to