Compile with Eclipse problems

662 views
Skip to first unread message

Marius Liebenberg

unread,
Dec 19, 2018, 5:32:23 AM12/19/18
to OpenPnP
Hi
I am trying to build a package from within Eclipse but are having some issues. The project runs when run as application from within the IDE but when I try to build a package I get this error :-

Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (validate) on project openpnp-gui: Execution validate of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check failed: Plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.17 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.8.0 at specified path /usr/lib/jvm/java-8-openjdk-amd64/jre/../lib/tools.jar -> [Help 1]

There is no such jar in the location.

Then I did a Maven update on the project and got this :-

Failed to access classpath of mojo org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check
Plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.17 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.8.0 at specified path /usr/lib/jvm/java-8-openjdk-amd64/jre/../lib/tools.jar

Any help please.

Marius Liebenberg

unread,
Dec 19, 2018, 5:36:46 AM12/19/18
to OpenPnP
Sorry the project used to run until I tried to build the package. It is now also broken with :-
Error: Could not find or load main class org.openpnp.Main

Jason von Nieda

unread,
Dec 19, 2018, 11:08:58 AM12/19/18
to ope...@googlegroups.com
Hi Marius,

It looks like the CheckStyle plugin that I use to check code style is not playing nicely with the OpenJDK version you have installed. The easiest thing is probably just to disable that plugin. Look in pom.xml and find the checkstyle block, and remove it or comment it out.

Jason


--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openpnp/dc336b9a-4f42-4552-a482-10ae17da1ee9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark

unread,
Dec 19, 2018, 5:14:54 PM12/19/18
to ope...@googlegroups.com

Hi

 

I vaguely remember I had the same/similar error. Not sure! I don’t really know maven etc. so I’m just guessing here.

 

Turned out it was my firewall acting up, preventing dependency updates. I remember the error messages were not helpful, not pointing to network problems.

 

So perhaps check and recheck your network/internet access. Might also be a repo being temporarily down.

 

_Mark

 

Marius Liebenberg

unread,
Dec 21, 2018, 2:41:58 AM12/21/18
to OpenPnP
Thanks Jason I will try that.
My version of java is openjdk version "1.8.0_181"
What is recommended?

Marius Liebenberg

unread,
Dec 21, 2018, 4:05:58 AM12/21/18
to OpenPnP
Ok I excluded the CheckStyle plugin and now the real errors are showing, I think

Scanning for projects...
[INFO]
[INFO] ----------------------< org.openpnp:openpnp-gui >-----------------------
[INFO] Building openpnp-gui 0.0.1-alpha-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.sun.xml.bind:jaxb-core:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- buildnumber-maven-plugin:1.3:create (default) @ openpnp-gui ---
[INFO] ShortRevision tag detected. The value is '7'.
[INFO] Executing: /bin/sh -c cd /home/pnp/openpnp-dev/openpnp && git rev-parse --verify --short=7 HEAD
[INFO] Working directory: /home/pnp/openpnp-dev/openpnp
[INFO] Storing buildNumber: adc3dfb at timestamp: 1545382976602
[INFO] Storing buildScmBranch: develop
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ openpnp-gui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 105 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ openpnp-gui ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ openpnp-gui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ openpnp-gui ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to /home/pnp/openpnp-dev/openpnp/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.151 s
[INFO] Finished at: 2018-12-21T11:02:57+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project openpnp-gui: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException


Javier Hdez.

unread,
Dec 21, 2018, 6:23:03 AM12/21/18
to OpenPnP
Hello Marius,

Try this.

Best regards

Javier Hdez.

unread,
Dec 21, 2018, 6:24:30 AM12/21/18
to OpenPnP
OpenPnP is developed with OpenJDK o with Oracle JDK?

Jason von Nieda

unread,
Dec 21, 2018, 10:24:56 AM12/21/18
to ope...@googlegroups.com
@Marius: As the error says, it seems that you are running in a JRE and not JDK, which is a little strange if running from Eclipse. Try what Javier mentioned and if that doesn't work I'd recommend uninstalling Eclipse and any versions of Java you have, then install the Oracle JDK, then Eclipse.

@Javier: I develop on Oracle JDK 11 and OpenPnP is tested on Oracle JDK 8, 9, 11, and OpenJDK 10.

Jason


On Fri, Dec 21, 2018 at 5:24 AM Javier Hdez. <hexagon....@gmail.com> wrote:
OpenPnP is developed with OpenJDK o with Oracle JDK?

--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.

Marius Liebenberg

unread,
Dec 22, 2018, 1:23:54 AM12/22/18
to OpenPnP
Jason
I am running a jdk according to the pic attached. I am running OpenJdk and not the Oracle package.

JAVA_2018-12-22_08-20-25.png

Marius Liebenberg

unread,
Dec 22, 2018, 1:25:44 AM12/22/18
to OpenPnP
I reimported the project after doing what Javier suggested and get this now

