Skip to content

JavaFX Requires 'code' Folder to Run #1327

@vsquared

Description

@vsquared

Most relevant area for this enhancement?

Build process

Feature to enhance

Pre-installation of javafx.xxxx.jar files in another folder.

Enhancement details

Pull request #856 added all seven of the javafx modules to the Processing editor. However, some users particularly on Linux and Windows were unable to run JavaFX demos without manually adding a 'code' folder to the sketch and copy/pasting the jar files or drag 'n dropping the javafx.jar files onto an open sketch to create the 'code' folder automatically. The javafx.xxxxx.jar files were present, but buried deeper inside operating system folders and inside a nested 'modules' folder. Unfortunately the runtime did not know how to access these files. The issue has been discussed in detail here: https://discourse.processing.org/t/processing-and-javafx/45692/13

Related Finding:
I've never had a problem running JavaFX demos on my MacOS system. I now realize that this is because I have always had the javafx.xxxx.jar files in my Processing/libraries/javafx/library folder. I tried temporarily removing all of these and I was no longer able to run JavaFX files (missing library error message). I then reinstalled the javafx.xxxx.jar files to this folder which 'fixed' the problem and brought back the ability to run Java/FX source code.

Solution:
A simple solution is to copy/paste all of the 'javafx.xxxx.jar' files plus 'javafx.jar' into the Processing/libraries/javafx/library folder where they are accessible to the runtime. This has been tested on all three platforms and appears to be a valid solution to the problem. To spare the user from copy/pasting the javafx.jar files perhaps they could be installed in the Processing/libraries/javafx/library folder before distribution or when the library is installed from the Processing menubar (Sketch/Import Library.../JavaFX). It is unclear to me when the 'javafx' folder is added to Processing/libraries.

Confirmation:
After installing the javafx modules as described above you should be able to run this simple demo on your system without using a 'code' folder:

Test javafx source code:

import javafx.scene.canvas.Canvas;
import javafx.scene.layout.StackPane;

Canvas canvas;
StackPane root;

void setup(){
 size(350,200,FX2D);  
 surface.setTitle("JavaFX in Default Wnd");
 canvas = (Canvas)surface.getNative();
 root = (StackPane)canvas.getParent();
}

void draw(){
  fill(0,255,0);
  circle(width/2,100,100);
}

Processing/libraries/javafx/library folder should look like this on Windows 11:

Image

Would you like to help implement this enhancement?

Yes, I’d like to help with this

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions