Unable to create a JavaFX project in Netbeans IDE 16 [duplicate] - javafx

I've been banging my head on this one for ages and all of the tutorials I've found don't seem to work. When I try to create a new JavaFX project in Netbeans 14, using JDK 18 and the latest JFX download for Windows here:
https://gluonhq.com/products/javafx/
Also tried with JDK and JFX 17 and still no luck. I get this error:
I've added the libraries like so:
If I try to add the platform folder, it won't let me progress through the dialogue:
I can't find solutions to this anywhere and, again this is the same with JDK 17 and 18, and JFX 17 and 18. I've checked the documentation and there's nothing that seems to solve the issue.
It says to go to the JavaFX tab and enable JavaFX, but there's no JavaFX tab... Unless they mean this:
But if that's it then, as you can see, it's already enabled and it's still not working. I'm totally lost. I don't understand why the documentation is so poor for FX, for every IDE. It's honestly like they don't want people to use it and every tutorial I'm finding is using outdated versions of NetBeans, the JDK and JFX D-: (they also don't solve the issue even if I do follow them).
If anyone could help guide me, I'd really appreciate it.

I would suggest you go to New Project -> Java with Maven -> either Simple JavaFX Maven Archetype(Gluon) or FXML JavaFX Maven Archetype(Gluon). Use the POM to change your version of JavaFX from the default to whatever version you like. I also use the POM to change the JavaFX-Maven-Plugin to the latest version.

I strongly endorse the approach using maven suggested here. This project started exactly the same way; I'd welcome learning of any issues you encounter.
Alternatively, follow the steps outlined in JavaFX and NetBeans: Non-modular projects: IDE. You've created a JavaFX library, but "Don't try to create a JavaFX project." Instead, choose Java with Ant and Java Application to create a new project, shown below, then follow the remaining steps carefully. It's a convenient alternative for a scratch project while you assay maven.
Addendum: The ant code for a JavaFX project, not selected in the image above, may attempt to package dependencies that are no longer required. In particular, a project using module javafx.web may fail with the following error, seen here and here. The easiest fix is to recreate the Java application by choosing Java Project with Existing Sources.
Unable to create javax script engine for javascript.
Alternatively, a simple example using a custom ant script is cited here.

Related

Runnable Jar from a JavaFX 8 project, JavaFX compenents are missing

i created a Javafx project using JDK 8 and when i tried to export it to a runnable .jar file, i got surprised that it doesn't run using CMD, and gives the following error :
"Javafx compenents are missing"
while it works perfectly during the compiling time(using the IDE) when i accessed the .jar files, i found it has just .class files (that i made), and the needed library files that haven't been exported (i made sure to select the "extract need library files extract required libraries into generated jar" option in Eclipse), is there a reason behind of this? and a way to solve it? thanks in advance
Ps: i tried this using Eclipse and Intellij IDE
I just wanna mention once again that I'm using JDK 8 where it has JavaFX library inside of it.
Did you try this?
There are detailed instructions on how to configure your IDE to run JavaFX with newer OpenJDKs (which do not come with JFX components in it).
It also explains how to create a new JavaFX Maven project from archetype, with all the necessary plugins to easily build your application while including the minimal Java components for it (using jlink).
This will ensure that anybody using your application will have those components.

Is there a direct way to get a full ejb/servlet application example for glassfish

I have an application that is currently running on JBoss AS but does not work on Glassfish. I'm trying to work through the documentation here but I'm having trouble figuring out things like what the file structure of the application should be and what (if any) additional files are needed. This documentation also refers to examples but to get the examples you need to install Netbeans and access an update tool tied to the glassfish instance installed with Netbeans. When I do this the server won't start, the update tool won't run, and I can't get the examples. Is there an easy way to get these examples (e.g. a simple download)? I've found other examples such as this one, but they are also dependent upon Netbeans.
Is there a simple and complete ejb/servlet example for Glassfish that can be simply downloaded and does not depend upon Netbeans or other IDE?
The obvious example is the Java EE CargoTracker. It was written to show what a "real" application might look like with pure Java EE APIs so should work on both JBoss and GlassFish. You will need Maven installed to build and run it, but there are more complete details in the readme for the project. Note that some of the information is a little out of date (mostly links to java.net which has been sunset in favour of a GitHub site) but the application itself is still a good example of Java EE 7 APIs.
https://github.com/javaee/cargotracker
I found the examples on github here:
https://github.com/javaee/glassfish-samples
To get and build the examples you will need Git and Maven. These examples are small, complete, and concise. The example that was helpful for my particular problem was this example:
glassfish-samples\ws\javaee5\enterprise\servlet-stateless-ear
It demonstrated that I needed to change the structure of my project such that the servlet was in a .war file and not in a .jar file in the lib folder of my project.

Stuck with creating Keyword library using Java in Eclipse and using that JAR file in RIDE

I'm new to ROBOT framework and must create library keyword using java and utilize the JAR files in RIDE editor. I have followed the below steps. But still have confusions in where to start up. Please help me to achieve this.
Steps:
1) Installed Python, wxPython, pybot, RIDE, selenium2library successfully and I'm able to work with RIDE using predefined keywords.
2) For creating own java library, Installed Eclipse Mars, Java, ROBOT IDE manually using the link https://github.com/NitorCreations/RobotFramework-EclipseIDE/wiki/Installation
The question here is,
Anything i'm missing to install?
How to proceed further with Robot Framework coding?
Note: I'm reading many materials in parts to proceed things. But that is confusing me what are the steps to be followed. Is there any single material that i can get having the sequences of steps that need to be followed for my requirements?
The below links I referred with,
https://github.com/NitorCreations/RobotFramework-EclipseIDE/wiki/Usage
Maven error "Failure to transfer..."
Create a Maven project in Eclipse complains "Could not resolve archetype"
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-set-test-suite-global-variable-keywords
Let's start with the basics. RIDE is an editor for Robot Script files. Robot Script files are executed by the Robot Framework robot application. It is important to understand the difference between these two applications. One creates files and the other uses them.
Assuming for a moment here that you have some custom functionality in a Jar file that you would like to make available inside the Robot Script files test cases. If this is indeed the case then your focus should be on create Robot Test Libraries. In the documentation there are numerous java examples given for basing your own library on.
This means that you do not need Maven, unless you want to, to create your library. Also Eclipse IDE is not needed nor is RIDE. The library you create can be used by Robot Framework even when it's run from the command line. Feel free to use them for what they are good at: writing Robot Scripts efficiently and running Robot through menu options instead of command line windows.
When you are familiar with Eclipse and comfortable with it's features, then I can also recommend using the Eclipse Application RED which is a mature Eclipse add on for creating, running and debugging Robot scripts.
There are two ways of implementing a Java routine in Robot Framework and it depends a bit on how you run Robot Framework: Python or Jython. Running Python means that you need to run the Java in a separate JVM container and connect to it. The simplest way is via Command Line interaction. This may cause some security concerns. The second approach is to use the Remote Library approach. A good example of this is the Robot Framework Sikuli Library. An added bonus is that you can run Robot and your Java application on two separate machines/servers.
The Jython way has been discussed on StackOverflow before and I gladly refer to it. Please bear in mind that although the examples refer to RIDE, the Library org.company.Keywordlibrary works in all IDE's, provided robot framework is run using Jython.
In the Jython documentation it clearly explains how to setup an Eclipse based IDE with Jython. Do keep in mind that it's recommended to use the same interpreter in development and production. I.e. if you create your scripts in Jython, do run them in 'production' also using Jython. Otherwise you open yourself up to interpreter differences where functionality does not work or behaves differently then expected.
An alternative approach with Jython is the all-in-one Robot Framework Maven JAR plugin. Adding a custom Java Library in this setup is not too difficult. A nice short tutorial can be found on the blog of Valerio Bruno. If this is your preferred route for development, then you may want to read the RED howto on integrating the Robot Framework Maven jar.
Working on your custom functionality is likely going to be a independent project in Eclipse, but can be linked to an Robot project via the Class Path settings in red.xml if you use RED or the CLASS_PATH environment variable.
Done! I have installed RED and required add on using following below steps. It worked successfully with predefined keywords. Now I'm gonna create user defined keywords/libraries using the same editor. I don't know where to start up. Will it work creating just a java project? Should I need to include any additional libraries?
Steps followed to proceed with RED:
1. RED Version Conclusion: https://github.com/nokia/RED/blob/master/release.md
2. RED Installation Instructions: https://github.com/nokia/RED/blob/master/installation.md
3. ROBOT Framework prerequisites using RED: https://github.com/nokia/RED/blob/master/red_help/first_steps/download_install.html.md
4. To verify Installations in Eclipse: Help -> Installation Details to check if RED is visible on installed features list
5. Create Project and Tests using RED in Eclipse: https://github.com/nokia/RED/blob/master/red_help/first_steps/create_run.html.md
6. RED Steps: https://github.com/nokia/RED/blob/master/First_steps.md
7. Quick STart: https://github.com/nokia/RED/blob/master/red_help/user_guide/quick_start.html.md

