ClassPath


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: ClassPath

  1. #1
    Join Date
    Oct 2004
    Posts
    151

    Question 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
    What type of softwares do you like and what would you pay for it?

    http://www.wizardsolutionsusa.com/fo...hread.php?t=12

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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 ...

  3. #3
    Join Date
    Oct 2004
    Posts
    151

    Question

    Hi everyone,

    Quote Originally Posted by nspils
    At one point did you put JProcTim on your CLASSPATH?
    Yes

    Quote Originally Posted by nspils
    Have you rebooted since you did that?
    Yes

    Quote 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
    What type of softwares do you like and what would you pay for it?

    http://www.wizardsolutionsusa.com/fo...hread.php?t=12

  4. #4
    Join Date
    Jul 2005
    Location
    SW MO, USA
    Posts
    299
    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?

  5. #5
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    As Norm suggested - try it with the "JTim" left off ... finish with the "JProc\"

  6. #6
    Join Date
    Oct 2004
    Posts
    151

    Question

    Hi everyone,

    Quote 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

    Quote 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

    Quote 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

    Quote 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

    Quote 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 type of softwares do you like and what would you pay for it?

    http://www.wizardsolutionsusa.com/fo...hread.php?t=12

  7. #7
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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.

  8. #8
    Join Date
    Oct 2004
    Posts
    151

    Question

    Hi everyone,

    Quote 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.

    Quote 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
    What type of softwares do you like and what would you pay for it?

    http://www.wizardsolutionsusa.com/fo...hread.php?t=12

  9. #9
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    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

  1. Compilation prob (Classpath)
    By man_25 in forum Java
    Replies: 2
    Last Post: 08-22-2005, 03:19 AM
  2. classpath issues
    By in forum Java
    Replies: 1
    Last Post: 02-15-2001, 12:19 PM
  3. Replies: 3
    Last Post: 02-10-2001, 09:24 AM
  4. regarding classpath
    By satyamohanty in forum Java
    Replies: 0
    Last Post: 11-22-2000, 12:31 AM
  5. problems with classpath
    By satish in forum Java
    Replies: 0
    Last Post: 10-03-2000, 11: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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center