apache / apache/netbeans

New FX Project: Ant build fails with error message "Java 15 has removed Nashorn..."

Open
#7,002 11 comments 0 reactions 0 assignees View on GitHub
Ant Contribution welcome kind:bug
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 20

### What happened

There appears to be an error in the ant script for building a Java FX Application. The project is created OK, but when performing a build, the script terminates with the error message:
Java 15 has removed Nashorn, you must provide an engine for running JavaScript yourself. GraalVM JavaScript currently is the preferred option.
The project has not been edited in any way, and I expected the build to just work.

### Language / Project Type / NetBeans Component

Create new project: Java with Ant > Java FX > Java FX Application

### How to reproduce

Before starting, you need a Java FX platform installed in Netbeans, such as "zulu21.30.15-ca-fx-jdk21.0.1". Make sure the platform is known to Netbeans by running Tools > Java Platforms > Add Platform...

Create a new Java FX project: File > New Project... > Java with Ant > Java FX > Java FX Application. Then Next
Use default names and locations. Be sure to select your Java FX platform for the Java Platform entry. Then Finish

When the next project appears, click on the Clean and Build toolbar icon to start building.

The build terminates with the above error message.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Mac OS Monterey Version 12.7.2

### JDK

Netbeans: Java(TM) SE Runtime Environment 21.0.2+13-LTS-58

### Apache NetBeans packaging

Third-party package

### Anything else

Netbeans package is latest from Codelerity for x86_64 Mac OS.

I've tried for several days to resolve this issue myself, but without success.

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Start with the Java with Ant > Java FX > Java FX Application project template and reproduce the failure using the Clean and Build action on JDK 21. Inspect the generated Ant build and the Nashorn-related error path. Done means an unmodified JavaFX application created by the wizard builds successfully on the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.