# Error: Could not find or load main class ${argLine}

**URL:** <https://forum.metasfresh.org/t/error-could-not-find-or-load-main-class-argline/764>\
**Category:** Developers\
**Created:** [November 22, 2017, 10:10am UTC](https://forum.metasfresh.org/t/error-could-not-find-or-load-main-class-argline/764 "2017-11-22T10:10:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gp1864](https://forum.metasfresh.org/letter_avatar_proxy/v4/letter/g/ad7895/32.png) [@gp1864](https://forum.metasfresh.org/u/gp1864)\
**Post date:** [November 22, 2017, 10:10am UTC](https://forum.metasfresh.org/t/error-could-not-find-or-load-main-class-argline/764/1 "2017-11-22T10:10:34Z")

</div>

Hi,

I am trying to build a metasfresh distributable from command line following procedures described in [http://docs.metasfresh.org/developers\_collection/en/getting\_started\_mvn\_cmdline\_en.html](http://docs.metasfresh.org/developers_collection/en/getting_started_mvn_cmdline_en.html) document.  
While running build of metasfresh/de.metas.reactor I've got an error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project de.metas.migration.base: There are test failures.  
[ERROR]   
[ERROR] Please refer to /home/xxxxx/tools/metasfresh/repos/metasfresh/de.metas.migration/de.metas.migration.base/target/surefire-reports for the individual test results.  
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.  
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?  
[ERROR] Command was /bin/sh -c cd /home/xxxxx/tools/metasfresh/repos/metasfresh/de.metas.migration/de.metas.migration.base && /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java '${argLine}' -Xms256m -Xmx2048m -jar /home/xxxxx/tools/metasfresh/repos/metasfresh/de.metas.migration/de.metas.migration.base/target/surefire/surefirebooter2021524300946757877.jar /home/xxxxx/tools/metasfresh/repos/metasfresh/de.metas.migration/de.metas.migration.base/target/surefire 2017-11-21T11-14-54\_374-jvmRun1 surefire1595626035213636341tmp surefire\_04554626986173645225tmp  
[ERROR] Error occurred in starting fork, check output in log  
[ERROR] Process Exit Code: 1  
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?  
[ERROR] Command was /bin/sh -c cd /home/xxxxx/tools/metasfresh/repos/metasfresh/de.metas.migration/de.metas.migration.base && /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java '${argLine}' -Xms256m -Xmx2048m -jar /home/xxxxx/tools/metasfresh/repos/metasfresh/de.metas.migration/de.metas.migration.base/target/surefire/surefirebooter2021524300946757877.jar /home/xxxxx/tools/metasfresh/repos/metasfresh/de.metas.migration/de.metas.migration.base/target/surefire 2017-11-21T11-14-54\_374-jvmRun1 surefire1595626035213636341tmp surefire\_04554626986173645225tmp  
[ERROR] Error occurred in starting fork, check output in log  
[ERROR] Process Exit Code: 1  
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:679)  
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)  
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:279)

In a dumpstream file in /home/xxxxx/tools/metasfresh/repos/metasfresh/de.metas.migration/de.metas.migration.base/target/surefire-reports directory there is a further explanation of the above error:

Error: Could not find or load main class ${argLine}

I see there is mentioning of JaCoCo plug-in in metasfresh-parent/pom.xml file.

Should this plug-in be mentioned in mvn install command or some other solution applied?

Maven environment is as follows:

Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T02:58:13-05:00)  
Maven home: /home/xxxxx/.sdkman/candidates/maven/current  
Java version: 1.8.0\_151, vendor: Oracle Corporation  
Java home: /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre  
Default locale: en\_US, platform encoding: UTF-8  
OS name: "linux", version: "4.4.92-18.36-default", arch: "amd64", family: "unix"

Please, let me know if addition info is needed.

Thank you,  
George

---

<div class="post-metadata">

