javac: invalid target release: 1.8

前端 未结 15 766
死守一世寂寞
死守一世寂寞 2021-01-30 12:22

I recently downloaded JDK 1.8.0.0_06 that comes bundled with NetBeans. I then got to find out that my JavaFx project, that I have been developing in Java 1.7 won\'t compile in J

相关标签:
15条回答
  • 2021-01-30 12:53

    Most of the time, these type of issues happen due to incorrect java version. Make sure your PATH and JAVA_HOME variables are pointing to the correct version.

    0 讨论(0)
  • 2021-01-30 12:53

    if you are going to step down, then change your project's source to 1.7 as well,

    right click on your Project -> Properties -> Sources window and set 1.7 here" Jigar Joshi

    Also go to the build-impl.xml and look for the property excludeFromCopy="${copylibs.excludes}" and delete this property on my code was at line 827 but I`ve seen it on other lines

    for me was taking a code from MAC OS java 1.8 to WIN XP java 1.7

    0 讨论(0)
  • 2021-01-30 12:55

    if you are going to step down, then change your project's source to 1.7 as well,

    right click on your Project -> Properties -> Sources window 
    

    and set 1.7 here

    note: however I would suggest you to figure out why it doesn't work on 1.8

    0 讨论(0)
  • 2021-01-30 12:56

    For IntelliJ IDEA Ultimate latest version as of 18th Dec 2017, if the above suggestions don't work, then please try the following: Right Click on the project and navigate to "Open Module Settings". Open it, then change the "Language Level" from the dropdown.

    0 讨论(0)
  • 2021-01-30 13:00

    Your javac is not pointing to correct java.

    Check where your javac is pointing using following command -

    update-alternatives --config javac
    

    If it is not pointed to the javac you want to compile with, point it to "/JAVA8_HOME/bin/javac", or which ever java you want to compile with.

    0 讨论(0)
  • 2021-01-30 13:03

    I got the same issue with netbeans, but mvn build is OK in cmd window. For me the issue resolved after changing netbeans' JDK (in netbeans.conf as below),

    netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_91"


    Edit: Seems it's mentioned here: netbeans bug 236364

    0 讨论(0)
提交回复
热议问题