简体   繁体   中英

Javafx 8 lambda expression error

I got an illegal expression error when compiling javafx program. I have want to upload the screenshot but the stack exchange app. Is demanding that I need 10 reputation to be able to upload images!

btn.setOnAction( e-> buttonClick() );

the compiler point the e--> as illegal expression

I install JDK 8 and have set my environment variable

Yet I still get the error... guys help

If your are compiling using command line,You may be using jdk 7,try to set up JDK 8 from the environment variables.

Right click MyComputer->properties->Advanced System Settings Then in the advanced tab, select Environment variables, look for "path" under system variables look for your jdk path and change it to the jdk 8 path

in mycase图片示例

If jdk 7 path also exists, don't forget to delete it

I just find out the fault The reason for the error is that jdk 7 was still install on my system! I uninstall it and now it work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM