Compiling java program with multiple classes

For beginners, flames not allowed...(just by the staff :P)
Post Reply
User avatar
7A69
forum buddy
forum buddy
Posts: 24
Joined: 28 Dec 2008, 17:00
15

Compiling java program with multiple classes

Post by 7A69 »

I'm tired of googling so I decided to make my first thread encouraged by DNR's statement from introduction thread:"the only dumb question was the one not asked. " :lol:

So the problem is that if I have got it right I must define every class in it's own .java file but when I'm trying to compile class that uses other classes the compiler doesn't find the other classes which causes lots of bugs. So the question is how to point the locations of the other .java files for the compiler in linux with eclipse and javac.

In case that I have understood everything incorrectly just a guide or link to guide about how to use multiple classes would be nice.

User avatar
bad_brain
Site Owner
Site Owner
Posts: 11636
Joined: 06 Apr 2005, 16:00
19
Location: In your eye floaters.
Contact:

Post by bad_brain »

you have to set the path where Java looks for the classes, there are 2 ways of doing this, either with "java -cp path1; path2; etc." or by setting a systemwide environment variable named CLASSPATH.

take a look here:
http://java.sun.com/j2se/1.3/docs/toold ... spath.html

:wink:

User avatar
7A69
forum buddy
forum buddy
Posts: 24
Joined: 28 Dec 2008, 17:00
15

Post by 7A69 »

Thanks! Now I got everything working just fine.

Post Reply