File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes compilation problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compilation problems" Watch "compilation problems" New topic

compilation problems

ven kumar

Joined: May 27, 2003
Posts: 3
I'm having some troubles compiling java source files from command prompt.
I have and in package app. So, I created a directory named "app", put "" and "" in that directory. is a simple java program with one method (method2) to print some message on the console when executed. I'm trying to access method 2 of Class2 from Class1. When I try to compile it, it is giving me compilation errors that "Can not resolve symbol Class2". Any help is appreciated.
Susilo Saja
Ranch Hand

Joined: May 27, 2003
Posts: 91
It mean the jvm can't find class2
have you put "app" directory in the CLASSPATH? or have you define the package name for class1 & class2?
Dhamodharan Krishnan

Joined: Nov 07, 2001
Posts: 23
Hi Ven Kumar,
From the info that you have given, let me guess that your classes are like this
package app;
public class Class1
Class2 c2;

public Class1()
c2 = new Class2();
public static void main()
Class1 c1 = new Class1();
package app;
public class Class2
public Class2
public void method2()
System.out.println("I am method2 speaking!");
Both these classes are in app directory.
Let me assume that you have the Java files in
D:\Dev\app folder
Please go to D:\Dev folder
From D:\Dev, try compiling Class2 first.
Then compile Class1
Then run Class2.
It should work fine.

Dhamodharan Krishnan,<br />Sun Microsystems, Bangalore<br />Direct : 91-80-4184 7247<br />Cell : 91-99 80 147 600
I agree. Here's the link:
subject: compilation problems
jQuery in Action, 3rd edition