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

R

Raga

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

Andrew Thompson

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

Chris Uppal

Raga said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top