ikvm icon indicating copy to clipboard operation
ikvm copied to clipboard

ikvm command: ClassLoader on the current thread does not find classes in the main assembly.

Open NightOwl888 opened this issue 2 years ago • 30 comments

Command Output / Stack Trace

Click to expand!
---------------------------------------------------
constituent[0]: file:/F:/mvn-sample/apache-maven-3.8.5/conf/logging/
constituent[1]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/commons-cli-1.4.jar
constituent[2]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/commons-io-2.6.jar
constituent[3]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/commons-lang3-3.8.1.jar
constituent[4]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/guava-25.1-android.jar
constituent[5]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/guice-4.2.2-no_aop.jar
constituent[6]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/jansi-2.4.0.jar
constituent[7]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/javax.annotation-api-1.2.jar
constituent[8]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/javax.inject-1.jar
constituent[9]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/jcl-over-slf4j-1.7.32.jar
constituent[10]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-artifact-3.8.5.jar
constituent[11]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-builder-support-3.8.5.jar
constituent[12]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-compat-3.8.5.jar
constituent[13]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-core-3.8.5.jar
constituent[14]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-embedder-3.8.5.jar
constituent[15]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-model-3.8.5.jar
constituent[16]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-model-builder-3.8.5.jar
constituent[17]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-plugin-api-3.8.5.jar
constituent[18]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-repository-metadata-3.8.5.jar
constituent[19]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-resolver-api-1.6.3.jar
constituent[20]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-resolver-connector-basic-1.6.3.jar
constituent[21]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-resolver-impl-1.6.3.jar
constituent[22]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-resolver-provider-3.8.5.jar
constituent[23]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-resolver-spi-1.6.3.jar
constituent[24]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-resolver-transport-wagon-1.6.3.jar
constituent[25]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-resolver-util-1.6.3.jar
constituent[26]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-settings-3.8.5.jar
constituent[27]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-settings-builder-3.8.5.jar
constituent[28]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-shared-utils-3.3.4.jar
constituent[29]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/maven-slf4j-provider-3.8.5.jar
constituent[30]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/org.eclipse.sisu.inject-0.3.5.jar
constituent[31]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/org.eclipse.sisu.plexus-0.3.5.jar
constituent[32]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/plexus-cipher-2.0.jar
constituent[33]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/plexus-component-annotations-2.1.0.jar
constituent[34]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/plexus-interpolation-1.26.jar
constituent[35]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/plexus-sec-dispatcher-2.0.jar
constituent[36]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/plexus-utils-3.3.0.jar
constituent[37]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/slf4j-api-1.7.32.jar
constituent[38]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/wagon-file-3.5.1.jar
constituent[39]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/wagon-http-3.5.1-shaded.jar
constituent[40]: file:/F:/mvn-sample/apache-maven-3.8.5/lib/wagon-provider-api-3.5.1.jar
---------------------------------------------------
java.lang.NullPointerException
Exception in thread "main" java.lang.NullPointerException
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Reflection.Emit.MethodBuilder.GetParameters()
   at IKVM.Internal.DynamicTypeWrapper.GetMethodBaseToken(MethodBase mb) in D:\a\ikvm\ikvm\IKVM.Runtime\DynamicTypeWrapper.cs:line 6927
   at IKVM.Internal.DynamicTypeWrapper.GetSourceLineNumber(MethodBase mb, Int32 ilOffset) in D:\a\ikvm\ikvm\IKVM.Runtime\DynamicTypeWrapper.cs:line 6942
   at IKVM.Internal.ExceptionHelper.GetLineNumber(StackFrame frame) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 369
   at IKVM.Internal.ExceptionHelper.ExceptionInfoHelper.Append(List`1 stackTrace, StackTrace st, Int32 skip, Boolean isLast) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 217
   at IKVM.Internal.ExceptionHelper.ExceptionInfoHelper.get_StackTrace(Exception t) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 124
   at IKVM.Internal.ExceptionHelper.getOurStackTrace(Exception x) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 693
   at java.lang.ThrowableHelper.getOurStackTrace(Exception _this)
   at java.lang.ThrowableHelper.printStackTrace(Exception _this, PrintStreamOrWriter s)
   at java.lang.ThrowableHelper.printStackTrace(Exception _this, PrintStream s)
   at java.lang.Throwable.printStackTrace(PrintStream s)
   at java.lang.Throwable.instancehelper_printStackTrace(Exception this, PrintStream s)
   at java.lang.ThreadGroup.uncaughtException(Thread t, Exception e)
   at java.lang.ThreadGroup.uncaughtException(Thread t, Exception e)
   at Starter.Main(String[] args) in D:\a\ikvm\ikvm\ikvm\starter.cs:line 390

Steps to Reproduce

  1. Download apache-maven-3.8.5-bin.zip
  2. Download IKVM-8.2.0-prerelease.809-tools-netcoreapp3.1-win7-x64.zip
  3. Create a directory structure as follows
    maven-ikvm
        |
        ---- ikvm
        |      |
        |      ---- bin
        |
        ---- maven
    
  4. Unzip the contents of IKVM-8.2.0-prerelease.809-tools-netcoreapp3.1-win7-x64.zip and put it in the maven-ikvm/ikvm/bin directory, making sure all of the binaries go directly under bin and the refs and runtimes subfolders are nested within bin.
  5. Copy ikvm.exe and rename the copy java.exe.
  6. Unzip the contents of apache-maven-3.8.5-bin.zip and copy the bin, boot, conf, and lib directories and accompanying files to the maven-ikvm/maven directory.
  7. Create a file named pom.xml in the maven-ikvm directory and add the following contents:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
    
      <groupId>com.mycompany.app</groupId>
      <artifactId>my-app</artifactId>
      <version>1.0-SNAPSHOT</version>
    
      <dependencies>
        <dependency>
          <groupId>org.apache.opennlp</groupId>
          <artifactId>opennlp-tools</artifactId>
          <version>1.9.1</version>
        </dependency>
    
        <dependency>
          <groupId>org.apache.opennlp</groupId>
          <artifactId>opennlp-uima</artifactId>
          <version>1.9.1</version>
        </dependency>
    
        <dependency>
          <groupId>org.apache.opennlp</groupId>
          <artifactId>opennlp-morfologik-addon</artifactId>
          <version>1.9.1</version>
        </dependency>
    
        <dependency>
          <groupId>org.apache.opennlp</groupId>
          <artifactId>opennlp-brat-annotator</artifactId>
          <version>1.9.1</version>
        </dependency>
    
      </dependencies>
    </project>
    
  8. Open a console window and switch to the maven-ikvm directory, then run the following command:
    set "JAVA_HOME=./ikvm" && "./maven/bin/mvn" org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies -DoutputDirectory=./lib -DincludeScope=compile -DargLine="-Xms512m" -DargLine="-Xmx1024m"
    

Note that if a new console window is opened to clear the JAVA_HOME environment variable and that part is removed, the command downloads and copies the 37 .jar dependencies to the lib directory.

"./maven/bin/mvn" org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies -DoutputDirectory=./lib -DincludeScope=compile -DargLine="-Xms512m" -DargLine="-Xmx1024m"
Click to expand!
F:\maven-ikvm>"./maven/bin/mvn" org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies -DoutputDirectory=./lib -DincludeScope=compile -DargLine="-Xms512m" -DargLine="-Xmx1024m"
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.mycompany.app:my-app >----------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:3.3.0:copy-dependencies (default-cli) @ my-app ---
[INFO] Copying opennlp-tools-1.9.1.jar to F:\maven-ikvm\lib\opennlp-tools-1.9.1.jar
[INFO] Copying opennlp-uima-1.9.1.jar to F:\maven-ikvm\lib\opennlp-uima-1.9.1.jar
[INFO] Copying opennlp-morfologik-addon-1.9.1.jar to F:\maven-ikvm\lib\opennlp-morfologik-addon-1.9.1.jar
[INFO] Copying morfologik-stemming-2.1.3.jar to F:\maven-ikvm\lib\morfologik-stemming-2.1.3.jar
[INFO] Copying morfologik-fsa-2.1.3.jar to F:\maven-ikvm\lib\morfologik-fsa-2.1.3.jar
[INFO] Copying morfologik-tools-2.1.3.jar to F:\maven-ikvm\lib\morfologik-tools-2.1.3.jar
[INFO] Copying morfologik-fsa-builders-2.1.3.jar to F:\maven-ikvm\lib\morfologik-fsa-builders-2.1.3.jar
[INFO] Copying hppc-0.7.1.jar to F:\maven-ikvm\lib\hppc-0.7.1.jar
[INFO] Copying jcommander-1.48.jar to F:\maven-ikvm\lib\jcommander-1.48.jar
[INFO] Copying opennlp-brat-annotator-1.9.1.jar to F:\maven-ikvm\lib\opennlp-brat-annotator-1.9.1.jar
[INFO] Copying jersey-container-grizzly2-http-2.25.jar to F:\maven-ikvm\lib\jersey-container-grizzly2-http-2.25.jar
[INFO] Copying javax.inject-2.5.0-b30.jar to F:\maven-ikvm\lib\javax.inject-2.5.0-b30.jar
[INFO] Copying grizzly-http-server-2.3.28.jar to F:\maven-ikvm\lib\grizzly-http-server-2.3.28.jar
[INFO] Copying grizzly-http-2.3.28.jar to F:\maven-ikvm\lib\grizzly-http-2.3.28.jar
[INFO] Copying grizzly-framework-2.3.28.jar to F:\maven-ikvm\lib\grizzly-framework-2.3.28.jar
[INFO] Copying jersey-common-2.25.jar to F:\maven-ikvm\lib\jersey-common-2.25.jar
[INFO] Copying javax.annotation-api-1.2.jar to F:\maven-ikvm\lib\javax.annotation-api-1.2.jar
[INFO] Copying jersey-guava-2.25.jar to F:\maven-ikvm\lib\jersey-guava-2.25.jar
[INFO] Copying hk2-api-2.5.0-b30.jar to F:\maven-ikvm\lib\hk2-api-2.5.0-b30.jar
[INFO] Copying hk2-utils-2.5.0-b30.jar to F:\maven-ikvm\lib\hk2-utils-2.5.0-b30.jar
[INFO] Copying aopalliance-repackaged-2.5.0-b30.jar to F:\maven-ikvm\lib\aopalliance-repackaged-2.5.0-b30.jar
[INFO] Copying hk2-locator-2.5.0-b30.jar to F:\maven-ikvm\lib\hk2-locator-2.5.0-b30.jar
[INFO] Copying javassist-3.20.0-GA.jar to F:\maven-ikvm\lib\javassist-3.20.0-GA.jar
[INFO] Copying osgi-resource-locator-1.0.1.jar to F:\maven-ikvm\lib\osgi-resource-locator-1.0.1.jar
[INFO] Copying jersey-server-2.25.jar to F:\maven-ikvm\lib\jersey-server-2.25.jar
[INFO] Copying jersey-client-2.25.jar to F:\maven-ikvm\lib\jersey-client-2.25.jar
[INFO] Copying jersey-media-jaxb-2.25.jar to F:\maven-ikvm\lib\jersey-media-jaxb-2.25.jar
[INFO] Copying validation-api-1.1.0.Final.jar to F:\maven-ikvm\lib\validation-api-1.1.0.Final.jar
[INFO] Copying javax.ws.rs-api-2.0.1.jar to F:\maven-ikvm\lib\javax.ws.rs-api-2.0.1.jar
[INFO] Copying jersey-media-json-jackson-2.25.jar to F:\maven-ikvm\lib\jersey-media-json-jackson-2.25.jar
[INFO] Copying jersey-entity-filtering-2.25.jar to F:\maven-ikvm\lib\jersey-entity-filtering-2.25.jar
[INFO] Copying jackson-jaxrs-base-2.8.4.jar to F:\maven-ikvm\lib\jackson-jaxrs-base-2.8.4.jar
[INFO] Copying jackson-core-2.8.4.jar to F:\maven-ikvm\lib\jackson-core-2.8.4.jar
[INFO] Copying jackson-databind-2.8.4.jar to F:\maven-ikvm\lib\jackson-databind-2.8.4.jar
[INFO] Copying jackson-jaxrs-json-provider-2.8.4.jar to F:\maven-ikvm\lib\jackson-jaxrs-json-provider-2.8.4.jar
[INFO] Copying jackson-module-jaxb-annotations-2.8.4.jar to F:\maven-ikvm\lib\jackson-module-jaxb-annotations-2.8.4.jar
[INFO] Copying jackson-annotations-2.8.4.jar to F:\maven-ikvm\lib\jackson-annotations-2.8.4.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.371 s
[INFO] Finished at: 2022-06-10T19:24:59+07:00
[INFO] ------------------------------------------------------------------------

NightOwl888 avatar Jun 10 '22 12:06 NightOwl888

Can you try it without renaming stuff? Just invoke the appropriate entry point using ikvm.

wasabii avatar Jun 10 '22 17:06 wasabii

Also, is this version of Maven compatible with JDK8?

[EDIT] Web site says it supports JDK7. So that's not it.

wasabii avatar Jun 10 '22 17:06 wasabii

Can you try it without renaming stuff? Just invoke the appropriate entry point using ikvm.

The mvn.cmd file is a bit complex and is hard-wired to use %JAVA_HOME%/bin/java.exe. I don't think there is a way to override, but the batch script could be changed instead. Ideally, we run maven without changing the distribution, though. And there are 2 separate files that would need to be edited to make it xplat.

Also, the legacy docs state that renaming ikvm.exe to java.exe was a "feature". So, it is probably worth a go to see if it will work.

NightOwl888 avatar Jun 10 '22 17:06 NightOwl888

I mean, whatever the output is, just grab that and replace java.exe with ikvm.

wasabii avatar Jun 10 '22 17:06 wasabii

I ask just to rule out the idea that the rename causes issues now, even though it worked in the past.

wasabii avatar Jun 10 '22 17:06 wasabii

So the interesting thing about this exception is that it's an exception trying to get the information for an exception. Which means, a) something in the exception translation stuff is broken, but also b) that there is some OTHER exception that is hidden by the attempt to get the stack trace.

wasabii avatar Jun 10 '22 17:06 wasabii

Changed the mvn.cmd file, but get the same result.

F:\maven-ikvm>"./maven/bin/mvn" org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies -DoutputDirectory=./lib -DincludeScope=compile -DargLine="-Xms512m" -DargLine="-Xmx1024m"
---------------------------------------------------
constituent[0]: file:/F:/maven-ikvm/maven/conf/logging/
constituent[1]: file:/F:/maven-ikvm/maven/lib/commons-cli-1.4.jar
constituent[2]: file:/F:/maven-ikvm/maven/lib/commons-io-2.6.jar
constituent[3]: file:/F:/maven-ikvm/maven/lib/commons-lang3-3.8.1.jar
constituent[4]: file:/F:/maven-ikvm/maven/lib/guava-25.1-android.jar
constituent[5]: file:/F:/maven-ikvm/maven/lib/guice-4.2.2-no_aop.jar
constituent[6]: file:/F:/maven-ikvm/maven/lib/jansi-2.4.0.jar
constituent[7]: file:/F:/maven-ikvm/maven/lib/javax.annotation-api-1.2.jar
constituent[8]: file:/F:/maven-ikvm/maven/lib/javax.inject-1.jar
constituent[9]: file:/F:/maven-ikvm/maven/lib/jcl-over-slf4j-1.7.32.jar
constituent[10]: file:/F:/maven-ikvm/maven/lib/maven-artifact-3.8.5.jar
constituent[11]: file:/F:/maven-ikvm/maven/lib/maven-builder-support-3.8.5.jar
constituent[12]: file:/F:/maven-ikvm/maven/lib/maven-compat-3.8.5.jar
constituent[13]: file:/F:/maven-ikvm/maven/lib/maven-core-3.8.5.jar
constituent[14]: file:/F:/maven-ikvm/maven/lib/maven-embedder-3.8.5.jar
constituent[15]: file:/F:/maven-ikvm/maven/lib/maven-model-3.8.5.jar
constituent[16]: file:/F:/maven-ikvm/maven/lib/maven-model-builder-3.8.5.jar
constituent[17]: file:/F:/maven-ikvm/maven/lib/maven-plugin-api-3.8.5.jar
constituent[18]: file:/F:/maven-ikvm/maven/lib/maven-repository-metadata-3.8.5.jar
constituent[19]: file:/F:/maven-ikvm/maven/lib/maven-resolver-api-1.6.3.jar
constituent[20]: file:/F:/maven-ikvm/maven/lib/maven-resolver-connector-basic-1.6.3.jar
constituent[21]: file:/F:/maven-ikvm/maven/lib/maven-resolver-impl-1.6.3.jar
constituent[22]: file:/F:/maven-ikvm/maven/lib/maven-resolver-provider-3.8.5.jar
constituent[23]: file:/F:/maven-ikvm/maven/lib/maven-resolver-spi-1.6.3.jar
constituent[24]: file:/F:/maven-ikvm/maven/lib/maven-resolver-transport-wagon-1.6.3.jar
constituent[25]: file:/F:/maven-ikvm/maven/lib/maven-resolver-util-1.6.3.jar
constituent[26]: file:/F:/maven-ikvm/maven/lib/maven-settings-3.8.5.jar
constituent[27]: file:/F:/maven-ikvm/maven/lib/maven-settings-builder-3.8.5.jar
constituent[28]: file:/F:/maven-ikvm/maven/lib/maven-shared-utils-3.3.4.jar
constituent[29]: file:/F:/maven-ikvm/maven/lib/maven-slf4j-provider-3.8.5.jar
constituent[30]: file:/F:/maven-ikvm/maven/lib/org.eclipse.sisu.inject-0.3.5.jar
constituent[31]: file:/F:/maven-ikvm/maven/lib/org.eclipse.sisu.plexus-0.3.5.jar
constituent[32]: file:/F:/maven-ikvm/maven/lib/plexus-cipher-2.0.jar
constituent[33]: file:/F:/maven-ikvm/maven/lib/plexus-component-annotations-2.1.0.jar
constituent[34]: file:/F:/maven-ikvm/maven/lib/plexus-interpolation-1.26.jar
constituent[35]: file:/F:/maven-ikvm/maven/lib/plexus-sec-dispatcher-2.0.jar
constituent[36]: file:/F:/maven-ikvm/maven/lib/plexus-utils-3.3.0.jar
constituent[37]: file:/F:/maven-ikvm/maven/lib/slf4j-api-1.7.32.jar
constituent[38]: file:/F:/maven-ikvm/maven/lib/wagon-file-3.5.1.jar
constituent[39]: file:/F:/maven-ikvm/maven/lib/wagon-http-3.5.1-shaded.jar
constituent[40]: file:/F:/maven-ikvm/maven/lib/wagon-provider-api-3.5.1.jar
---------------------------------------------------
java.lang.NullPointerException
Exception in thread "main" java.lang.NullPointerException
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Reflection.Emit.MethodBuilder.GetParameters()
   at IKVM.Internal.DynamicTypeWrapper.GetMethodBaseToken(MethodBase mb) in D:\a\ikvm\ikvm\IKVM.Runtime\DynamicTypeWrapper.cs:line 6927
   at IKVM.Internal.DynamicTypeWrapper.GetSourceLineNumber(MethodBase mb, Int32 ilOffset) in D:\a\ikvm\ikvm\IKVM.Runtime\DynamicTypeWrapper.cs:line 6942
   at IKVM.Internal.ExceptionHelper.GetLineNumber(StackFrame frame) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 369
   at IKVM.Internal.ExceptionHelper.ExceptionInfoHelper.Append(List`1 stackTrace, StackTrace st, Int32 skip, Boolean isLast) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 217
   at IKVM.Internal.ExceptionHelper.ExceptionInfoHelper.get_StackTrace(Exception t) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 124
   at IKVM.Internal.ExceptionHelper.getOurStackTrace(Exception x) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 693
   at java.lang.ThrowableHelper.getOurStackTrace(Exception _this)
   at java.lang.ThrowableHelper.printStackTrace(Exception _this, PrintStreamOrWriter s)
   at java.lang.ThrowableHelper.printStackTrace(Exception _this, PrintStream s)
   at java.lang.Throwable.printStackTrace(PrintStream s)
   at java.lang.Throwable.instancehelper_printStackTrace(Exception this, PrintStream s)
   at java.lang.ThreadGroup.uncaughtException(Thread t, Exception e)
   at java.lang.ThreadGroup.uncaughtException(Thread t, Exception e)
   at Starter.Main(String[] args) in D:\a\ikvm\ikvm\ikvm\starter.cs:line 390

