For Programmers: Free Programming Magazines  


Home > Archive > Java Help > January 2006 > compile -- permission denied









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author compile -- permission denied
Jonie

2006-01-25, 4:14 am

Hi all,
I was trying to compile my java files and got the message below. I
didn't understand the message, "Permission denied", but I just tried
again as a root. Then, I was able to compile.

I'd like to understand why this happens.
I am using Java 1.5 and Fedora core 4.

-------------------------------------------------
[jonghook@localhost Research]$ javac Main.java
Main.java:18: error while writing Main: Main.class (Permission denied)
public class Main {
^
1 error
[jonghook@localhost Research]$ sudo javac Main.java
Password:
[jonghook@localhost Research]$
----------------------------------------------------

Chris Smith

2006-01-25, 4:14 am

Jonie <kimfinale@gmail.com> wrote:
> Hi all,
> I was trying to compile my java files and got the message below. I
> didn't understand the message, "Permission denied", but I just tried
> again as a root. Then, I was able to compile.


You don't have permission to create files in that directory. You need
to either change the permissions (using chmod as root) or put the result
of the compiler elsewhere (using the -d option to javac).

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Roedy Green

2006-01-25, 4:14 am

On Tue, 24 Jan 2006 23:13:02 -0700, Chris Smith <cdsmith@twu.net>
wrote, quoted or indirectly quoted someone who said :

>You don't have permission to create files in that directory. You need
>to either change the permissions (using chmod as root) or put the result
>of the compiler elsewhere (using the -d option to javac).


I don't use that feature often, but could it be that the directory
where the target class files were directed to does not yet exist?
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Oliver Wong

2006-01-25, 7:16 pm


"Jonie" <kimfinale@gmail.com> wrote in message
news:1138168204.151208.101830@g47g2000cwa.googlegroups.com...
> Hi all,
> I was trying to compile my java files and got the message below. I
> didn't understand the message, "Permission denied", but I just tried
> again as a root. Then, I was able to compile.
>
> I'd like to understand why this happens.
> I am using Java 1.5 and Fedora core 4.
>
> -------------------------------------------------
> [jonghook@localhost Research]$ javac Main.java
> Main.java:18: error while writing Main: Main.class (Permission denied)
> public class Main {
> ^
> 1 error
> [jonghook@localhost Research]$ sudo javac Main.java
> Password:
> [jonghook@localhost Research]$
> ----------------------------------------------------
>


The "error while writing" + "(Permission denied)" bits seem to indicate
that you don't have permission to write to the target file. If the file
already exists, check that you are the owner, and/or that you have write
permission on it. Otherwise, check that you are the owner of the current
directory and/or you have permission to create new files in it.

- Oliver


Jonie

2006-01-25, 9:59 pm

Thank you. You're exactly right. I already had compiled files and
those were compiled as a root. So I deleted all those files and
compiled again as a user. In that way, I was able to run the program.

Thank you very much, everyone.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com