Can't mport javafx

I'm using Netbeans 8.0.2. I used the wizard to created a Java class library project so I could share a class among several projects. I now want to add some capability that requires me to import from javafx (SimpleStringProperty). Fix imports didn't work and Intellisense says it doesn't know javafx.
I looked at the Project Properties | Libraries setting of one of my JavaFX applications and I see javafx.classpath.extension. I think I need this, but I don't know how to add it. I searched and someone suggested adding the jdk's jfxrt.jar file to the compile libraries, but that didn't work.
Is the lack of javafx.classpath.extension my problem? If so, how do I add it?
I finally found this bug that addresses this: Bug 213219 .
Basically, you: "...go to Project Properties, Deployment panel, and check "Keep JavaFX Runtime on Classpath"..."
Thanks everyone!

How to debug problems with the javafx native bundle for Windows?

I'm trying to package a JavaFX/DukeScript application into native bundles.
For Windows that's achieved with Inno Setup, that's what the javafxpackager uses.
I can't find much documentation about it, so I'll create a question and provide the answers I find below.
Related questions: 1, 2, 3, 4
So I've created a build.xml Ant script using e(fx)clipse (see example here).
I've been following this excellent blog post.
Now, the bundle task worked and produced an installer and executable app.
I've been having trouble running the app and couldn't see a stack trace.
So here's how to display a window with the stack trace when running the executable from the command line:
goGPS_FX.exe /Debug
That brings up a popup, with the stack trace. In my case, a jar dependency was missing. So just for testing, I manually added that jar under deploy\bundles\goGPS_FX\app\libs.
For the JavaFX launcher to include this new jar, I need to modify the file app\package.cfg.
As far as I understand, that's JavaFX specific, it's not needed by Inno Setup.
Also, I couldn't find much information about this file.
Anyway, there's a property called app.classpath we can update.
The other relevant property is app.mainclass. Here the mainclass is not specified with the standard dotted notation, but rather as a path:
app.mainclass=org/gogpsproject/GoGPS_Fx
Finally, other properties might be available. One I've found was:
jvmarg.1=-Djavafx.verbose=true
So that's a way to pass arguments to the jvm, should you need to.

Resources