aspose file tools*
The moose likes Beginning Java and the fly likes Comilation Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Comilation Problem" Watch "Comilation Problem" New topic
Author

Comilation Problem

satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Hi all,
I have a very small problem. I have 2 classes as follows

How can i solve this.

(Marilyn added code tags)
[ July 04, 2004: Message edited by: Marilyn de Queiroz ]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9052
    
  12
Are A.class and B.class in the same directory? Is that directory in your classpath?


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Vi David
Greenhorn

Joined: Mar 13, 2004
Posts: 1
public class A{
public static void main(String args[]){
System.out.println("hello");
B obj = new B();
obj.method();
}
}
class B{
public void method(){
System.out.println("Inside this method");
}
}
Jos� Alberto Mu�iz Navarro
Ranch Hand

Joined: Oct 27, 2003
Posts: 33
Not really a solution but a workaround Have you tried not making B public and typing it in the same file as the other one? I know that would solve it, but it would depend on how you want to access B
Gary Down
Ranch Hand

Joined: Apr 09, 2004
Posts: 46
have you compiled the 'B'?

when you comple "a" it will need "b" to be compled already.

Just a thought.
Gary.
satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Both these files are in same directory. And i want these files in two different files as A.java and B.java
I believe classpath setting i have done.
satya sahu
Ranch Hand

Joined: Mar 26, 2003
Posts: 97
Yes i have compiled the B.java file before compiling A.java file. After that this error has occurerd. If possible please try compiling these two files.
Jeff Pavlocak
Greenhorn

Joined: Apr 26, 2004
Posts: 16
satya,

Your code looked good to me, so I copied your code from the top thread and compiled it. The code compiled fine and ran fine.

Double check that your code matches exactly what is in the thread and you should be good. Or better yet, do what I did and copy it from the thread and paste it into your text editor.

Remember Java is case sensitive.

Also, you don't need to compile the B.java file before the A.java file. The compiler will take care of that for you.

Good luck,

Jeff Pavlocak
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Comilation Problem