This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes java files in same dir. but one can't call other Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java files in same dir. but one can Watch "java files in same dir. but one can New topic
Author

java files in same dir. but one can't call other

pravinth Ganesan
Greenhorn

Joined: Oct 23, 2005
Posts: 13
Hai Friends,
I have my java files in a MyJava folder. i set the path by
c:\MyJava>path=.;c:/program files/java/jdk1.5.0/bin/
I can able to compile and run single-stand alone java files in MyJava folder. But whenever i am trying to compile a java files which is also in MyJava folder but which uses/(has code) other java class files in the same folder i am getting compile error - means it can't able to refer the other java class files,which are also in the same MyJava folder.Plz help me.
Thank You!


Have a nice day
Nicolas Stern
Ranch Hand

Joined: Apr 26, 2002
Posts: 57
Hi,

You must also set the Classpath to the folder in which your classes are stored.

HTH - Cheers - Nic
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
If you don't set the CLASSPATH environment variable, you can always supply a classpath on the command line for javac and java:

>javac -classpath . MyClass.java
>java -classpath . MyClass

I know you are just starting in Java, but if you understand a little about XML, using Ant as a build tool will be a big help. Eventually most people end up using IDEs, but its still good to be able to use Ant.


There is no emoticon for what I am feeling!
pravinth Ganesan
Greenhorn

Joined: Oct 23, 2005
Posts: 13
Thank You Friends.
Now its working after setting the classpath.
Thank You guys. Thanks for your help!

Note:I am not new to java!
i forgot about this classpath.
[ February 17, 2006: Message edited by: pravinth Ganesan ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java files in same dir. but one can't call other
 
Similar Threads
import & package
Importing Packages & Classpath
Please Help !!! (package and accessibility)
Getting Started
How to compile a java file from anyother folder