Reputation: 1904
No matter what edits I make, I keep getting this output;
C:\Program Files\Java\jdk1.7.0_67\bin>javac JavaVersionDisplayApplet.java
JavaVersionDisplayApplet.java:4: error: error while writing JavaVersionDisplayAp
plet: JavaVersionDisplayApplet.class (Access is denied)
public class JavaVersionDisplayApplet extends Applet {
^
1 error
The code I'm using is for a JavaCheckVersion;
import java.applet.*;
import java.awt.*;
public class JavaVersionDisplayApplet extends Applet {
private Label m_labVersionVendor;
public JavaVersionDisplayApplet() {
Color colFrameBackground = Color.white;
this.setBackground(colFrameBackground);
m_labVersionVendor = new Label (" You are running Java Version: " +
System.getProperty("java.version") +
" from " +
System.getProperty("java.vendor"));
this.add(m_labVersionVendor);
}
}
Does anyone see anything wrong here?
Upvotes: 0
Views: 3954
Reputation: 1904
Ran CMD as admin, & moved the Java file to /Desktop/Java/ and was successful. Thanks everyone for helping me resolve this!
Upvotes: 0
Reputation: 34628
The problem is not related to your code, but rather to the fact that you are trying to compile it while your current directory is C:\Program Files\Java\jdk1.7.0_67\bin
. You probably don't have writing permissions in that directory. Since the action of compiling a class creates a .class
file, the compiler cannot complete the compilation.
Change directory to some place where you are allowed to write, and compile again.
Upvotes: 1