Looking for a place to store temporary .class files on Windows (some similar app support on Mac) [duplicate]

StackOverflow https://stackoverflow.com/questions/2023364

Question

Possible Duplicate:
Storing a file in the user’s directory in cross-platform Java

I am working on a java project and the java application ends up making some .class files. Currently, these files are stored inside a projects directory inside the main application directory. Some people who run the application on a network with a certain version of Novel security software experience issues sometimes when these .class files are created or modified. I would like to instead always store these files locally but I am unsure of where to store them on the PC version. On the Mac I think I will store them in application support but I do not know of a similar place on the PC. Also, it would be best if there was a location that would be good for XP Vista and 7 but if I had to have specific locations for each OS that would be sufficient as well.

Was it helpful?

Solution

Use the %AppData% environment variable? I suppose you'd just need to add it to CLASSPATH...

OTHER TIPS

If the app is generating these at runtime, and you don't need them permanently you could also store them in the temp directory. You can access the temp directory in a platform independent way in Java via the system property: System.getProperty("java.io.tmpdir").

You could look for the "user" directory. In that directory, there's an "appData" directory.

On Vista, it's "C:\Users\Username\AppData".

On XP, i don't quite remember the name. But These are special folders for Windows so I'm sure you can specify one name and go to it directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top