Problems running tests in intellij

Hello,

I am trying to use Intellij to develop for snap.
I used the information in the cookbook to prepare everything.

It works correctly to build the code from the command line (using mvn clean install). And I can also run SNAP from the IDE as described in the cookbook.

However, when I try to run one of the unittests included in the code I get build problems in the module ‘snap-gpf’, see output below.

Does anyone recognize this problem? Is there anything else that needs to be configured?

Thanks for any support!

Information:java: Errors occurred while compiling module ‘snap-gpf’
Information:javac 1.8.0_151 was used to compile java sources
Information:19/03/2018 08:34 - Compilation completed with 61 errors and 3 warnings in 6s 181ms
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\SourceProductsDesc.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(27, 37) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.SourceProductsDesc
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\FieldDesc.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(25, 19) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.FieldDesc
Error:(27, 28) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.FieldDesc
Error:(44, 12) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.FieldDesc
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\OperatorDoclet.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(20, 23) java: package com.sun.javadoc does not exist
Error:(21, 23) java: package com.sun.javadoc does not exist
Error:(22, 23) java: package com.sun.javadoc does not exist
Error:(23, 23) java: package com.sun.javadoc does not exist
Error:(77, 37) java: cannot find symbol
symbol: class Doclet
Error:(128, 33) java: cannot find symbol
symbol: class RootDoc
location: class org.esa.snap.core.gpf.doclet.OperatorDoclet
Error:(200, 40) java: cannot find symbol
symbol: class DocErrorReporter
location: class org.esa.snap.core.gpf.doclet.OperatorDoclet
Error:(209, 19) java: cannot find symbol
symbol: class LanguageVersion
location: class org.esa.snap.core.gpf.doclet.OperatorDoclet
Error:(102, 30) java: package com.sun.tools.javadoc does not exist
Error:(154, 9) java: cannot find symbol
symbol: class ClassDoc
location: class org.esa.snap.core.gpf.doclet.OperatorDoclet
Error:(155, 14) java: cannot find symbol
symbol: class ClassDoc
location: class org.esa.snap.core.gpf.doclet.OperatorDoclet
Error:(210, 16) java: cannot find symbol
symbol: variable LanguageVersion
location: class org.esa.snap.core.gpf.doclet.OperatorDoclet
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\OperatorHandlerConsole.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(20, 23) java: package com.sun.javadoc does not exist
Error:(21, 23) java: package com.sun.javadoc does not exist
Error:(22, 23) java: package com.sun.javadoc does not exist
Error:(23, 23) java: package com.sun.javadoc does not exist
Error:(30, 23) java: cannot find symbol
symbol: class RootDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(34, 22) java: cannot find symbol
symbol: class RootDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(56, 41) java: cannot find symbol
symbol: class ClassDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(64, 41) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(74, 39) java: cannot find symbol
symbol: class AnnotationDesc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(87, 55) java: cannot find symbol
symbol: class AnnotationDesc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(40, 9) java: cannot find symbol
symbol: class ClassDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(49, 9) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(50, 14) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(57, 9) java: cannot find symbol
symbol: class AnnotationDesc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(58, 14) java: cannot find symbol
symbol: class AnnotationDesc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(65, 9) java: cannot find symbol
symbol: class AnnotationDesc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(66, 14) java: cannot find symbol
symbol: class AnnotationDesc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(75, 9) java: cannot find symbol
symbol: class AnnotationTypeElementDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(79, 18) java: cannot find symbol
symbol: class AnnotationTypeElementDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerConsole
Error:(88, 23) java: package AnnotationDesc does not exist
Error:(90, 28) java: package AnnotationDesc does not exist
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\OperatorHandler.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(22, 16) java: cannot find symbol
symbol: class RootDoc
location: interface org.esa.snap.core.gpf.doclet.OperatorHandler
Error:(23, 15) java: cannot find symbol
symbol: class RootDoc
location: interface org.esa.snap.core.gpf.doclet.OperatorHandler
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\OperatorDesc.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(20, 23) java: package com.sun.javadoc does not exist
Error:(34, 19) java: cannot find symbol
symbol: class ClassDoc
location: class org.esa.snap.core.gpf.doclet.OperatorDesc
Error:(46, 50) java: cannot find symbol
symbol: class ClassDoc
location: class org.esa.snap.core.gpf.doclet.OperatorDesc
Error:(87, 12) java: cannot find symbol
symbol: class ClassDoc
location: class org.esa.snap.core.gpf.doclet.OperatorDesc
Error:(52, 9) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.OperatorDesc
Error:(53, 25) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.OperatorDesc
Error:(54, 14) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.OperatorDesc
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\TargetProductDesc.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(27, 36) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.TargetProductDesc
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\SourceProductDesc.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(27, 36) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.SourceProductDesc
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\ParameterDesc.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(29, 32) java: cannot find symbol
symbol: class FieldDoc
location: class org.esa.snap.core.gpf.doclet.ParameterDesc
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\doclet\OperatorHandlerHtml.java
Error:(19, 23) java: package com.sun.javadoc does not exist
Error:(43, 23) java: cannot find symbol
symbol: class RootDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerHtml
Error:(52, 22) java: cannot find symbol
symbol: class RootDoc
location: class org.esa.snap.core.gpf.doclet.OperatorHandlerHtml
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\monitor\OperatorRuntimeReport.java
Warning:(137, 60) java: non-varargs call of varargs method with inexact argument type for last parameter;
cast to java.lang.Object for a varargs call
cast to java.lang.Object[] for a non-varargs call and to suppress this warning
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\annotations\ParameterBlockConverter.java
Warning:(54, 45) java: XppReader(java.io.Reader) in com.thoughtworks.xstream.io.xml.XppReader has been deprecated
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\graph\GraphOp.java
Warning:(117, 13) java: OperatorSpi(java.lang.Class<? extends org.esa.snap.core.gpf.Operator>,java.lang.String) in org.esa.snap.core.gpf.OperatorSpi has been deprecated
C:\Users\helga\Documents\GitHub\snap\snap-engine\snap-gpf\src\main\java\org\esa\snap\core\gpf\internal\OperatorImage.java
Information:java: Some input files use unchecked or unsafe operations.
Information:java: Recompile with -Xlint:unchecked for details.

It could be that you are using a JRE instead of a JDK to compile SNAP.
The package com.sun.tools.javadocdoes not exist in the JRE.
If you change JAVA_HOME to a JDK it should work.

You can also change the path to the tools.jar which is required.
It is located in the pom.xml of the snap-gpf module.

    <properties>
        <jdkToolsPath>${java.home}/../lib/tools.jar</jdkToolsPath>
    </properties>
1 Like

Thanks, Marco for the quick reply!
I added the tools.jar manually to the Project Structure, that seems to have solved the problem.
I am still not sure, why this was not recognized by itself.
Thanks and have a nice day!

Maybe the profile in maven settings is not marked in your project. Sometimes it gets lost by IDEA.

1 Like

Hi Marco,
yes, this was not checked.
However, when doing this (and removing the manual changes I did to the Project Structure), I get the following error:
Error:java: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider org.esa.snap.rcp.about.AboutBoxProcessor not found
Cheers
Helga

From time to time I get this too.
Then starting all over, cleaning and building all projects helps.

com.sun.javadoc is not available from openjdk-8-jdk v8u222; the snap-gpf compilation step will now always fail :frowning:

Please use the Oracle JDK 8u202. That’s what we use and support.
https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
OpenJDK and more recent JDK versions will be supported later this year. During the development of NAP 8.