aspose file tools*
The moose likes Beginning Java and the fly likes Compile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compile "MooseGreetings.java"  Access Denied" Watch "Compile "MooseGreetings.java"  Access Denied" New topic
Author

Compile "MooseGreetings.java" Access Denied

Chad Kusuno
Greenhorn

Joined: Nov 17, 2010
Posts: 8
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

Joined: Nov 24, 2005
Posts: 14687
    
  16

Do you have writing access to that directory ? Make sure it is not read-only.


[My Blog]
All roads lead to JavaRanch
Chad Kusuno
Greenhorn

Joined: Nov 17, 2010
Posts: 8
That did it. Thank you.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Nov 17, 2010
Posts: 8
Thanks for the advice, bartender. Cheers.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38873
    
  23
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

Joined: Oct 28, 2011
Posts: 1
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

Joined: Aug 16, 2005
Posts: 14153
    
  18

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38873
    
  23
Welcome to the Ranch
Have look at the advice I often give about folder.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compile "MooseGreetings.java" Access Denied