NightOwl888 avatar Jun 10 '22 17:06 NightOwl888

Git rid of -DargLine="-Xms512m" -DargLine="-Xmx1024m"

wasabii avatar Jun 10 '22 17:06 wasabii

And also, have it echo out the full command line that is executed, and paste it here.

wasabii avatar Jun 10 '22 17:06 wasabii

Git rid of -DargLine="-Xms512m" -DargLine="-Xmx1024m"

Makes no difference.

NightOwl888 avatar Jun 10 '22 17:06 NightOwl888

And also, have it echo out the full command line that is executed, and paste it here.

F:\maven-ikvm>"./maven/bin/mvn" org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies -DoutputDirectory=.\lib -DincludeScope=compile
"F:\maven-ikvm\ikvm\bin\ikvm.exe"            -classpath "F:\maven-ikvm\maven\boot\plexus-classworlds-2.6.0.jar"   "-Dclassworlds.conf=F:\maven-ikvm\maven\bin\m2.conf"   "-Dmaven.home=F:\maven-ikvm\maven"   "-Dlibrary.jansi.path=F:\maven-ikvm\maven\lib\jansi-native"   "-Dmaven.multiModuleProjectDirectory=F:\maven-ikvm"   org.codehaus.plexus.classworlds.launcher.Launcher org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies -DoutputDirectory=.\lib -DincludeScope=compile
---------------------------------------------------
constituent[0]: file:/F:/maven-ikvm/maven/conf/logging/
constituent[1]: file:/F:/maven-ikvm/maven/lib/commons-cli-1.4.jar
constituent[2]: file:/F:/maven-ikvm/maven/lib/commons-io-2.6.jar
constituent[3]: file:/F:/maven-ikvm/maven/lib/commons-lang3-3.8.1.jar
constituent[4]: file:/F:/maven-ikvm/maven/lib/guava-25.1-android.jar
constituent[5]: file:/F:/maven-ikvm/maven/lib/guice-4.2.2-no_aop.jar
constituent[6]: file:/F:/maven-ikvm/maven/lib/jansi-2.4.0.jar
constituent[7]: file:/F:/maven-ikvm/maven/lib/javax.annotation-api-1.2.jar
constituent[8]: file:/F:/maven-ikvm/maven/lib/javax.inject-1.jar
constituent[9]: file:/F:/maven-ikvm/maven/lib/jcl-over-slf4j-1.7.32.jar
constituent[10]: file:/F:/maven-ikvm/maven/lib/maven-artifact-3.8.5.jar
constituent[11]: file:/F:/maven-ikvm/maven/lib/maven-builder-support-3.8.5.jar
constituent[12]: file:/F:/maven-ikvm/maven/lib/maven-compat-3.8.5.jar
constituent[13]: file:/F:/maven-ikvm/maven/lib/maven-core-3.8.5.jar
constituent[14]: file:/F:/maven-ikvm/maven/lib/maven-embedder-3.8.5.jar
constituent[15]: file:/F:/maven-ikvm/maven/lib/maven-model-3.8.5.jar
constituent[16]: file:/F:/maven-ikvm/maven/lib/maven-model-builder-3.8.5.jar
constituent[17]: file:/F:/maven-ikvm/maven/lib/maven-plugin-api-3.8.5.jar
constituent[18]: file:/F:/maven-ikvm/maven/lib/maven-repository-metadata-3.8.5.jar
constituent[19]: file:/F:/maven-ikvm/maven/lib/maven-resolver-api-1.6.3.jar
constituent[20]: file:/F:/maven-ikvm/maven/lib/maven-resolver-connector-basic-1.6.3.jar
constituent[21]: file:/F:/maven-ikvm/maven/lib/maven-resolver-impl-1.6.3.jar
constituent[22]: file:/F:/maven-ikvm/maven/lib/maven-resolver-provider-3.8.5.jar
constituent[23]: file:/F:/maven-ikvm/maven/lib/maven-resolver-spi-1.6.3.jar
constituent[24]: file:/F:/maven-ikvm/maven/lib/maven-resolver-transport-wagon-1.6.3.jar
constituent[25]: file:/F:/maven-ikvm/maven/lib/maven-resolver-util-1.6.3.jar
constituent[26]: file:/F:/maven-ikvm/maven/lib/maven-settings-3.8.5.jar
constituent[27]: file:/F:/maven-ikvm/maven/lib/maven-settings-builder-3.8.5.jar
constituent[28]: file:/F:/maven-ikvm/maven/lib/maven-shared-utils-3.3.4.jar
constituent[29]: file:/F:/maven-ikvm/maven/lib/maven-slf4j-provider-3.8.5.jar
constituent[30]: file:/F:/maven-ikvm/maven/lib/org.eclipse.sisu.inject-0.3.5.jar
constituent[31]: file:/F:/maven-ikvm/maven/lib/org.eclipse.sisu.plexus-0.3.5.jar
constituent[32]: file:/F:/maven-ikvm/maven/lib/plexus-cipher-2.0.jar
constituent[33]: file:/F:/maven-ikvm/maven/lib/plexus-component-annotations-2.1.0.jar
constituent[34]: file:/F:/maven-ikvm/maven/lib/plexus-interpolation-1.26.jar
constituent[35]: file:/F:/maven-ikvm/maven/lib/plexus-sec-dispatcher-2.0.jar
constituent[36]: file:/F:/maven-ikvm/maven/lib/plexus-utils-3.3.0.jar
constituent[37]: file:/F:/maven-ikvm/maven/lib/slf4j-api-1.7.32.jar
constituent[38]: file:/F:/maven-ikvm/maven/lib/wagon-file-3.5.1.jar
constituent[39]: file:/F:/maven-ikvm/maven/lib/wagon-http-3.5.1-shaded.jar
constituent[40]: file:/F:/maven-ikvm/maven/lib/wagon-provider-api-3.5.1.jar
---------------------------------------------------
java.lang.NullPointerException
Exception in thread "main" java.lang.NullPointerException
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Reflection.Emit.MethodBuilder.GetParameters()
   at IKVM.Internal.DynamicTypeWrapper.GetMethodBaseToken(MethodBase mb) in D:\a\ikvm\ikvm\IKVM.Runtime\DynamicTypeWrapper.cs:line 6927
   at IKVM.Internal.DynamicTypeWrapper.GetSourceLineNumber(MethodBase mb, Int32 ilOffset) in D:\a\ikvm\ikvm\IKVM.Runtime\DynamicTypeWrapper.cs:line 6942
   at IKVM.Internal.ExceptionHelper.GetLineNumber(StackFrame frame) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 369
   at IKVM.Internal.ExceptionHelper.ExceptionInfoHelper.Append(List`1 stackTrace, StackTrace st, Int32 skip, Boolean isLast) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 217
   at IKVM.Internal.ExceptionHelper.ExceptionInfoHelper.get_StackTrace(Exception t) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 124
   at IKVM.Internal.ExceptionHelper.getOurStackTrace(Exception x) in D:\a\ikvm\ikvm\IKVM.Runtime\ExceptionHelper.cs:line 693
   at java.lang.ThrowableHelper.getOurStackTrace(Exception _this)
   at java.lang.ThrowableHelper.printStackTrace(Exception _this, PrintStreamOrWriter s)
   at java.lang.ThrowableHelper.printStackTrace(Exception _this, PrintStream s)
   at java.lang.Throwable.printStackTrace(PrintStream s)
   at java.lang.Throwable.instancehelper_printStackTrace(Exception this, PrintStream s)
   at java.lang.ThreadGroup.uncaughtException(Thread t, Exception e)
   at java.lang.ThreadGroup.uncaughtException(Thread t, Exception e)
   at Starter.Main(String[] args) in D:\a\ikvm\ikvm\ikvm\starter.cs:line 390

F:\maven-ikvm>

NightOwl888 avatar Jun 10 '22 17:06 NightOwl888

-classpath "F:\maven-ikvm\maven\boot\plexus-classworlds-2.6.0.jar" "-Dclassworlds.conf=F:\maven-ikvm\maven\bin\m2.conf" "-Dmaven.home=F:\maven-ikvm\maven" "-Dlibrary.jansi.path=F:\maven-ikvm\maven\lib\jansi-native" "-Dmaven.multiModuleProjectDirectory=F:\maven-ikvm" org.codehaus.plexus.classworlds.launcher.Launcher org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies -DoutputDirectory=.\lib -DincludeScope=compile

So that's all the important stuff.

Next step would be to fire this up in the debugger to see where its going wrong. If you want to keep working on it, throw together a very simple test case. There's only one Jar on that classpath, and everything else seems to be loaded at runtime.... so, pretty much just new URLClassLoader("F:\maven-ikvm\maven\boot\plexus-classworlds-2.6.0.jar").getClass("org.codehaus.plexus.classworlds.launcher.Launcher"). Then you can use reflection to invoke main() in that.

And you can use System.setProperty() to set the properties before calling it.

wasabii avatar Jun 10 '22 17:06 wasabii

-Dlibrary.jansi.path=F:\maven-ikvm\maven\lib\jansi-native"

Worries me the most. Native library.

wasabii avatar Jun 10 '22 17:06 wasabii

Should note there are actually two independent sets of -D arguments happening there. The arguments before the Launcher class are system properties. The arguments after the launcher class are arguments passed to main().

wasabii avatar Jun 10 '22 18:06 wasabii

Next step would be to fire this up in the debugger to see where its going wrong. If you want to keep working on it, throw together a very simple test case. There's only one Jar on that classpath, and everything else seems to be loaded at runtime.... so, pretty much just new URLClassLoader("F:\maven-ikvm\maven\boot\plexus-classworlds-2.6.0.jar").getClass("org.codehaus.plexus.classworlds.launcher.Launcher"). Then you can use reflection to invoke main() in that.

And you can use System.setProperty() to set the properties before calling it.

image

There doesn't seem to be an overload of getClass() that accepts a string.

NightOwl888 avatar Jun 10 '22 18:06 NightOwl888

findClass then.

https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html#findClass-java.lang.String-

wasabii avatar Jun 10 '22 18:06 wasabii

Nope, it is protected.

NightOwl888 avatar Jun 10 '22 18:06 NightOwl888

Here we go

var cl = new URLClassLoader(new URL[] { new File(@"F:\maven-ikvm\maven\boot\plexus-classworlds-2.6.0.jar").toURI().toURL() }, ClassLoader.getSystemClassLoader());
var classToLoad = Class.forName("org.codehaus.plexus.classworlds.launcher.Launcher", true, cl);

NightOwl888 avatar Jun 10 '22 18:06 NightOwl888

I do not know Java well apparently:

https://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html#loadClass(java.lang.String)

wasabii avatar Jun 10 '22 18:06 wasabii

Not sure whether to use .NET reflection or Java reflection, but either way, I am stuck on trying to convert java.lang.String[] to a Type/Class. Any ideas?

https://stackoverflow.com/a/4980149

NightOwl888 avatar Jun 10 '22 19:06 NightOwl888

new string[]? Not sure I understand.

wasabii avatar Jun 10 '22 19:06 wasabii

Oh are you asking about looking up the main method? typeof(string[])

wasabii avatar Jun 10 '22 19:06 wasabii

No, getting the Java Class of an array type of java.lang.String. This looks like it is working:

var cl = new URLClassLoader(new URL[] { new File(@"F:\maven-ikvm\maven\boot\plexus-classworlds-2.6.0.jar").toURI().toURL() }, ClassLoader.getSystemClassLoader());
var classToLoad = Class.forName("org.codehaus.plexus.classworlds.launcher.Launcher", true, cl);
var stringClass = Class.forName("java.lang.String", true, cl);
var stringArrayClass = Class.forName("[L" + stringClass.getCanonicalName() + ";", true, cl);
var mainMethod = classToLoad.getMethod("main", new java.lang.Class[] { stringArrayClass });

NightOwl888 avatar Jun 10 '22 19:06 NightOwl888

typeof(string[])

For real.

wasabii avatar Jun 10 '22 19:06 wasabii

Won't convert to a java.lang.Class, though.

NightOwl888 avatar Jun 10 '22 19:06 NightOwl888

There should be an implicit operator.

wasabii avatar Jun 10 '22 19:06 wasabii

There should be an implicit operator.

How? Arrays are built in language feature and there is no way to add an implicit operator to them.

The type it is expecting is java.lang.String[]. But that is not a valid C# statement because apparently the java.lang.String class is declared as static.

When I use .NET Reflection and pass typeof(string[]) for the argument type of classToLoad.GetType().GetMethod() it returns null. When I try classToLoad.getMethod("main", new java.lang.Class[] { typeof(string[]) }), it won't compile.

I was able to get the type, but since the main() method expects java.lang.String[], I get a InvocationTargetException when I pass an array of string[].

java.lang.reflect.InvocationTargetException
  HResult=0x80131500
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

StackTrace (System.Exception)	"   at Java_sun_reflect_ReflectionFactory.FastMethodAccessorImpl.invoke(Object obj, Object[] args, CallerID callerID)\r\n   at java.lang.reflect.Method.invoke(Object obj, Object[] args, CallerID )\r\n   at java.lang.reflect.Method.invoke(Object obj, Object[] args)\r\n   at ConsoleApp69.Program.Main(String[] args) in F:\\Users\\shad\\source\\repos\\ConsoleApp69\\ConsoleApp69\\Program.cs:line 32"	string

When I try to use java.lang.String[], it won't compile because once again, it is declared static.

image

NightOwl888 avatar Jun 10 '22 20:06 NightOwl888

I'm thinking this bug needs to be retitled in some way. Does a bug still exist? Something to do with the classloader setup for the ikvm.exe command?

wasabii avatar Jun 29 '22 13:06 wasabii

Nope. This still doesn't work with the original procedure using 8.2.0-prerelease.2138.

Microsoft Windows [Version 10.0.19042.1526]
(c) Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>f:

F:\>cd maven-ikvm

F:\maven-ikvm>set "JAVA_HOME=./ikvm" && "./maven/bin/mvn" org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies -DoutputDirectory=./lib -DincludeScope=compile
---------------------------------------------------
constituent[0]: file:/F:/maven-ikvm/maven/conf/logging/
constituent[1]: file:/F:/maven-ikvm/maven/lib/commons-cli-1.4.jar
constituent[2]: file:/F:/maven-ikvm/maven/lib/commons-io-2.6.jar
constituent[3]: file:/F:/maven-ikvm/maven/lib/commons-lang3-3.8.1.jar
constituent[4]: file:/F:/maven-ikvm/maven/lib/guava-25.1-android.jar
constituent[5]: file:/F:/maven-ikvm/maven/lib/guice-4.2.2-no_aop.jar
constituent[6]: file:/F:/maven-ikvm/maven/lib/jansi-2.4.0.jar
constituent[7]: file:/F:/maven-ikvm/maven/lib/javax.annotation-api-1.2.jar
constituent[8]: file:/F:/maven-ikvm/maven/lib/javax.inject-1.jar
constituent[9]: file:/F:/maven-ikvm/maven/lib/jcl-over-slf4j-1.7.32.jar
constituent[10]: file:/F:/maven-ikvm/maven/lib/maven-artifact-3.8.5.jar
constituent[11]: file:/F:/maven-ikvm/maven/lib/maven-builder-support-3.8.5.jar
constituent[12]: file:/F:/maven-ikvm/maven/lib/maven-compat-3.8.5.jar
constituent[13]: file:/F:/maven-ikvm/maven/lib/maven-core-3.8.5.jar
constituent[14]: file:/F:/maven-ikvm/maven/lib/maven-embedder-3.8.5.jar
constituent[15]: file:/F:/maven-ikvm/maven/lib/maven-model-3.8.5.jar
constituent[16]: file:/F:/maven-ikvm/maven/lib/maven-model-builder-3.8.5.jar
constituent[17]: file:/F:/maven-ikvm/maven/lib/maven-plugin-api-3.8.5.jar
constituent[18]: file:/F:/maven-ikvm/maven/lib/maven-repository-metadata-3.8.5.jar
constituent[19]: file:/F:/maven-ikvm/maven/lib/maven-resolver-api-1.6.3.jar
constituent[20]: file:/F:/maven-ikvm/maven/lib/maven-resolver-connector-basic-1.6.3.jar
constituent[21]: file:/F:/maven-ikvm/maven/lib/maven-resolver-impl-1.6.3.jar
constituent[22]: file:/F:/maven-ikvm/maven/lib/maven-resolver-provider-3.8.5.jar
constituent[23]: file:/F:/maven-ikvm/maven/lib/maven-resolver-spi-1.6.3.jar
constituent[24]: file:/F:/maven-ikvm/maven/lib/maven-resolver-transport-wagon-1.6.3.jar
constituent[25]: file:/F:/maven-ikvm/maven/lib/maven-resolver-util-1.6.3.jar
constituent[26]: file:/F:/maven-ikvm/maven/lib/maven-settings-3.8.5.jar
constituent[27]: file:/F:/maven-ikvm/maven/lib/maven-settings-builder-3.8.5.jar
constituent[28]: file:/F:/maven-ikvm/maven/lib/maven-shared-utils-3.3.4.jar
constituent[29]: file:/F:/maven-ikvm/maven/lib/maven-slf4j-provider-3.8.5.jar
constituent[30]: file:/F:/maven-ikvm/maven/lib/org.eclipse.sisu.inject-0.3.5.jar
constituent[31]: file:/F:/maven-ikvm/maven/lib/org.eclipse.sisu.plexus-0.3.5.jar
constituent[32]: file:/F:/maven-ikvm/maven/lib/plexus-cipher-2.0.jar
constituent[33]: file:/F:/maven-ikvm/maven/lib/plexus-component-annotations-2.1.0.jar
constituent[34]: file:/F:/maven-ikvm/maven/lib/plexus-interpolation-1.26.jar
constituent[35]: file:/F:/maven-ikvm/maven/lib/plexus-sec-dispatcher-2.0.jar
constituent[36]: file:/F:/maven-ikvm/maven/lib/plexus-utils-3.3.0.jar
constituent[37]: file:/F:/maven-ikvm/maven/lib/slf4j-api-1.7.32.jar
constituent[38]: file:/F:/maven-ikvm/maven/lib/wagon-file-3.5.1.jar
constituent[39]: file:/F:/maven-ikvm/maven/lib/wagon-http-3.5.1-shaded.jar
constituent[40]: file:/F:/maven-ikvm/maven/lib/wagon-provider-api-3.5.1.jar
---------------------------------------------------
java.lang.NullPointerException
Exception in thread "main" java.lang.NullPointerException
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Reflection.Emit.MethodBuilder.GetParameters()
   at IKVM.Internal.DynamicTypeWrapper.GetMethodBaseToken(MethodBase mb) in D:\a\ikvm\ikvm\src\IKVM.Runtime\DynamicTypeWrapper.cs:line 6931
   at IKVM.Internal.DynamicTypeWrapper.GetSourceLineNumber(MethodBase mb, Int32 ilOffset) in D:\a\ikvm\ikvm\src\IKVM.Runtime\DynamicTypeWrapper.cs:line 6946
   at IKVM.Internal.ExceptionHelper.GetLineNumber(StackFrame frame) in D:\a\ikvm\ikvm\src\IKVM.Runtime\ExceptionHelper.cs:line 371
   at IKVM.Internal.ExceptionHelper.ExceptionInfoHelper.Append(List`1 stackTrace, StackTrace st, Int32 skip, Boolean isLast) in D:\a\ikvm\ikvm\src\IKVM.Runtime\ExceptionHelper.cs:line 219
   at IKVM.Internal.ExceptionHelper.ExceptionInfoHelper.get_StackTrace(Exception t) in D:\a\ikvm\ikvm\src\IKVM.Runtime\ExceptionHelper.cs:line 126
   at IKVM.Internal.ExceptionHelper.getOurStackTrace(Exception x) in D:\a\ikvm\ikvm\src\IKVM.Runtime\ExceptionHelper.cs:line 695
   at java.lang.ThrowableHelper.getOurStackTrace(Exception _this)
   at java.lang.ThrowableHelper.printStackTrace(Exception _this, PrintStreamOrWriter s)
   at java.lang.ThrowableHelper.printStackTrace(Exception _this, PrintStream s)
   at java.lang.Throwable.printStackTrace(PrintStream s)
   at java.lang.Throwable.instancehelper_printStackTrace(Exception this, PrintStream s)
   at java.lang.ThreadGroup.uncaughtException(Thread t, Exception e)
   at java.lang.ThreadGroup.uncaughtException(Thread t, Exception e)
   at Starter.Main(String[] args) in D:\a\ikvm\ikvm\src\ikvm\starter.cs:line 390

