-1

I am using JDK 1.6.0.25 with windows 7 64 bit OS and I have an stand alone application in java.After installing if I open application it creates logs folder and applogs.log file in build directory.
When I install it in "c\program files\" or "c\program files (X86)\" directory and If I open application it does not creates logs folder and applogs.log file.To create logs I have simple used "io api" of java.

I have searched a lot regarding this issue and found that there is no permission to write in c\program files\ or c\program files (X86)\

sol 1: by change the security option of folder to change the permission.
sol 2: by using java 7 and use method setPosixFilePermissions() to change the permission.

I don't want to use above both solution because there is some dependency. I have one more application and having logging facility by using log4j api.I found that it creates log files in above conditions. Please give me some some solution other than above solution or how it creates by log4j api.

RockStar
  • 37
  • 5

1 Answers1

0

You should use the user's home directory for something like that. The simplest approach is to read the Java System property user.home

System.getProperty("user.home")

How to get local application data folder in Java?

Community
  • 1
  • 1
Benjamin
  • 544
  • 5
  • 21
  • Thanx for reply Benjamin. But I don't have any problem to create logs file in user home directory or other places. My requirement is just to install in c\program files or c\programs files (X86) and after launching application it should create logs file in that installed directory. – Balram Maurya Jan 16 '14 at 12:19