So I have a program that runs something like the following
public class SHandler extends Handler {
File lmpFile;
Down later in the program:
lmpFile = new File("Stuff.zip"); // This should create a file called "stuff.zip" in the present directory
OutputStream fos = new FileOutputStream(lmpFile); // Fill the file with whatever
Then from my main I call
S.SHandler SpecialSH = new S.SHandler(args);
//use the object for whatever
SpecialSH.delFile();
Delfile is made like this and is a method inside the class:
public void delFile() {
lmpFile.deleteOnExit();
lmpXMLFile.deleteOnExit();
}
To my knowledge this program works right on my local machine (Windows 7 Enterprise), however on our development box when I run this it's tossing a LOT of files that the program pulls all over the place. The execution path is /usr/data/dev/Handler and it's putting "stuff.zip" (and the files extracted from it) in /etc/cron.d and despite trying to remove them I am unable to.
Note This program is being called via a bash script which is invoked by a cron job on a machine running RHEL6. Anyone able to help this would get my undying love and appreciation.
Edit: The bash script is simply:
export JAVA_HOME=/usr/data/java/current
export PATH=$JAVA_HOME/bin:$PATH
/usr/data/java/current/bin/java -jar /usr/data/dev/Handler/Handler.jar
Tl;DR: File runs fine on windows, when RHEL6 calls a cron, files end up where they shouldn't. How can I make my program handle this?