• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compile "MooseGreetings.java" Access Denied

 
Chad Kusuno
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to compile my first program. I get Access Denied. Here's what I've got:

C:\Program Files\Java\src>javac MooseGreetings.java
MooseGreetings.java:1: error while writing MooseGreetings: MooseGreetings.class
(Access is denied)
public class MooseGreetings {
1 error

Thanks in advance for the help!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have writing access to that directory ? Make sure it is not read-only.
 
Chad Kusuno
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That did it. Thank you.
 
Paul Clapham
Sheriff
Posts: 20980
31
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Windows 7? That was a suggestion from the operating system to not store your data files under the "Program Files" directory. You really ought to take that hint.
 
Chad Kusuno
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advice, bartender. Cheers.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chad Kusuno wrote:Thanks for the advice, bartender. Cheers.
Have you taken that advice and disabled write access to that directory? What you ought to do is immediately after opening the command prompt, create a directory(or similar), and, next time, you reach that directory with
 
Dileep Majeti
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chad Kusuno wrote:Trying to compile my first program. I get Access Denied. Here's what I've got:

C:\Program Files\Java\src>javac MooseGreetings.java
MooseGreetings.java:1: error while writing MooseGreetings: MooseGreetings.class
(Access is denied)
public class MooseGreetings {
1 error

Thanks in advance for the help!



Me too faced the same problem but just saved the .java file in the path where I had full access of writing new files(eg: e:\java\src the other partition in hard disk). The PATH environmental variable should be created.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15216
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that you are not supposed to be saving your own data files anywhere under C:\Program Files.

C:\Program Files is a protected directory under Windows 7.

Save your source files somewhere else, not under C:\Program Files.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
Have look at the advice I often give about folder.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic