0

I want when Developer save java file in eclipse , And eclipse by default generate it .class file in bin folder,So this .class file is also generate in other folder also. I can not copy /paste that bin class file to new desired location because of client restriction. So only option remaining of doing this is to somehow give two path one is of bin folder path & other is of my new folder path so when Developer press Ctrl+S ,eclipse automatically generate .class in two different locations. Any idea how should i achieve this??

WebNor
  • 11
  • 2
  • Will changing the output folder (see https://stackoverflow.com/a/3191753/6505250) solve your problem? – howlger Aug 01 '17 at 14:08
  • The approach suggested by you, copy all .class file from bin to other folder, But i only want those .class file which is changed & saved by developer. Also all .class file in Bin folder too. – WebNor Aug 01 '17 at 14:32
  • You do not have to copy the .class files of the _bin_ folder to the other folder. Just change the output folder which is by default the _bin_ folder. Eclipse (incremental) compiles the .java files of the source (by default _src_) folder(s) and creates or updates the .class files in the output folder. – howlger Aug 01 '17 at 15:40
  • OK, what if i write a new eclipse plugin for this? then it works or not? i think every functionality in eclipse is because of plugin. m i right?? – WebNor Aug 01 '17 at 16:02
  • if i change the output folder path to new folder then all class file generated in new folder, there is no class file in bin folder all class files are in new output folder, but i want class files on both the location & also in newfolder only the last change java class file not all code class file. – WebNor Aug 01 '17 at 16:06
  • What problem is this solving? – nitind Aug 01 '17 at 21:13

1 Answers1

1

If you want the .class files in only in one, but different folder, change the output folder (which is by default the bin folder).

If you want to duplicate/synchronize the .class files to/with another folder, create a project builder Ant buildfile, which for example uses the Sync Ant task. Make sure, the Ant file will be executed after the Java Builder (in step 13.: below Java Builder).

howlger
  • 31,050
  • 11
  • 59
  • 99
  • yes its correct, but it not going to solve my problem, i want - 1)- changed class file in bin folder with other class file of project 2)- Now that changed class file in new folder also (Only the updated/changed class file) not all the class files of project. – WebNor Aug 03 '17 at 11:43
  • What's stopping you to do both, 1) and 2) in the Ant script? – howlger Aug 03 '17 at 11:54
  • Thanks for fast replying .Ant script sync task search in bin folder if it find any updated file then its copy that to new folder , I have more than 10 lakhs class file in bin folder and in searching the updated one from them it takes 10-12 minutes. this is not ideal for me. i want something like java builder - http://www.eclipse.org/articles/Article-Builders/builders.html which do this with light speed. i want to generate the updated class file in runtime from eclipse, in same time when it updated/generate it in bin folder same time it update/generate the same in new folder .. . – WebNor Aug 03 '17 at 12:10
  • In this case, you have to write your own Eclipse plug-in (there is a template for project builders). Alternatively, you can use [this Ant project builder](https://sourceforge.net/p/pacx/code/HEAD/tree/net.sf.pacx.antbuilder/) that passes the list of changed files to the Ant script (see `eclipse.resources.`... in this [sample build.xml](https://sourceforge.net/p/pacx/code/HEAD/tree/net.sf.pacx.ui/template/.settings/build.xml#l649)). – howlger Aug 03 '17 at 12:30