Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Weird, why is some previous version of a class running(ECLIPSE EXECUTING OLD CODE)
Weird, why is some previous version of a class running [message #1703500] Sat, 01 August 2015 14:33 Go to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
I have this class named DataBaseDemo.java and I had it originally set up to use MySQL but then I altered it to use ORACLE.

But I only 'half way' did the change and did a save and click the run button.
So I was struck dumb when it did run. Then I looked at the output and I could tell that it was behaving as if I never made any changes. What it is doing is running the older previous code before I made massive changes. It is ignoring the code that comes up on the screen even though I have hit the SAVE key many times.

So why might that be?

And more importantly how can I get it to 'forget' the old code and remember the new code?
Re: Weird, why is some previous version of a class running [message #1703516 is a reply to message #1703500] Sun, 02 August 2015 03:01 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

Physically where is the compiled old code? Is it a location Eclipse would clear out when building the new code?

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Weird, why is some previous version of a class running [message #1703530 is a reply to message #1703516] Sun, 02 August 2015 15:35 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
Good question Nitin. As far as I know it does not exist anywhere other than a copy pasted in to a MS Word document where I am writing up this issue.
I did check the properties of the source code in Eclipse and the path and file is just as I expect and opening up the source code by way of Note Pad shows just the current most recent update text.
My conclusion is that the text that is brought up is NOT what is being executed. Maybe there is some 'compiled' version that is being executed.
The old version of the code is set up to pull data from a MySQL table and the current text is set up to pull data from an Oracle table. The tables are very different. But what gets displayed in the console is data from the MySQL table.
I would post a picture but it looks like the only way to do that is to send the pic to a place like PhotoBucket so that there is an URL and I don't want to bother with that.

Re: Weird, why is some previous version of a class running [message #1703531 is a reply to message #1703530] Sun, 02 August 2015 15:37 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
ah, maybe in regular reply I can attach a picture.

index.php/fa/22742/0/


x
Re: Weird, why is some previous version of a class running [message #1703532 is a reply to message #1703531] Sun, 02 August 2015 17:28 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 08/02/2015 09:37 AM, Rod Hittle wrote:
> ah, maybe in regular reply I can attach a picture.
>
>
>
>
> x
>
What, you didn't have a pair of scissors?

;-)
Re: Weird, why is some previous version of a class running [message #1703534 is a reply to message #1703530] Sun, 02 August 2015 18:56 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Rod,

Note that Nitin asked "Physically where is the compiled old code?" but
you've only explained where is the source code. Somewhere there are
..class files produced by the compiler and apparently you're running old
compiled code or not compiling the new code. So you must find the
corresponding .class file of the new code and figure out where are these
old .class files. The Java Explorer hides the bin folder (normally
where the .class files end up) so you might need to use the Resource
Explorer to find it.


On 02/08/2015 5:35 PM, Rod Hittle wrote:
> Good question Nitin. As far as I know it does not exist anywhere
> other than a copy pasted in to a MS Word document where I am writing
> up this issue.
> I did check the properties of the source code in Eclipse and the path
> and file is just as I expect and opening up the source code by way of
> Note Pad shows just the current most recent update text.
> My conclusion is that the text that is brought up is NOT what is being
> executed. Maybe there is some 'compiled' version that is being executed.
> The old version of the code is set up to pull data from a MySQL table
> and the current text is set up to pull data from an Oracle table. The
> tables are very different. But what gets displayed in the console is
> data from the MySQL table.
> I would post a picture but it looks like the only way to do that is
> to send the pic to a place like PhotoBucket so that there is an URL
> and I don't want to bother with that.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Weird, why is some previous version of a class running [message #1703545 is a reply to message #1703534] Mon, 03 August 2015 00:09 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
Well Ed, you hit the nail on the head. I just don't have a clue how I 'compiled' the code.
Can you point to a doc about compiling coce and what do I do now as I don't want use the compiled code. Can I just delete it using MS Windows Explorer?

Re: Weird, why is some previous version of a class running [message #1703546 is a reply to message #1703545] Mon, 03 August 2015 00:11 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
index.php/fa/22744/0/

Re: Weird, why is some previous version of a class running [message #1703553 is a reply to message #1703546] Mon, 03 August 2015 04:21 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

Search your system for filenames that match the ones giving you old behavior.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Weird, why is some previous version of a class running [message #1703627 is a reply to message #1703553] Mon, 03 August 2015 17:47 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Let me establish a few baseline facts that might help you understand better what's going on and then help us help you.

  • Eclipse automatically builds your project(s) whenever you save a source file; mostly "build" means compile the Java code into .class files, but there can be other steps, too.
  • If there are any project errors or compilation problems, Eclipse might not produce a .class file, depending on how severe the problems are.
  • The Problems or Markers views in Eclipse are the best place to see the current state of your project(s) with regard to build errors.
  • As Ed mentioned, Eclipse's Resource Navigator view will show you a "physical" representation of your workspace, much like what Windows Explorer shows.
  • You can use Project > Clean... from the menu to force Eclipse to clean the compiled code and re-build it.
  • When you run your application/program in Eclipse, it creates (or re-uses) what's called a Launch Configuration to create the runtime settings, such as runtime classpath, VM arguments, etc. You can view the Launch Configs via the Run > Run Configurations... dialog from the menu. There you can inspect how your program is being run.


So, does your Problems (or Markers) view show any errors on the project or the file you're working with?
Can you take a screenshot of the Run Configuration for your program and share that? (also inspect it yourself to see if there's anything obviously suspicious in it).
Re: Weird, why is some previous version of a class running [message #1703662 is a reply to message #1703627] Tue, 04 August 2015 01:51 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
This is what I saw before the Project > Clean in the Markers.
Which solved that problem.
But the Markers still looks the same.

index.php/fa/22756/0/

but now I am getting

index.php/fa/22757/0/

[Updated on: Tue, 04 August 2015 01:52]

Report message to a moderator

Re: Weird, why is some previous version of a class running [message #1703663 is a reply to message #1703662] Tue, 04 August 2015 03:32 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
As the first Java Problem indicates, there's a build path error on the VC project. You might be able to get some assistance by right-clicking on that error and choosing Quick Fix..., but instead why don't you right-click on the VC project and open its Properties dialog. Then select the Java Build Path section and see if there is any detailed message about the error.
Re: Weird, why is some previous version of a class running [message #1703782 is a reply to message #1703663] Wed, 05 August 2015 00:33 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
Eric, as far as I can see there are no error messages.
I think this is where you are directing me.
index.php/fa/22772/0/
and
index.php/fa/22773/0/


For some reason all the source codes *.java has lost all connection to the class files.
In fact, when I checked there were no longer any files in
D:\GD\EWS\workspace\VC\bin

So of course I get the error 'Could not find or load main class'...
Before I discovered that I made a new package and made a new source member and ran that.
Low and behold it worked.
source
D:\GD\EWS\workspace\VC2\src\VC_2_9
and only item in that folder is as I expected DataBaseDemoMySQL.java

And in the 'bin' folder
D:\GD\EWS\workspace\VC2\bin\VC_2_9
and the only item in that folder is as I expected DataBaseDemoMySQL.class

So, I am puzzled to what happened to all those *.class files in the project VC.
And If I want to recreate them is there some easy way to do so?



Re: Weird, why is some previous version of a class running [message #1703785 is a reply to message #1703782] Wed, 05 August 2015 02:15 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Well you've looked in the right places, but the results are unexpected (to me at least). The screen shot of the Markers view says the project has build path errors, but when you look at the build path it doesn't show any errors. <smh/>

There is something odd in the build path, though, maybe it's related: the .classpath file should not be listed under Libraries. Select and remove it, then click OK and see if the Error goes away (from the Markers view). Might even try Project > Clean after that, although it really shouldn't be necessary.

Also, your screen shot of the Markers view says there are 2 errors and a bunch of warnings; can you show/tell us what the other error is?

By the way, the absence of .class files is because
a) you did Project > Clean, which deletes the contents of the build output folder (bin/ in your case), and
b) Eclipse thinks the project configuration is broken and can't compile it. Once we figure out what that's all about, it will start building the .class files again (automatically).
Re: Weird, why is some previous version of a class running [message #1703800 is a reply to message #1703785] Wed, 05 August 2015 06:04 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

.classpath is the file that stores and defines what the Java Build Path is, it shouldn't actually be listed on the Java Build Path.

Can you show us the contents of the .classpath file? My suspicion is that the src folder itself may not be listed as a Source Folder in there.


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Weird, why is some previous version of a class running [message #1703928 is a reply to message #1703800] Wed, 05 August 2015 21:57 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
here it is:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
	<classpathentry kind="lib" path=".classpath"/>
	<classpathentry kind="lib" path="C:/Program Files (x86)/MySQL/MySQL Connector J/mysql-connector-java-5.1.36-bin.jar"/>
	<classpathentry kind="lib" path="D:/Oracle_Exe/app/oracle/product/11.2.0/server/jdbc/lib/ojdbc6.jar"/>
	<classpathentry kind="output" path="bin"/>
</classpath>

and a pic
index.php/fa/22802/0/
  • Attachment: classpath.jpg
    (Size: 148.76KB, Downloaded 6785 times)
Re: Weird, why is some previous version of a class running [message #1703933 is a reply to message #1703928] Wed, 05 August 2015 22:34 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

Remove the .classpath entry from that tab, then flip over the the Source tab and use the "Add Folder..." button to add the "src" folder to the list.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Weird, why is some previous version of a class running [message #1703942 is a reply to message #1703933] Thu, 06 August 2015 01:19 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
Nitin,
I did "Remove the .classpath entry from that tab"
index.php/fa/22803/0/
But for "then flip over to the Source tab and use the "Add Folder..." button to add the "src" folder to the list." did not make sense to me as the folder "src" was already there. I did add another folder named "George" but that did nothing for me so later removed it.

The good news is that when I went back to my project "VC" and then went down to any of the packages and opened them up and selected one of the classes and then ran it and it worked! So now I don't have to try to recreate anything.

Thank you all very much.
Re: Weird, why is some previous version of a class running [message #1703943 is a reply to message #1703942] Thu, 06 August 2015 01:25 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
I will add one more note. In Libraries that classpath you had me remove before is no longer there after things started working again. And that is part of the point. I don't know why it was ever there that it needed to be deleted. All the other projects don't have such a thing either.
index.php/fa/22804/0/
Re: Weird, why is some previous version of a class running [message #1703946 is a reply to message #1703943] Thu, 06 August 2015 04:35 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

So do you still have a message indicating a problem with the project's Java Build Path?

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Weird, why is some previous version of a class running [message #1704054 is a reply to message #1703946] Thu, 06 August 2015 22:50 Go to previous messageGo to next message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
Nope, all error messages gone.
Re: Weird, why is some previous version of a class running [message #1704059 is a reply to message #1704054] Fri, 07 August 2015 04:23 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4430
Registered: July 2009
Senior Member

Cool.

Now does it work as it should when you make changes?


_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Weird, why is some previous version of a class running [message #1704192 is a reply to message #1704059] Sat, 08 August 2015 14:03 Go to previous message
Rod Hittle is currently offline Rod HittleFriend
Messages: 14
Registered: August 2015
Junior Member
Yes it does.
Previous Topic:Code backup
Next Topic:How to connect to svn server and compile by another remote machine
Goto Forum:
  


Current Time: Thu Mar 28 21:24:11 GMT 2024

Powered by FUDForum. Page generated in 0.04398 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top