xulihang Well-Known Member Licensed User Longtime User Sep 16, 2026 #1 Hi, I am encountering an issue after upgrading to JRE 26. If I pass an empty string for File.Exists, it returns true. While in previous versions like JRE 23, it returns False. B4X: Dim dc As DirectoryChooser dc.Initialize Dim path As String = dc.Show(MainForm) If File.Exists(path,"") Then 'empty string if no file selected Log("do something") End If
Hi, I am encountering an issue after upgrading to JRE 26. If I pass an empty string for File.Exists, it returns true. While in previous versions like JRE 23, it returns False. B4X: Dim dc As DirectoryChooser dc.Initialize Dim path As String = dc.Show(MainForm) If File.Exists(path,"") Then 'empty string if no file selected Log("do something") End If
xulihang Well-Known Member Licensed User Longtime User Sep 16, 2026 #2 Setting the empty working directory then leads to failure to start a program via shell. B4X: private serverShell as Shell If File.Exists(WorkFolderTextField.Text,"") Then serverShell.WorkingDirectory = WorkFolderTextField.Text End If Upvote 0
Setting the empty working directory then leads to failure to start a program via shell. B4X: private serverShell as Shell If File.Exists(WorkFolderTextField.Text,"") Then serverShell.WorkingDirectory = WorkFolderTextField.Text End If
LucaMs Expert Licensed User Longtime User Sep 16, 2026 #3 xulihang said: Setting the empty working directory then leads to failure to start a program via shell. Click to expand... B4X: If WorkFolderTextField.Text <> "" Then If File.Exists(WorkFolderTextField.Text,"") Then serverShell.WorkingDirectory = WorkFolderTextField.Text End If Else ... End If (It is always better to use variables rather than directly using the `Text` property of the views). Upvote 0
xulihang said: Setting the empty working directory then leads to failure to start a program via shell. Click to expand... B4X: If WorkFolderTextField.Text <> "" Then If File.Exists(WorkFolderTextField.Text,"") Then serverShell.WorkingDirectory = WorkFolderTextField.Text End If Else ... End If (It is always better to use variables rather than directly using the `Text` property of the views).
xulihang Well-Known Member Licensed User Longtime User Sep 16, 2026 #4 I created a sub and replace all the File.Exists with this Sub. B4X: Public Sub Exists(dir As String,filename As String) As Boolean Dim path As String = File.Combine(dir,filename) If path = "" Then Return False Else Return File.Exists(dir,filename) End If End Sub Upvote 0
I created a sub and replace all the File.Exists with this Sub. B4X: Public Sub Exists(dir As String,filename As String) As Boolean Dim path As String = File.Combine(dir,filename) If path = "" Then Return False Else Return File.Exists(dir,filename) End If End Sub
xulihang Well-Known Member Licensed User Longtime User Sep 16, 2026 #5 This change is starting from JDK 25: https://inside.java/2025/11/03/quality-heads-up/ Upvote 0