Open bobl01 opened 8 months ago
I would try using Maven or Gradle for JavaFX. Also see the section on NetBeans at https://openjfx.io/openjfx-docs/ which is hopefully current enough.
cc @mbien while considering out-of-date libraries, etc. we should possibly remove this whole section of projects in NB22? I have a feeling that moving to JDK17+ is going to cause further issues here.
Thanks for the suggestions, but that's not the point. If a feature is included in Netbeans then it should either work or be removed. The Ant FX projects are neither - they don't work and they're still present ;-)
Please DON'T remove Ant if that's what you're considering. It's lightweight for simple projects and it works quickly. I'm actually able to use the basic Ant Java Application project for FX and FXML projects, so I don't see why there's a problem with the scripts.
cc @mbien while considering out-of-date libraries, etc. we should possibly remove this whole section of projects in NB22? I have a feeling that moving to JDK17+ is going to cause further issues here.
We should definitively remove things which break and nobody is interested to fix. I haven't looked into this problem but the ant integration is very old. Features like jnlp/webstart are long overdue to be removed since they won't work anymore anyway.
(edit: i am not saying to remove ant integration of course, but nashorn is certainly gone)
@bobl01 no-one is suggesting removing Ant support. But also no-one is working on the JavaFX Ant integration, and there's been pretty much zero input since the donation to ASF. If you'd like that integration to stay, then you're welcome to work on it, as is anyone else. On the other hand, if that doesn't happen, I think we need to be more proactive in removing non-working and non-maintained elements from the UI (or from the list of released modules).
Adding contributions welcome label on this one for now!
Me and my big mouth! As I said earlier, the standard Ant Java Application script works with both FX and FXML projects (on my computer, with Zulu SDK FX 21 installed). So, apart from adding a warning to the user to install or select a JDK including FX, the same code skeletons can re-used with the standard Ant script. There is another problem with integrating Scene Builder with the FXML document, but I won't bore you with the details here; I don't think it's a deal breaker, but it may require adding another switch to project.properties.
I'm happy to look into this but I need someone to get me started on how these project and build script skeletons are stored.
I've taken a look at this. The Ant FX build scripts are over 3000 lines of (mostly) uncommented XML. The standard Ant (non FX) Application build script is a little shorter. I think that instead of attempting to be "all-singing, all-dancing", a better option is to make all the scripts far simpler and much more limited in scope; more suited for programming students, and casual programmers such as myself. Those with more complex requirements should be directed to Maven or Gradle. I also suggest that the New Projects page needs to give at least some guidance for users who may be new to Netbeans and/or Java programming. Three way of making a Java Application with zero guidance is too confusing.
Since I've already made a start, I'll continue with the scripts, although I've not actually signed on as an official developer (yet).
I think that instead of attempting to be "all-singing, all-dancing", a better option is to make all the scripts far simpler and much more limited in scope;
+1
Those with more complex requirements should be directed to Maven or Gradle.
Everyone should be directed to Maven or Gradle, unless they have legacy requirements. This is why the build systems are ordered in the way that they are, and through a lot of discussion.
I also suggest that the New Projects page needs to give at least some guidance for users who may be new to Netbeans and/or Java programming.
Certainly something that could be improved, I think, and hopefully an easy task (from a coding point of view).
Since I've already made a start, I'll continue with the scripts, although I've not actually signed on as an official developer (yet).
Just open a pull request when you're ready. There is no need to to be signed on as an "official developer" to start making contributions. Do read the text in the description part of a pull request when you open one, which is also the text at https://github.com/apache/netbeans/blob/master/.github/PULL_REQUEST_TEMPLATE.md
Thank you very much for your comments and useful information about making submissions. When I'm ready, I'll make full use of it.
I suggest that when it comes to newbies to programming, Java, and/or Netbeans, a well-signposted and simple option should be present. Say "Ant for simple projects". I dare say that old dinosaurs such as myself will also use them ;-)
@bobl01 check out the first option under the maven projects called "Java Application". Adding dependencies can be done via right click or you can simply paste the dependency snippet into the pom file which many libraries put onto their download page.
I think this was even once called "Simple Java Application", but that was also weird since it could confuse users which had great plans and wanted to write a not-so-simple java application. It literally is a hello world program.
There is a template for JavaFX projects too.
@bobl01: I encountered a similar problem, illustrated here, when migrating an old Ant/JavaFX2 project. For recent JavaFX with Maven, I like the javafx-maven-archetypes. Once installed , Simple and FXML archetypes will appear in the File > New Project > Java with Maven
dialog. The command-line equivalent is seen here.
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