简体   繁体   中英

Eclipse not recognizing changes in code

A friend and I are working on a java project in Eclipse. Whenever we "ship" a new version we export it to a runnable jar.

It seems whenever we try to send the file back and forth (over google drive) to work on separate parts of it something gets messed up. This doesn't happen for him, but when I download the file from Google Drive, Eclipse does not recognize any change I make to the src.

It doesn't matter how many times I change the workspace, move/ rename the file, clean/ build the project. Nothing seems to be solving this problem. Any advice on why this is happening and how to fix it?

It would be infinitely better for the both of you if you looked into some kind of source control system, as opposed to a file sent through a file sharing service.

Sharing the source code in a JAR doesn't allow you to:

  • Keep a revision of known working code, in case something breaks
  • Reliably import the code
  • Keep track of changes (who did what to what file, etc)

Look into something that's suitable for sharing between users. GitHub and BitBucket both offer free Git hosting , which is a very popular source versioning tool.

Eclipse is probably building the new version of the runnable JAR in the project's output directory, which by default is something like %PROJECTDIR%/target. The new version of the JAR with your changes will be there, and you'll have to export them again to trade files back again. See also: How do I change a Java project's bin folder in Eclipse?

这可能是因为它没有更新你的.class ,尝试删除项目“ target ”文件夹的.class,make clean(项目 - 清理)并再次保存更改

There are many steps where you can solved it,

  • Clean Project and Re-Build
  • Remove .metaData and .settings from Workspace
  • Clear cache

  • In my case, I have tried much more and I got to resolve it by removing Classes, test-classes folders if Its there in Target folder

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM