Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Forcibly closing files?  (Read 887 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Posted 2006-12-04 03:20:35 »

I am currenting making batch utility to test different combinations of java optimisers for my J4k entry this year.

The utilitiy calls the main(...) methods of other the optmising utilities. Each of these utilties produces a file as output.

It seems that some of these utilities do not release their handle to the file so i cannot delete these files at the end of the batch run.

How can I either forcibly delete the file even if there are still handles to it or "de-initalize" static references to the files internally to these utilities?

I do not have access to the source code of the utilities.

Or is there an other way to remove these files?

I think if i created a new runtime for each utilitiy i should beable to delete the files, however this would dramatically increase processing time.


My batch utility is working well thus far and has been able to compress the Jar used for Markus_Persson's entry l4krits  (http://www.java-gaming.org/forums/index.php?topic=15453.0) from 4,027 bytes to 3,783 bytes

I plan to release the utiltiy once it is in a more usable state.
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #1 - Posted 2006-12-04 04:13:48 »

If you're providing the original file handle, you could create it as a temporary file, and ask java to automatically delete it when the JVM exits. Have a rummage around in File.*

But I suspect you're not Sad

malloc will be first against the wall when the revolution comes...
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #2 - Posted 2006-12-04 04:20:56 »

I have been fiddling around with File.deleteOnExit()

It seems to work with most of the files appart from a directory and the file inside this directory... I am still trying different options.

It is not the idea solution but it does show the most promise.

Cheers
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #3 - Posted 2006-12-04 05:57:40 »

It seems that the deleteOnClose did not have an effect after all Sad

I have isolated the utilites which hold on to a file reference. I am now calling these utilies in thier own VM. The performance hit is within acceptable parameters so I think i will keep this solution.

Thanks for your help!

Offline Eliwood

Junior Member




Stencyl


« Reply #4 - Posted 2006-12-04 06:04:09 »

If you're providing the original file handle, you could create it as a temporary file, and ask java to automatically delete it when the JVM exits. Have a rummage around in File.*

But I suspect you're not Sad

This sounds interesting, but what happens if the JVM crashes or is forcibly ended by the user? Does it still delete the file?

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (20 views)
2014-09-24 16:12:06

Grunnt (45 views)
2014-09-23 14:38:19

radar3301 (28 views)
2014-09-21 23:33:17

BurntPizza (63 views)
2014-09-21 02:42:18

BurntPizza (33 views)
2014-09-21 01:30:30

moogie (41 views)
2014-09-21 00:26:15

UprightPath (50 views)
2014-09-20 20:14:06

BurntPizza (54 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!