Mar 5, 2025 For anyone needing to write and manage temporary files I came across the File deleteOnExit method which deletes the named file when the JVM terminates normally. JavaDoc is here please read it and use with caution. deleteOnExit cannot be removed from the file once set. B4X: Expand Collapse Copy Public Sub RequestDeleteOnExit(FilePath As String) Dim tFile As JavaObject tFile.InitializeNewInstance("java.io.File",Array(FilePath)) tFile.RunMethod("deleteOnExit",Null) End Sub Usage example: B4X: Expand Collapse Copy RequestDeleteOnExit(File.Combine(File.DirApp,"dialogclose.css")) Hope it helps. Last edited: Mar 7, 2025 Click to expand...
For anyone needing to write and manage temporary files I came across the File deleteOnExit method which deletes the named file when the JVM terminates normally. JavaDoc is here please read it and use with caution. deleteOnExit cannot be removed from the file once set. B4X: Expand Collapse Copy Public Sub RequestDeleteOnExit(FilePath As String) Dim tFile As JavaObject tFile.InitializeNewInstance("java.io.File",Array(FilePath)) tFile.RunMethod("deleteOnExit",Null) End Sub Usage example: B4X: Expand Collapse Copy RequestDeleteOnExit(File.Combine(File.DirApp,"dialogclose.css")) Hope it helps.