A
A
Alexey2014-06-13 12:18:44
Java
Alexey, 2014-06-13 12:18:44

Why does it always give an error when compiling a java application?

This is the output when compiling on the command line:
Hello.java:1: error: error while writing Hello: Hello.class
public class Hello {
^
1 error
Here is the program code itself:
public class Hello {
public static void main(String[] args) {
System.out.println("HelloWorld!");
}
}
It seems like everything is simple. On the Internet they write that most likely there is no access due to win7. But even if so, how to open access and why?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Space Owl, 2019-03-25
@fartus

I solved it by getting admin rights

I
IceJOKER, 2014-06-13
@IceJOKER

I'm not an expert, but maybe there is an "invisible character", the same BOM mark, try resaving the file in utf8-8 without BOM

J
javanub, 2014-06-13
@javanub

jdk found? Are the paths correct? Recheck.

V
Vladimir Smirnov, 2014-06-16
@bobzer

Google did not look? Searching through the text of your error suggests that you probably saved the .java file in the Program Files folder (for example, in C:\Program Fiels\Java\jdk1.7.0\bin), in which Windows by default prohibits creation and modification files

L
LuciferSM, 2020-10-08
@LuciferSM

Move the file. For example, along the path C:\Users\Java\ .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question