Users Pricing

forum

home / developersection / forums / javac and java commands

javac and java commands

Royce Roy 2094 30 Apr 2015
I noticed something regarding the java command that I wanted to ask about. I created a temp folder on the root of C:\ then I created two more folders called packagea and packageb. In those folders were java files called ClassA and ClassB respectively. I compiled them by running javac packagea/ClassA.java packageb/ClassB.java 

So then I tested to make sure it worked by running java packageb.Classb - which is where I coded the main method - and it worked. OK, good so far. 

But then.. 

I changed my working directory to C:\temp\packageb and then attempted to run java ClassB and that does not work. I get: 

Error: Could not find or load main class ClassB 

Could anyone explain what is happening here?

Royce Roy

Other


1 Answers

Anonymous User 30 Apr 2015 Accepted Answer