views:

465

answers:

2
C:\Program Files (x86)\Java\jdk1.6.0_17\bin>javac VendingMachine.java
VendingMachine.java:27: error while writing VendingMachine: VendingMachine.class
 (Access is denied)
public class VendingMachine
       ^
1 error

Here is the code from my editior from line 27 to 39:

public class VendingMachine /*This is line 27*/
{
   private int itemPrice;

   private int currentBalance;

   private int totalCollected;

   public VendingMachine(int itemCost)
   {
       itemPrice = itemCost;

   } /*line 39*/

I am thinking my problem might be related to Win7 Prof: (Access is denied)

How do I resolve this or what do I need to be doing or reading to get this to work?

Thank you for not flaming.

I just changed the folder options such that I am the given full (Access...), now I just have to figure out why I am not getting any output, when running javac VendingMachine.java I guess a new question is in order.

+4  A: 

Your working directory is C:\Program Files (x86)\Java\jdk1.6.0_17\bin. You are not allowed to write files here. Copy your java files to a different directory and try to compile them there.

edit:

You should include C:\Program Files (x86)\Java\jdk1.6.0_17\bin to your PATH environment variable. And set JAVA_PATH to C:\Program Files (x86)\Java\jdk1.6.0_17.

set JAVA_PATH="C:\Program Files (x86)\Java\jdk1.6.0_17"
set PATH=%PATH%;"C:\Program Files (x86)\Java\jdk1.6.0_17\bin"

After that, you can call javac from where ever you like.

tangens
I can only run javac from \bin directory, javac outside of bin directory will not be recognized.
Newb
Add the JDK bin directory to your path or use the fully qualified path, such as: `PATH="C:\Program Files (x86)\Java\jdk1.6.0_17\bin";%PATH%`
Kevin Brock
That's so wicked cool, dude you are a code ninja, that rocks:set JAVA_PATH="C:\Program Files (x86)\Java\jdk1.6.0_17"set PATH=%PATH%;"C:\Program Files (x86)\Java\jdk1.6.0_17\bin"
Newb
A: 

You don't have write access in C:\Program Files (x86). Put your sources elsewhere.

Jerome