Spring boot is not supported?
When starting Spring Boot with IKVM, it dies with the following exception based on the net472 version.
Exception in thread "Thread-0" java.lang.IllegalStateException: java.lang.NullPointerException
at org.springframework.boot.loader.ExecutableArchiveLauncher.
https://github.com/orgs/ikvmnet/discussions/463
The 'IKVM.Runtime.Launcher.Run (..' in the information of the provided link seems to be an error that occurs regardless of Spring Boot when running the compiled version with ikvmc.exe parameters set. (It seems to be an error that occurs because the version does not match based on the error content.)
The error content is slightly different due to the difference in the date of registration of the article in the provided link and the versions of IKVM. However, the error with 'IKVM.Runtime.Launcher.Run (..' seems to be an error that occurs regardless of Spring Boot.
- As of the current time, the syntax for setting the parameters based on net472 is 'ikvmc -target:exe -r:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll" -r:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.dll" -runtime:"D:\Java\ikvm-jre8-net472\bin\IKVM.Runtime.dll" -main:Main Test.jar'.
If you create a project with 'dotnet new' and add IKVM, add jar with ikvmReference, build, and run it instead of directly setting the parameters, you will get the same error as in the first question. It seems that Spring Boot's jar is not a pure jar, but the Spring Boot team configures the contents of the jar or war according to their own structure and reads it with an internal dedicated loader (jar in jar and classes under a separate folder, and classes with business logic are in them, and the only part that matches the pure jar is the Spring Boot loader), so IKVM did not make it work according to this structure, so it is pure when converting statically or dynamically. It seems that the exception occurs because only the loader part of Spring Boot remains while the ones that do not fit the structure are removed. Can I assume that IKVM does not support structures like Spring Boot?
When running the build using ikvmRefererence, an exception occurs as below.
Unhandled exception: java.lang.IllegalStateException: java.lang.NullPointerException ---> java.lang.NullPointerException --- End of inner exception stack trace --- Location: org.springframework.boot.loader.ExecutableArchiveLauncher..ctor() Location: org.springframework.boot.loader.JarLauncher..ctor() Location: org.springframework.boot.loader.JarLauncher.main(String[] args) Location: SpringBootTest.Main(String[] args) File C:\SpringTest3\Program.cs: line 5
- In the first question, it is executed as java -jar SpringBoot.jar as in general Java, and it is displayed as WarLauncher, but ikvmReference does not recognize war, so I built it in jar format and converted it to CIL. Since it is executed, it appears as JarLauncher instead of WarLauncher.
Additional test results show that if an exception containing 'IKVM.Runtime.Launcher.Run (..' occurs, it is because the [executable file name].config file is missing. (If you convert directly using ikvmc.exe, only the assembly file is created and the remaining files required for execution are not created.) It seems that the execution is stopped due to an exception caused by a version conflict of the 'System.Runtime.CompilerServices.Unsafe' assembly. When I took the config file from a working one, named it, and ran it, the pure jar conversion ran normally, but Spring Boot stopped with the following exception as I asked the first question.
Exception in thread "Thread-0" java.lang.IllegalStateException: java.lang.NullPointerException
at org.springframework.boot.loader.ExecutableArchiveLauncher.
https://github.com/orgs/ikvmnet/discussions/463
I thought the question in the post was asking how to solve the IKVM.Runtime.Launcher.Run error that appears when running Spring Boot, so I searched for various answers and hesitated to write an answer. I read it again now and it doesn't match my issue because it asks how to use the launcher (IKVM.Runtime.Launcher.Run) (I left the rough usage of the launcher and Spring Boot information I found as an additional answer to the question.)
What I registered as an issue was that when I ran it with the format java -jar SpringBoot.jar
Exception in thread "Thread-0" java.lang.IllegalStateException: java.lang.NullPointerException at org.springframework.boot.loader.ExecutableArchiveLauncher.(ExecutableArchiveLauncher.java:52) at org.springframework.boot.loader.JarLauncher.(JarLauncher.java:49) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) Caused by: java.lang.NullPointerException at org.springframework.boot.loader.jar.JarFile.getName(JarFile.java:399)
I registered it as a question to see if IKVM supports running SpringBoot because I got an error like this.
It should work, and whatever is causing it to not work should be fixed. So, in that sense, it's "supported". But I do not know what is actually wrong, and haven't had time to look at it.