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 compile multiple class files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "compile multiple class files" Watch "compile multiple class files" New topic

compile multiple class files

mark babcock

Joined: Jun 26, 2002
Posts: 14
I'm trying to compile my class files. I have two classes. when I compile them i get the following error:
c:\java\test\src>javac cannot resolve symbol
symbol : variable Test
location : class MyTest
String t = Test.gethelp();
1 error
Here is my code:
public class Test
public String gethelp()
String test = "time";
return test;
public class MyTest
public static void main(String[] args)
String t = Test.gethelp();
System.out.println("THe word is " + t);
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
That's odd. The javac compiler should look for such class dependencies automatically. Since it isn't, you should simply compile first, then compile You can even do this all with one command:

Java API Documentation
The Java Tutorial
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
getHelp is not a static method of Test so you can't execute it the way you are trying to.
Do this:
Test test = new Test();
String t = test.getHelp();

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
I agree. Here's the link:
subject: compile multiple class files
It's not a secret anymore!