-
ClassPath
Hi everyone,
I need to ask a very generalised question about classpath.
Now i have a java class file named JTim.class
Now on the command line i run JTim like that
Code:
C:\j2sdk1.4.2\bin\java -cp .;C:\WINDOWS\Desktop\JProc\ JTim
Now do you guys see the folder in which JTim is in which is called
JProc. You see in JProc there is another folder called JProcTim
Now in the folder called JProcTim is a java class file also named
JTim.class
Now my question taking into account that to run the class JTim in the
JProc i did this
Code:
C:\j2sdk1.4\bin\java -cp .;C:\WINDOWS\Desktop\JProc\ JTim
is why does the intrepreter run the JTim class in the JProcTim folder and not the one i specified which is the JTim class in the JProc folder?
Any help is greatly appreciated
Thank You
Yours Sincerely
Richard West
-
It sounds like the CLASSPATH is searching to the JProcTIm folder before it gets to the JProc folder and is therefore compiling the version found there rather than in JProc.
At one point did you put JProcTim on your CLASSPATH?
Have you rebooted since you did that?
Did you make this entry permanent?
There IS an explanation ... guess you just need to puzzle it out ...
-
Hi everyone,
 Originally Posted by nspils
At one point did you put JProcTim on your CLASSPATH?
Yes
 Originally Posted by nspils
Have you rebooted since you did that?
Yes
 Originally Posted by nspils
Did you make this entry permanent?
No
I find this very weird as i have never experienced anything like this before as you can see from the way i run the java programs i always redefine the classpath so why this is happening is really alien to me.
Have you ever experienced anything like this before?
I am setting the classpath abovr correctly am i not?
Yours Sincerely
Richard West
-
Sounds like user error.
How are you sure that the two programs with the same name are different and that the one in the JPProcTim folder is being executed?
Could the JProc.class files be the same in the two folders?
What happens if you rename the .class file you don't want executed to say .xxx and then execute the java command?
The line you posted
C:\j2sdk1.4.2\bin\java -cp .;C:\WINDOWS\Desktop\JProc\ JTim
doesn't have the program name on it? How does it work w/o that?
-
As Norm suggested - try it with the "JTim" left off ... finish with the "JProc\"
-
Hi everyone,
 Originally Posted by Norm
How are you sure that the two programs with the same name are different and that the one in the JProcTim folder is being executed?
This is because they are different programs with the same name
 Originally Posted by Norm
Could the JProc.class files be the same in the two folders?
No i checked this many times and the .class files are different but they have the same name in different folders
 Originally Posted by Norm
What happens if you rename the .class file you don't want executed to say .xxx and then execute the java command?
If the .class files have different names then this error of mine does not occurs at all
 Originally Posted by Norm
The line you posted
doesn't have the program name on it? How does it work w/o that?
The class name is JTim.class at its at the end of the command line without the .class
 Originally Posted by nspils
As Norm suggested - try it with the "JTim" left off ... finish with the "JProc\"
When i do this things get even worse and the program is never run at all with
the java intrepreter saying it does not know which is the main class to run
I find this very weird as i have never experienced anything like this before
Any help is greatly appreciated
Yours Sincerely
Richard West
-
What is motivating you to name classes this way? Is this some kind of version control?
Perhaps it is time to change the structure of your directories, or your file names, until you hit on a "final" version, then do your final builds.
-
Hi everyone,
 Originally Posted by nspils
What is motivating you to name classes this way? Is this some kind of version control?
There's no motivation. Its something i stumbled upon and found very weird and was thinking it was somethin wrong i was doing but it seems weird that the intrepreter would react in this way. Its not part of any version control.
 Originally Posted by nspils
Perhaps it is time to change the structure of your directories, or your file names, until you hit on a "final" version, then do your final builds.
Perhaps you are right about this and i have to have different names for all my classes.
Richard West
-
Richard -
Have you organized this project into packages? If so, what is/are the name(s) of the package(s)? Any cross-over with your directory structure?
Similar Threads
-
Replies: 2
Last Post: 08-22-2005, 02:19 AM
-
Replies: 1
Last Post: 02-15-2001, 11:19 AM
-
Replies: 3
Last Post: 02-10-2001, 08:24 AM
-
By satyamohanty in forum Java
Replies: 0
Last Post: 11-21-2000, 11:31 PM
-
Replies: 0
Last Post: 10-03-2000, 10:44 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|