Warning: I am no Java nor Eclipse expert!
I have inherited a Java project in Eclipse. I have made changes to multiple java files. After doing so, and saving the files, I ran a file called set_javac.bat (also inherited). Here's a redacted version of that file:
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_85
rem set JAR_HOME="D:\Cognos\cognos_version\sdk\java\lib"
set JAR_HOME="D:\code\lib"
set JAVAC=%JAVA_HOME%/bin/javac
set PATH=%JAVA_HOME%/bin
rem Create the Classpath
set CLASSPATH=
set CLASSPATH=%CLASSPATH%;%JAVA_HOME%/lib/tools.jar
rem Compile Java files
After running this file, I am then to run build.bat (also inherited - redacted):
@echo off
rem Licensed Materials - Property of IBM
rem
rem IBM Cognos Products: CAMAAA
rem
rem (C) Copyright IBM Corp. 2005, 2012
rem
rem Copyright © 2008 Cognos ULC, an IBM Company. All Rights Reserved.
rem Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated).
rem Build Java files in directory TestSample
echo Building TestSample
rem Build the CLASSPATH required to build Java files in the directory TestSample
set _CLASSPATH=D:\code\lib\CAM_AAA_CustomIF.jar;D:\code\adapters;D:\Cognos\cognos_version\webapps\p2pd\WEB-INF\lib\ojdbc6.jar;D:\code\lib\axis.jar;D:\code\lib\jaxrpc.jar
rem Compile Java files
javac -Xlint:unchecked -classpath %_CLASSPATH% -d . *.java
rem Create jar file
jar cfm0 CAM_AAA_TestSample.jar MANIFEST *.class
echo done
Both of these .bat files run without error. New .class files are created in the same directory as their .java files. A new CAM_AAA_TestSample.jar file is created also. However, when the .jar file is put in the right location and the Cognos service is restarted and I check the log file, I don't see the changes that I made. Specifically, I have changed log messages from (for example):
thisfile: init
to...
thisfile.java -> init: Entered function
But when I open up the log file, I see new messages (date/time stamped) with the old format still. What am I doing wrong?
If you need more details about the setup, please let me know and I'll get you what I can. We use Eclipse to manage the workspace and use "intellisence", but we don't build with it. Any information you can provide is truly appreciated.
It's possible to have a class defined in more than one class file or jar file on your class path. When this happens, the JVM picks one to use - I'm pretty sure that it's the first that it encounters in the order that it has the files listed in the class path.
My guess was that you had a case like this and that you were replacing a jar file that contained the old class definition but the JVM was actually using a definition from some other file on your class path. Looks like from your comments that this was more or less correct.