0
I can't save my notepad ++ in the program files it only let's me save to documents. can i do it from there
9 Respostas
+ 2
If I got you correct, you just wrote some java code, saved it to "C:\", then going to compile it with cmd, but gets the exception "Access is denied".
This happens because cmd is probably not run as admin. The C:\ directory is global for all users, which means Windows made it possible only for applications with admin permission to write files there.
You can fix this with two simple options:
1. Run cmd as admin.
2. Move the .java file to documents folder, then compile it there.
(The documents folder is a local user folder, which doesn't require admin for everything).
I hope this was useful information, and I hope it works!
+ 1
If you can't save to program files, you have to run the application as admin, to ensure the application have the sufficient permissions to write to that directory. In your case, its Notepad++.
To do so, simply locate the file where its stored, and right click it, run as admin. You can also right click it, then properties, and in one of the tabs there should be an checkbox named for 'run as admin'.
If this doesn't work, please reply and I will explain in more detail (If not anyone else already have). However, I advise saving them to documents folder, as program files are mainly used for installed software.
I hope this helped, and good luck!
~Frekvens1
+ 1
Thank you, that did solve my saving problem!
+ 1
I am very happy you got it working! If you get stuck in the future, remember to ask questions! (But after some searching on google 😉)
0
now I keep getting
ExampleProgram.class (Access is denied)
public class ExampleProgram{
1 error
that's not also an access issue is it? just got something in my code wrong?
0
If you're trying to run your program (and it does file handling), make sure it also runs with admin permissions.
If its still Notepad++, and is running as admin, you may have to choose another directory.
When do you get this error?
When you open the file, save, run?
And what is the file path?
Also, is the file already in use by another program?
0
I get it when I type in the command prompt
javac ExampleProgram.java
it also says error while writing ExampleProgram.
It shouldn't be in use I close everything before using the command prompt.
The file is saved right under my c:\
so I type cd / into the command prompt to get it to say c:\>
then I type javac ExampleProgram.java
0
We're getting closer haha, I moved my. java file to a test folder then typed in
C:\>Test>javac ExampleProgram.java
and just received access denied
so I tried running it as admin and same code but then it doesn't recognize the command 😣
Thank you so much for all your help by the way. I believe I would struggle less if there were images but alas...
0
I just got it! Well I guess I did get it a bit ago but didn't realize that I was doing it right and needed to move on to the next step.
Again thank you!