B4J Question java.io.FileNotFoundException

T201016

Active Member
Licensed User
Longtime User
Hi everyone,

I use:
B4J version 4.20(1)
JDK version 1.8.0_74

B4X:
#Region Project Attributes
    #MainFormWidth: 500
    #MainFormHeight: 300
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Public lv1 , lv2 As ListView
    Private SplitPane1 As SplitPane
    Private SplitPaneAnchorL As AnchorPane
    Private SplitPaneAnchorR As AnchorPane
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("ListViewLayout")    '------------- ListViewLayout.FXML !
    MainForm.Title="Split Pane - Accessing nodes?"
    MainForm.Show
    '
    lv1.Items.Initialize
    lv1.Items.Add("First entry")
    ' lv2 lives inside a split pane.
    ' ** ERROR - object should be initialised first
    ''lv2.Items.Initialize
    ''lv2.Items.Add("First entry")  
End Sub

when compiling this code, I get the error:


how to solve this problem?
thank you in advance.
 

stevel05

Expert
Licensed User
Longtime User
Works for me here, but the extension is lowercase (.fxml). Otherwise you could try specifying it.
B4X:
MainForm.RootPane.LoadLayout("ListViewLayout.FXML")
 
Upvote 0

T201016

Active Member
Licensed User
Longtime User

The problem is that the file in the project (ListView Layout.FXML) have the extension .fxml - while the error: "java.io.FileNotFoundException: ListViewLayout.bjl" if the concern had a file with the extension .bjl
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I have projects that load fxml files without a problem.

Having done a quick test, it appears that Capital letters in the file extension could be causing problems. Try renaming the file with lowercase lettters.
 
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
Are you sure you have added ListViewLayout.fxml on B4J Project Files Manager Window ?

I've tested on a project, deleting a fxml layout from Files Manager and by default, B4J tries to load layouts with a *.bjl extension (and show the error you posted seeking for a layout.bjl)

P.D:

bjl extension ---> layouts created on B4J Designer View (new way to create layouts on B4J)
fxml extension --> layouts created with Scene Builder (old way for creating layouts on B4J)
 
Upvote 0

T201016

Active Member
Licensed User
Longtime User
Everything written above is consistent. After testing in small letters in the names of all working properly. Moreover mistakenly I called the directory using the string with a dot and an exclamation mark (.!) Which creates confusion when searching collections by B4J.
Thanks for taking the time cordial.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…