INFO] Scanning for projects...

[INFO]
[INFO] ----------------------< org.openpnp:openpnp-gui >-----------------------
[INFO] Building openpnp-gui 0.0.1-alpha-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for com.sun.xml.bind:jaxb-core:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for com.sun.xml.bind:jaxb-impl:jar:2.2.11 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- buildnumber-maven-plugin:1.3:create (default) @ openpnp-gui ---
[INFO] ShortRevision tag detected. The value is '7'.
[INFO] Executing: /bin/sh -c cd /home/pnp/openpnp-dev/openpnp && git rev-parse --verify --short=7 HEAD
[INFO] Working directory: /home/pnp/openpnp-dev/openpnp
[INFO] Storing buildNumber: adc3dfb at timestamp: 1545459552383

[INFO] Storing buildScmBranch: develop
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ openpnp-gui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 105 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ openpnp-gui ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ openpnp-gui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ openpnp-gui ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.19:test (default-test) @ openpnp-gui ---

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0


[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.493 s
[INFO] Finished at: 2018-12-22T08:19:13+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test (default-test) on project openpnp-gui: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/pnp/openpnp-dev/openpnp && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xmx256m -jar /home/pnp/openpnp-dev/openpnp/target/surefire/surefirebooter4435274095959849550.jar /home/pnp/openpnp-dev/openpnp/target/surefire/surefire3484503192404433659tmp /home/pnp/openpnp-dev/openpnp/target/surefire/surefire_02476405912306544576tmp
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:

Marius Liebenberg

unread,
Dec 22, 2018, 1:40:41 AM12/22/18
to OpenPnP
It would seem that the surefire 2.19 plugin is no longer available. I changed the version in the pom.xml to the latest and it compiled. Now I wonder if the CheckStyle plugin problem is not the same?

Marius Liebenberg

unread,
Dec 22, 2018, 2:42:18 AM12/22/18
to OpenPnP
OK I think I figured out the issues.

1: OpenJdk 1.8 does not have a jar that is required by CheckStyle
2: OpenJdk 1.8 will not fetch version 2.17 of surefire but will work with version 3.0.0-M2
3: Jdk 1.8 needs surefire version 2.17
4: Jdk 1.8 will work with CheckStyle

On Wednesday, December 19, 2018 at 12:32:23 PM UTC+2, Marius Liebenberg wrote:

Jason von Nieda

unread,
Dec 23, 2018, 10:53:51 AM12/23/18
to ope...@googlegroups.com
Hi Marius,

Thanks for tracking this down! In your list, #3 and #4, do you mean Oracle JDK?

It's been a long time since I upgraded any of the plugins in the pom.xml, so if you think we can make some changes that will work for all cases, please let me know.

Jason


--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.

Marius Liebenberg

unread,
Dec 24, 2018, 12:35:47 AM12/24/18
to OpenPnP
Hi Jason
Yes it is Oracle JDK in #3 and #4.

I am not sure if we can make it work for both JDK's. It would seem that the OpenJdk has some stuff missing or is at least not the same as Oracle JDK. Something to do with tools. I did try and look for it online but did not have a lot of luck. This only affects the CheckStyle plugin though. I will check again when I have started up my machine.

ma...@makr.zone

unread,
Jul 2, 2019, 4:03:22 AM7/2/19
to OpenPnP
Hi

Seeing that Oracle now wants all my data including phone numbers, private address etc. in exchange for the JDK and Java is be pay-per-month ($2.5) even for private desktop use, I'm trying to go with the OpenJDK (AdoptOpenJDK, openj9 option) for my new machine.

But I get this:

opencv_java342 (Not found in java.library.path)

Any ideas? Thanks.

_Mark

[INFO] Scanning for projects...

[INFO]
[INFO] ----------------------< org.openpnp:openpnp-gui >-----------------------
[INFO] Building openpnp-gui 0.0.1-alpha-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- buildnumber-maven-plugin:1.3:create (default) @ openpnp-gui ---
[INFO] ShortRevision tag detected. The value is '7'.
[INFO] Executing: cmd.exe /X /C "git rev-parse --verify --short=7 HEAD"
[INFO] Working directory: C:\Users\Markus\git\openpnp
[INFO] Storing buildNumber: 930e792 at timestamp: 1562053585826
[INFO] Storing buildScmBranch: feature/valve-pump-probing-led-actuators
[INFO]
[INFO] --- maven-checkstyle-plugin:2.17:check (validate) @ openpnp-gui ---
[INFO] Beginne Prüfung...
Prüfung beendet.

[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ openpnp-gui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 109 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ openpnp-gui ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ openpnp-gui ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ openpnp-gui ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.19:test (default-test) @ openpnp-gui ---

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running BasicJobTest
Configuration directory: C:\Users\Markus\AppData\Local\Temp\1562053589700-0\.openpnp
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.219 sec <<< FAILURE! - in BasicJobTest
testSimpleJob
(BasicJobTest)  Time elapsed: 0.219 sec  <<< ERROR!
java
.lang.Exception: Error while reading machine.xml (opencv_java342 (Not found in java.library.path))
    at
BasicJobTest.testSimpleJob(BasicJobTest.java:58)
Caused by: java.lang.reflect.InvocationTargetException
    at
BasicJobTest.testSimpleJob(BasicJobTest.java:58)
Caused by: java.lang.UnsatisfiedLinkError: opencv_java342 (Not found in java.library.path)
    at
BasicJobTest.testSimpleJob(BasicJobTest.java:58)





Jason von Nieda

unread,
Jul 2, 2019, 9:15:37 AM7/2/19
to ope...@googlegroups.com
You can still use Oracle JDK <= 11 for free, under the BCL. See "Where can I get information on licensing?" at https://www.oracle.com/technetwork/java/javase/overview/faqs-jsp-136696.html.

For the error, try OpenJDK with HotSpot, rather then OpenJ9. All OpenPnP builds are tested with OpenJDK + HotSpot 8-11, so it should work fine.

Jason


--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.

ma...@makr.zone

unread,
Jul 2, 2019, 9:52:36 AM7/2/19
to OpenPnP
On Tuesday, July 2, 2019 at 3:15:37 PM UTC+2, Jason von Nieda wrote:
You can still use Oracle JDK <= 11 for free, under the BCL. See "Where can I get information on licensing?" at https://www.oracle.com/technetwork/java/javase/overview/faqs-jsp-136696.html.

I actually tried downloading Oracle JDK 8 as it is still recommended by Eclipse. But there seems no way around creating an Oracle Account and registration, which requires very detailed personal information including phone numbers. For me that's a no-go as a prerequisite for an Open Source project like OpenPNP, by principle. I wanted to make sure there is one.


All OpenPnP builds are tested with OpenJDK + HotSpot 8-11, so it should work fine.

Very glad to hear that! Nice work.


For the error, try OpenJDK with HotSpot, rather then OpenJ9.


That's what I'm trying to do for some time now. Eclipse keeps choosing OpenJ9 despite setting PATH, JAVA_HOME and Eclipse JRE settings to the hotspot JDK. I guess I must uninstall OpenJ9.
 
Will report back...

_Mark

ma...@makr.zone

unread,
Jul 2, 2019, 10:53:03 AM7/2/19
to OpenPnP
Hi

turns out the Java virtual machine, once determined by the installer is hardcoded into the eclipse.ini file, which is side-by-side by the eclipse.exe launcher (not very well designed IMHO).

So after changing the .ini it worked with OpenJDK 8 + HotSpot.

Unfortunately the claims of the OpenJ9 website holds true: HotSpot is much slower, including very noticably for the Eclipse IDE itself.

So I tried installing OpenJDK 11 + OpenJ9 and it works, running Eclipse with it, but again not OpenPNP. Still the same
opencv_java342 (Not found in java.library.path)

At least with Eclipse using Java 11 and OpenPNP using Java 8 the JREs are now properly chosen.

_Mark

Jason von Nieda

unread,
Jul 2, 2019, 11:12:34 AM7/2/19
to ope...@googlegroups.com
Hi Mark,

Forgive me if you already know this, but the JDK in the eclipse.ini is only for running Eclipse. It is not specifically related to what JDK you use to run projects. If you go into Eclipse -> Settings -> Java -> Installed JDKs you can see all the JDKs that have been registered with Eclipse, and you can add new ones. Then you can select which JDK is used to run a given project in that project's settings. In particular, there is no requirement that the Eclipse JDK and the project JDK need to match, and most often they do not.

Jason


--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.

ma...@makr.zone

unread,
Jul 2, 2019, 12:05:42 PM7/2/19
to OpenPnP
Hi Jason

Then you can select which JDK is used to run a given project in that project's settings

Well, I figured out what the problem was.When running the application Main, the project JRE is taken:


But when running Maven test, the project JRE is not available and it falls back to a random Alternate JRE:


Once I got this, I was back in control.

I'm still wondering why the OpenJ9 VM does not work. After all it's the same OpenJDK code that is actually resolving and loading the library. Strange...

_Mark


Jason von Nieda

unread,
Jul 2, 2019, 12:11:19 PM7/2/19
to ope...@googlegroups.com
The OpenCV library is pretty sensitive to JDK changes. It uses a number of hardcoded strings, terrible exception handling tricks, and classloader tricks to be able to load the native libraries from the jar file. Most likely there is just some small string change that is needed.

I need to refactor that library so that it uses more modern library loading code, and then it will be much more robust.

Jason


--
You received this message because you are subscribed to the Google Groups "OpenPnP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openpnp+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.

ma...@makr.zone

unread,
Jul 2, 2019, 3:49:27 PM7/2/19
to OpenPnP
> I need to refactor that library so that it uses more modern library loading code, and then it will be much more robus

Reply all
Reply to author
Forward
0 new messages