| Author |
same class names
|
rengarajan vaikuntam
Ranch Hand
Joined: Oct 04, 2004
Posts: 37
|
|
Hi I have one folder name C:\SAMPLES under which i have this code public class MyFirstProg { public static void main(String as[]) { System.out.println("FIRST PROG IN SAMPLES FOLDER"); } } compiles and executes ok. I have one more folder C:\PROJECTS in which i have a prog with same class name public class MyFirstProg { public static void main(String as[]) { System.out.println("FIRST PROG IN PROJECTS FOLDER"); } } compiles and executes ok. But when i go back to my samples folder ,open MyFirstProg class and execute it, to my surprise the one in the projects folder only is getting executed. Could anyone explain why? Thanx renga.
|
 |
rogel garcia
Ranch Hand
Joined: Dec 19, 2003
Posts: 41
|
|
|
Maybe this is a classpath problem!?
|
SCJP 1.4
|
 |
Yogesh Chhawasaria
Ranch Hand
Joined: Apr 02, 2004
Posts: 53
|
|
|
Just wondering are you using some kind of IDE or you execute the program manually via command prompt.
|
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
|
 |
rengarajan vaikuntam
Ranch Hand
Joined: Oct 04, 2004
Posts: 37
|
|
yogesh im using NetBeans IDE. Thanx, Renga
|
 |
Yogesh Chhawasaria
Ranch Hand
Joined: Apr 02, 2004
Posts: 53
|
|
Well SCJP expects u 2 be a walking compiler... After reading your few other posts I can just reach the conclusion that you aint really much familiar with command prompt execution and classpath issues. I can only advise you to leave the IDE alone initially and spend time with command prompt and start from basics.... but again these are just my thoughts...
|
 |
shri mon
Ranch Hand
Joined: Jan 11, 2005
Posts: 63
|
|
|
use a different package name for both the programs and include both the directories in the classpath.Never work with orphan classes..
|
 |
ankur rathi
Ranch Hand
Joined: Oct 11, 2004
Posts: 3829
|
|
|
I think , NetBeans IDE will have a button for execution & when we will click on that it will execute the last successful file ( In WSAD , it is ) . ( In WSAD there is a option - Run as a application : for running current file )
|
 |
 |
|
|
subject: same class names
|
|
|