dlc
dlc

Reputation: 57

Transferring source code from one pc to another

My development PC was having hardware problems, so I copied my source program code (Netbeans java) and loaded it into a backup laptop. When my desktop pc failed, I went to my backup laptop, to recreate my project. Everything worked basically except the source code I copied did not have some library modules as well as some other unknown modules. I got one program to work by loading the required library module in Netbeans, however one of the other programs is failing with the following error:

 java.io.FileNotFoundException: C:\aaageing.txt (Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
    at my.TTjav.TTjavAgeing.main(TTjavAgeing.java:34)

 Exception in thread "main" java.lang.NullPointerException
    at java.io.Writer.<init>(Writer.java:88)
    at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:109)
    at java.io.PrintWriter.<init>(PrintWriter.java:148)
    at java.io.PrintWriter.<init>(PrintWriter.java:131)
    at my.TTjav.TTjavAgeing.main(TTjavAgeing.java:38)

and I'm not sure which library modules or?? I need.

I am using the following:

File outFile = new File("C:\\aaageing.txt");
FileOutputStream outFileStream = null;
        try {
            outFileStream = new FileOutputStream(outFile);
        } catch (FileNotFoundException ex) {
            Logger.getLogger(TTjavAgeing.class.getName()).log(Level.SEVERE,        null, ex);
        }
PrintWriter  outStream = new PrintWriter(outFileStream);

Upvotes: 1

Views: 315

Answers (3)

SkyWalker
SkyWalker

Reputation: 29150

As you are getting "Access is denied", then you need to give permission.

To change ownership,

  1. Right-click on file aaageing.txt in C drive,
  2. Then select Properties, and go to Security tab.
  3. Now click the Advanced button(shown in the link).
  4. Next, you need to go to Owner tab and hit the Edit button.
  5. Then in the new dialog window choose the new owner and then click OK.

http://www.addictivetips.com/windows-tips/windows-7-access-denied-permission-ownership/

After that it will run smoothly.

Upvotes: 2

user3484569
user3484569

Reputation: 81

check the file C:\aaageing.txt if exists run like administrator or change permission of the file

Upvotes: 2

Grzegorz Piwowarek
Grzegorz Piwowarek

Reputation: 13793

Your stacktrace is telling you everything you are asking about.

java.io.FileNotFoundException: C:\aaageing.txt (Access is denied)

It seems like you do not have required access rights to get to that file. Try running as an administrator.

Upvotes: 1

Related Questions