Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error:(57, 38) java: The type java.util.function.Function cannot be resolved. It is indirectly referenced from required .class files #90

Closed
satoshinm opened this issue Jun 4, 2017 · 3 comments

Comments

@satoshinm
Copy link
Owner

When I compile in IntelliJ IDEA, but not from Maven on the command-line, there is a compile error on the code added for #51 Sponge support:

            this.unbreakableBlocks = rootNode.getNode("nc", "unbreakable_blocks").getList(TypeToken.of(String.class));
@satoshinm
Copy link
Owner Author

satoshinm commented Jun 4, 2017

https://stackoverflow.com/questions/5547162/eclipse-error-indirectly-referenced-from-required-class-files says "You should make sure to add the required jar to the classpath."


Preferences, Build, Execution, Development, Build Tools, Maven, Maven home directory was set to built-in Maven 3 "(Version 3.3.9"). Changed to /Users/admin/.m2, which is detected as version 3.5.0. But no difference.


Compiler > Java Compiler, had set to Eclipse. Changed to javac and am now able to compile no errors.

@Husky2490
Copy link

For those who come across this page from Google, this is caused by Java 1.7 being specified as the target version in pom.xml.

I encountered the same problem while attempting to compile the latest version of Spigot in IntelliJ using JDK 10.0.1 and javac for my compiler within the spigot-api module. After trying the above, I searched some more and decided to take a closer look at the target bytecode version numbers I had glanced over while checking which compiler I was using.

Module Target bytecode version
spigot 1.8
spigot-api 1.7
spigot-parent 1.5

I then looked to see when java.util.function.Function was added and that was 1.8.

Two solutions to this: update the target bytecode version to 1.8 or newer OR disable use of module-specific JDKs

@Husky2490
Copy link

Husky2490 commented May 22, 2018

<properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants