Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 794453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:18:55+00:00 2026-05-14T22:18:55+00:00

Can I do this on Java? I’m using windows…

  • 0

Can I do this on Java? I’m using windows…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:18:55+00:00Added an answer on May 14, 2026 at 10:18 pm

    http://java.sun.com/j2se/1.6.0/docs/api/java/io/File.html#setReadOnly%28%29

    File file = new File("foo.bar");
    if(file.setReadOnly()) {
        System.out.println("Successful");
    }
    else {
        System.out.println("All aboard the fail train.");
    }
    

    Before Java6, you could not undo this. To get around this, they put in File.setWritable(boolean) which can be used as so

    File file = new File("foo.bar");
    if(file.setWritable(false)) {
        System.out.println("Successful");
    }
    else {
        System.out.println("All aboard the fail train.");
    }
    
    if(file.setWritable(true)) {
        System.out.println("Re-enabled writing");
    }
    else {
        System.out.println("Failed to re-enable writing on file.");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i put this string in to a cell using java apache poi?
In windows I can use this command: java -cp server.jar;mysql.jar server.NithServer But in linux
I have weblogic where I can deploy this java application and database where I
Can you explain to me the output of this Java code? int a=5,i; i=++a
OK - I know I can run my java process like this : java
in java we can do this: public class A{ public static void main(String...str){ B
I can use this maven plugin maven-jaxb-plugin to generate Java Classes from XSD file.
Goetz's Java Concurrency in Practice , page 41, mentions how this reference can escape
In C# and Java a byte array can be created like this byte[] b
In Java you can wait on every object, so this kind of scenario is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.