File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "a simple question, but......" Watch "a simple question, but......" New topic
Author

a simple question, but......

Arul Jose
Ranch Hand

Joined: Jan 14, 2005
Posts: 131


here is file1.java

public class file1{
public static int i=5;
}


here is file2.java

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 file1.java first. it got compiled. then i compiled file2.java. i get the following message.

C:\Documents and Settings\Aruljose\Desktop>javac file1.java

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

please answer if you can

jose.



David O'Meara
Rancher

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
Greenhorn

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: http://aspose.com/file-tools
 
subject: a simple question, but......