#1
so i just started learning java and I java been reading alot so far and now i have just wrote the standard helloworld program.

I am having a problem compiling it though so maybe you guys can help cause i have tried the only thing i can think of the fix the error but it wont go away.here is the error


"HelloWorld.java:6: error: error while writing HelloWorld: HelloWorld.class <Access is denied>
public class HelloWorld {
^

1 error"


here is the code:

/*
HelloWorld.java
this program prints out hello world to the console
*/

public class HelloWorld {


public static void main(String[] args)
{

System.out.println("Hello World");
}

}
Last edited by brender at Mar 7, 2012,
#2
Are you using Dr. Java?

If so, then reset your compiler.

Also, this thread will help you out with programming.
ggg1 ggg3

.
#3
i am wrote it in notepad++ and i am using javac to compile

also thanks for the link.I have been on this site for 7 years now and i dont think i have ever seen that thread

Edit: lol just looked at the date of when the thread was made.guess i havent seen it because it hasn't been up long
Last edited by brender at Mar 7, 2012,
#4
Your compiler does not have permission to access the .java file.

Where is your HelloWord.java file saved on your computer?
ggg1 ggg3

.
#7
Quote by brender
i have it saved in the same folder that i have all the jdk files in
So, I'm guessing it's saved in C:\Program files\jdk ? (Or something along those lines?)

If so, then that's the problem. The compiler isn't allowed to access files there. Save your .java file in another location (ie Desktop, My Documents, etc.)
ggg1 ggg3

.
#11
Quote by brender
yes i am using the command prompt and i am using windows 7
Download a program called Dr. Java

It'll make coding a lot easier in java.
ggg1 ggg3

.
#16
Get Linux.

But seriously, through the terminal, navigate so that your active working directory is whatever directory your HelloWorld.java file is saved in. Then, call javac HelloWorld.java. It should work.

In conclusion, get Linux.
WILDCARD, BITCHES!!

Call me Patrick! My username sucks anyway
#17
my helloworld.java is in a seperate folder than javac.in the command prompt i am in the directory of my helloworld.java file.In the command pompt i type "javac HelloWorld.java" and it give me this: "javac is not recognized as a internal or external command,operational program or batchfile."
#21
Quote by Godsmack_IV
^^^what is this and why doesn't anyone use eclipse???


i vote eclipse as well, it has a plugin for everything!
Quote by archerygenious
Jesus Christ since when is the Pit a ****ing courtroom...

Like melodic, black, death, symphonic, and/or avant-garde metal? Want to collaborate? Message me!
#22
Eclipse is slow and buggy, or it was the last I used it in 06/07. Maybe it's better now? It used to be the hoggiest of memory hogs because it had memory leaks all over the place. Used to be a piece of shit...
Quote by denizenz
I'll logic you right in the thyroid.

Art & Lutherie
#23
I use eclipse for big projects, but honestly, there's nothing quite like the simplicity of just writing up a script or something in Emacs. Nobody should EVER use Notepad though, that's just a cardinal sin punishable by programmer hell.
WILDCARD, BITCHES!!

Call me Patrick! My username sucks anyway
#24
And TS, just take this question to Stack Overflow. Sounds like you really fucked up when you installed JDK, and I can't be assed to figure out why
WILDCARD, BITCHES!!

Call me Patrick! My username sucks anyway
#25
1. set the environment variables
2. save in my documents
3. go in cmd to your documents, and javac file


btw I wouldn't recommend a begginer to use a IDE, they make you lazy, and could be overwhelming. By starting in pure code you get atleast an idea about how stuff works
#26
^This, too. It gives you a better understanding and appreciation for what you're doing if you do the grunt work yourself, at least at first.
WILDCARD, BITCHES!!

Call me Patrick! My username sucks anyway
#27
ok i am going to reinstall the jdk an setup everything again hopefully that works.thanks everyone for the help
#29
I remember when i used to code
Good times good times
Quote by kaptkegan
Don't think I've ever been sigged.


I pretty much never leave the drug thread anymore.
#30
SUCCESS! I reinstalled java jdk.reset my path the javac and now everything works.