-1

I have created an application in swing also created an installer for the same application.

both installer and the application run perfectly on windows system.

but my problem is when i try to run it in mac os it is not run perfectly with all data.

I have found that in my application i have used ".xyz" type property files and directory to save some data, so in mac os "." prepended serve as hidden file.

it gives error like

Error: /Users/userxyz/Library/Application Support/.appdir/.propertydir/.logininfo (Permission denied)

java.io.IOException: Permission denied
    at java.io.UnixFileSystem.createFileExclusively(Native Method)
    at java.io.File.createNewFile(File.java:883)

Is there any one who have solution to resolve above error?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Tejas
  • 43
  • 1
  • 7
  • You should probably read up about how file permissions in an OS work. – Brian Roach Jan 09 '13 at 06:35
  • @AndrewThompson it is require to create installer for to give some information also create some directories and files in user's home directory before starting the application using some installer tools. – Tejas Jan 09 '13 at 06:54
  • 1
    Then [JWS](http://stackoverflow.com/tags/java-web-start/info) is fine for this. Here is a [demo. of the JWS `ExtensionInstallerService`](http://pscode.org/jws/api.html#eis), *"The intent of the installer is to do any application set-up/pull-down that can not be handled by the standard JWS behaviour of caching the classes/resources at 1st launch, and clearing them at uninstall."* – Andrew Thompson Jan 09 '13 at 06:58
  • 1
    I want solution to resolve the error because all the things going correct in window but the problem is in mac os. – Tejas Jan 09 '13 at 07:11
  • 1
    As @AndrewThompson suggests, you should give [tag:javawebstart] a serious look; beyond that, I've cited some guidelines [here](http://stackoverflow.com/a/14233171/230513). – trashgod Jan 09 '13 at 10:32

1 Answers1

4

The problem is in Mac OS.

No, the problem is not having permission to write to the Library directory of userxyz. Java WebStart is usually more than sufficient, but you should at least follow the approach recommended in Technical Q&A QA1170: Important Java Directories on Mac OS X. Note the distinction between user preferences, user data and application support, each of which is rooted in System.getProperty("user.home"). Note also that, java.util.Preferences uses ~/Library/Preferences/your.qualified.name by default. In addition, there's no reason to use hidden file names.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045