F:\maven-ikvm>

It's been awhile since I have looked at this, but the code that can be used to step through to work out what is happening is below. The error happens when it tries to invoke public static int org.apache.maven.cli.MavenCli.main(java.lang.String[],org.codehaus.plexus.classworlds.ClassWorld) using Reflection.

            var jars = new List<URL>();

            foreach (var file in System.IO.Directory.GetFiles(@"F:\maven-ikvm\maven", "*.jar", System.IO.SearchOption.AllDirectories))
            {
                jars.Add(new File(file).toURI().toURL());
            }

            var cl = new URLClassLoader(jars.ToArray(), java.lang.Thread.currentThread().getContextClassLoader() /*ClassLoader.getSystemClassLoader()*/);

            // This used to fix the problem entirely. I haven't checked whether that is because of the new release
            // or something with my config, but it isn't working anymore.
            //java.lang.Thread.currentThread().setContextClassLoader(cl);


            var classToLoad = Class.forName("org.codehaus.plexus.classworlds.launcher.Launcher", true, cl);

            // Java Reflection is broken when trying to invoke classToLoad, so we use .NET Reflection.
            var typeToLoad = Type.GetType("org.codehaus.plexus.classworlds.launcher.Launcher");

            java.lang.System.setProperty("classworlds.conf", @"F:\maven-ikvm\maven\bin\m2.conf");
            java.lang.System.setProperty("maven.home", @"F:\maven-ikvm\maven");
            java.lang.System.setProperty("library.jansi.path", @"F:\maven-ikvm\maven\lib\jansi-native");
            java.lang.System.setProperty("maven.multiModuleProjectDirectory", @"F:\maven-ikvm");

            var a = new string[] {
                    "org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy-dependencies",
                    @"-DoutputDirectory=.\lib",
                    "-DincludeScope=compile"
                };

            var method = typeToLoad.GetMethod("main", new Type[] { typeof(string[]) });

            method.Invoke(null, new object[] { a });

The error I am getting when running the above code is.

java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.ClassWorld
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:55)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        at org.codehaus.plexus.classworlds.launcher.Launcher.getEnhancedMainMethod(Launcher.java:166)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:261)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
        at cli.ConsoleApp69.Program.Main(Program.cs:50)

F:\Users\shad\source\repos\ConsoleApp69\ConsoleApp69\bin\Debug\net48\ConsoleApp69.exe (process 157112) exited with code 100.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .

Not sure whether it helps the original problem, but the default ikvm.exe class loader is not finding a type that is in the same package as the entry package, which it expects to find in the getContextClassLoader() of the current thread, but is not working in IKVM (at least not when loading the entry class using Reflection).

If the java.lang.Thread.currentThread().setContextClassLoader(cl); line is uncommented, it finds that class, but fails later when attempting to invoke public static int org.apache.maven.cli.MavenCli.main(java.lang.String[],org.codehaus.plexus.classworlds.ClassWorld).

NightOwl888 avatar Jun 30 '22 10:06 NightOwl888

@NightOwl888 Can you retitle this or close it to something that more accurately reflects what the underlying issue was?

I think it's that the classloaders are wrong on ikvm.exe.

wasabii avatar Jul 13 '22 05:07 wasabii