**Author:** ![gp1864](https://forum.metasfresh.org/letter_avatar_proxy/v4/letter/g/ad7895/32.png) [@gp1864](https://forum.metasfresh.org/u/gp1864)\
**Post date:** [November 23, 2017, 7:44am UTC](https://forum.metasfresh.org/t/error-could-not-find-or-load-main-class-argline/764/2 "2017-11-23T07:44:33Z")

</div>

Hi,

Adding -DargLine= to mvn install command helped to overcome the error and to build metasfresh/de.metas.reactor directory.

Building other directories also requires option -DargLine=:

metasfresh/de.metas.esb  
metasfresh-webui  
metasfresh-procurement-webui

Is it the right way to do so? Should argLine be set to something else?

Thank you,  
George

---

<div class="post-metadata">

**Author:** ![metas-ts](https://forum.metasfresh.org/user_avatar/forum.metasfresh.org/metas-ts/32/14_2.png) [@metas-ts](https://forum.metasfresh.org/u/metas-ts)\
**Post date:** [November 23, 2017, 10:30am UTC](https://forum.metasfresh.org/t/error-could-not-find-or-load-main-class-argline/764/3 "2017-11-23T10:30:15Z")

</div>

Hi @gp1864  
thank you very much for looking into the problem and finding the wokraround.

> Is it the right way to do so?

Currently your are actually the leading expert in this matter 🙂 (no irony!).  
If you have the time, I would be very happy if you could create an issue on github.

The problem might be due to a wrong configuration of the surefire plugin on the parent `pom.xml` that sits in [metasfresh-parent](https://github.com/metasfresh/metasfresh-parent).  
Strangely, the automated builds done by our [jenkins](https://jenkins.metasfresh.com) don’t suffer from the problem…just our local cmd lines…

Best regards,  
Tobias

---

<div class="post-metadata">

**Author:** ![gp1864](https://forum.metasfresh.org/letter_avatar_proxy/v4/letter/g/ad7895/32.png) [@gp1864](https://forum.metasfresh.org/u/gp1864)\
**Post date:** [November 24, 2017, 5:23pm UTC](https://forum.metasfresh.org/t/error-could-not-find-or-load-main-class-argline/764/4 "2017-11-24T17:23:39Z")

</div>

Issue #3073 has been created.

George

---

<div class="post-metadata">

**Author:** ![metas-ts](https://forum.metasfresh.org/user_avatar/forum.metasfresh.org/metas-ts/32/14_2.png) [@metas-ts](https://forum.metasfresh.org/u/metas-ts)\
**Post date:** [November 27, 2017, 7:59am UTC](https://forum.metasfresh.org/t/error-could-not-find-or-load-main-class-argline/764/5 "2017-11-27T07:59:47Z")

</div>

Thx. FYI, I hope i was able to solve it [here](https://github.com/metasfresh/metasfresh-parent/commit/bdbe20d51a6936ccc11581b6702fc21a6663ce0f)

---

<div class="post-metadata">

**Author:** ![geraldwarp](https://forum.metasfresh.org/letter_avatar_proxy/v4/letter/g/2bfe46/32.png) [@geraldwarp](https://forum.metasfresh.org/u/geraldwarp)\
**Post date:** [September 18, 2020, 8:29am UTC](https://forum.metasfresh.org/t/error-could-not-find-or-load-main-class-argline/764/6 "2020-09-18T08:29:44Z")

</div>

> [@gp1864](#):
>
> Error: Could not find or load main class

While executing, when JVM does not find a .class file with the specified name then a run time error occurs saying “Could not found or load main class”. The reason why this happens is mostly due to:

- Wrong Class Name
- Invalid Classpath

Main class could not be found when there is typo or wrong syntax in the fully qualified [java](http://net-informations.com/java/cjava/default.htm) class name or it does not exist in the provided classpath. You must ensure that you add the location of your .class file to your classpath. So, if its in the current folder, add . to your classpath. Note that the Windows classpath separator is a semi-colon ; . If you want to execute the main() method in MainClass, you must use the full class name, including package name, in the java command.
