JVM considers some old version of the JAR though there is a new one

Discussion in 'Java' started by Raga, Oct 14, 2006.

  1. Raga

    Raga Guest

    Hi,

    I have a jar file called DataProcess.jar.I ran it.Then, I made some
    modifications to it, then formed the JAR file again & replaced the old
    jar with the new one. I renamed the old jar to "DataProcess.jar.orig".
    I also put it in a different folder outside the classpath. But JVM
    still seems to take the code from the old jar file or, I shd say, it is
    still executing the old code, & not at all considering the new jar
    file. Is it taking from some cache or something like that? If yes, how
    do I clear the cache?

    To execute the jar, I do this:
    1. Created a .bat file & inside it, wrote:
    java -classpath DataProcess.jar;<other jar files>
    package1.mainDataClass
    2. Then, I executed this .bat file.

    I removed the jar (to see if JVM is atleast taking it from that
    location or if there is some other jar file which it is referring to).
    Now, if I execute the .bat file, JVM says it cant find the class. So,
    it seems to refer to the jar in the correct location only. But, the
    code from that jar doesn't seem to be executed. Am saying this, bcos I
    gave some println stmts in the code & it's not getting executed.
    Whereas if I do this in a different machine, it works fine, meaning in
    a different machine, JVM cleanly recognizes the new JAR.
    Am using JDK 1.5.

    Please suggest as to how to make the JVM execute the code in the new
    jar file?

    Thanks.
     
    Raga, Oct 14, 2006
    #1
    1. Advertising

  2. Raga wrote:
    .....
    > To execute the jar, I do this:
    > 1. Created a .bat file & inside it, wrote:
    > java -classpath DataProcess.jar;<other jar files>
    > package1.mainDataClass


    rem java -classpath DataProcess.jar;... package1.mainDataClass
    java -jar DataProcess.jar -classpath DataProcess.jar;...
    package1.mainDataClass

    HTH

    Andrew T.
     
    Andrew Thompson, Oct 14, 2006
    #2
    1. Advertising

  3. Raga

    Chris Uppal Guest

    Raga wrote:

    > I have a jar file called DataProcess.jar.I ran it.Then, I made some
    > modifications to it, then formed the JAR file again & replaced the old
    > jar with the new one. I renamed the old jar to "DataProcess.jar.orig".
    > I also put it in a different folder outside the classpath. But JVM
    > still seems to take the code from the old jar file or, I shd say, it is
    > still executing the old code, & not at all considering the new jar
    > file. Is it taking from some cache or something like that? If yes, how
    > do I clear the cache?
    >
    > To execute the jar, I do this:

    [...snipped...]

    Your tests seem to have been carefully thought out, and (unless you made a
    mistake somewhere without realising it -- which is sadly easy to do) so it
    seems that the JAR's must be correct.

    Unfortunately, there is no caching of classfiles loaded from JARs in the
    standard JVM implementations (well, actually there is in a way, but that's not
    relevant here since it's not used for user-supplied JARs).

    So I suspect that you've made the same mistake as everyone makes from time to
    time, and put the wrong classfiles into the JAR you are testing.

    -- chris
     
    Chris Uppal, Oct 16, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    598
    Arnold Peters
    Jan 5, 2005
  2. muttley
    Replies:
    0
    Views:
    2,753
    muttley
    Oct 20, 2005
  3. jakester
    Replies:
    3
    Views:
    1,856
    jakester
    Apr 3, 2007
  4. V Green
    Replies:
    0
    Views:
    885
    V Green
    Feb 5, 2008
  5. PA Bear [MS MVP]
    Replies:
    0
    Views:
    1,000
    PA Bear [MS MVP]
    Feb 5, 2008
Loading...

Share This Page