Botania | magic themed tech mod for Minecraft | Video Game library
kandi X-RAY | Botania Summary
kandi X-RAY | Botania Summary
Welcome to the Botania repository. Botania is a Minecraft tech mod themed around natural magic. It's inspired by other magic mods, such as Thaumcraft or Blood Magic. The current iteration of Botania is made possible thanks to the massive help by the part of williewillus, who ported the mod from 1.8 through to the present day, so go buy him a beer or something, I dunno, he's pretty cool. Botania is licensed under the Botania License.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Botania
Botania Key Features
Botania Examples and Code Snippets
Community Discussions
Trending Discussions on Botania
QUESTION
I am currently busy with building a simple javafx application. In this application, you can add and remove .jar files from within the application, from which I am gathering some information. One of the things I use from these .jar files are textures stored as images.
Whenever I load an Image using a path from the jar file, I am unable to remove this .jar file later on. This is quite logical as the .jar file is now being used by this Image, but for some reason, I am unable to delete the .jar file from within the application even when removing all references to this Image and calling the garbage collector.
The way I am currently trying to delete the file is the following:
...ANSWER
Answered 2020-Jul-21 at 14:18I can't reproduce the issue on my system (Java 14 on Mac OS X); however running it on Windows 10 with the same JDK/JavaFX versions produces the exception you describe.
The issue appears to be (see https://stackoverflow.com/a/54777849/2067492, and hat-tip to @matt for digging that out) that by default the URL handler for a jar:
URL caches access to the underlying JarFile
object (and doesn't call close()
, even if an InputStream
obtained from it is closed). Since Windows holds on to file handles in those situations, the underlying OS is unable to delete the jar file.
I think the most natural way to address this is to use the java.util.jar
API (or just the plain java.util.zip
API), which will give you far more control over closing resources than generating a URL and passing the URL to the Image
constructor.
Here's a self-contained example using this approach, which works both on my Mac and on my Windows 10 virtual VM:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Botania
You can use Botania like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the Botania component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page