Supereme
Supereme

Reputation: 2409

How to disable 'renaming' a file in java?

Is there any way in java by which we can disable renaming a specific file( for eg. MS-Excel file)just as we can hide it.

Upvotes: 1

Views: 391

Answers (2)

Igor Artamonov
Igor Artamonov

Reputation: 35951

You can do it by setting access rights to a file (ex. chmod under unix), but only using OS commands, executing it with Runtime.exec()

Upvotes: 4

polygenelubricants
polygenelubricants

Reputation: 383786

Disabling renaming of files would be something that the operating system/file system would have to enforce. It's not something that a Java application would have the honor/privilege of doing.

Also, I'm not sure what you mean by "just as we can hide it". Currently, Java can NOT hide a file (see: bug# 4267530).

Upvotes: 4

Related Questions