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 a simple question, but...... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "a simple question, but......" Watch "a simple question, but......" New topic

a simple question, but......

Arul Jose
Ranch Hand

Joined: Jan 14, 2005
Posts: 131

here is

public class file1{
public static int i=5;

here is

class file2{
public static void main(String args[])
System.out.println("value of i = "+file1.i);

both are in the same directory(folder). i compiled first. it got compiled. then i compiled i get the following message.

C:\Documents and Settings\Aruljose\Desktop>javac

C:\Documents and Settings\Aruljose\Desktop>javac cannot resolve symbol
symbol : variable file1
location: class file2
System.out.println("value of i = "+file1.i);
1 error

please answer if you can


David O'Meara

Joined: Mar 06, 2001
Posts: 13459

do you have the current dircetory in your classpath? The easiest way is make 'dot' the first entry on your classpath ie classpath=.;etc;etc2 (colons for *nix) Including the dot on the classpath is not always the best idea, but usually by the time it's a problem you know enough to manage.
Marco Davids II

Joined: Nov 02, 2004
Posts: 24
make sure that your classpath includes your current directory
by adding .; to your classpath variable
I agree. Here's the link:
subject: a simple question, but......
It's not a secret anymore!