Question

I'm doing a Windows Service in Java, this service list the files in a directory and write the results in a file. My problem is that when i call Java.File.isDirectory() when the service is running it always results false (It works well when i run the service manually as any other program). Besides, if i try the following: for(File F : directorio.listFiles()) trows an exception when i run the program as a service. I believe is permission related, because when i change the account in which the service is running to my own credentials it list the files correctly. Do you know if there is a workaround? (Change a windows policy, another kind of special account, another way to list the files of the directory, any other thing maybe i'm missing). Thanks in advance.

Was it helpful?

Solution 2

Thanks for all your help! I found my problem, i was reading the path from a configuration file which i assumed to be in the user's home (my home and System's home are not the same... my fault). Unfourtenly i didn't realize that because i was using a recycled class (:S). Again Thank you very much.

OTHER TIPS

Give the user the Java service is running under, the needed credentials to the folder in question.

I belive it runs as SYSTEM.

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