Setting Build Automatically in Eclipse via configuration file - java

Is there any way by which we can set "Build Automatically" option to true via a configuration file so that this option would be checked as soon as eclipse gets started. This is just because the workspace is made ready with the help of a batch file which compiles the code and then opens the eclipse also.

The default settings is true, anyway if you want to force this behavior you need the following line description.autobuilding=true in the org.eclipse.core.resources.prefs file.
This preference file is located under the .metadata folder of the workspace, ie:
C:\Workspaces\MyWorkspace\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.core.resources.prefs

With Eclipise Mars.1 (4.5.1), you may be able to use Oomph's setup feature.
On Windows, files under
%USERPOFILE%.eclipse\org.eclipse.oomph.*
permit putting Eclipse into a desired state the next time Eclipse starts up.
I indirectly became aware of Oomph's power after troubleshooting a "problem" with Build Automatically getting mysteriously disabled.
After posting on the Oomph Eclipse Community Forum, I learned that Oomph has been disabling Build Automatically.
Some ways to see Oomph's settings "Eclipse->Navigate Menu-> Open
Setup menu entry-> Open User menu entry", a Preference Task under "User Preferences -> org.eclipse.core.resources -> description.autobuilding"
For more info, see the discussion post at
https://www.eclipse.org/forums/index.php/m/1722751/#msg_1722751

Related

Is there a way to remove/hide/disable "Java [Main|Test] Sources" Working Sets from the Project Explorer panel in Eclipse 2019-06

I'm trying to remove the working sets "Java Main Sources" and "Java Test Sources" from the working sets of the Project Explorer.
I can delete them from the Select Working Set dialogue window, but, they return when Eclipse is restarted. Is there a way to remove them permanently?
After restarting eclipse, I would expect those working sets to not be present.
These working sets are contributed by the Maven support plug-ins (org.eclipse.m2e.xxx).
There does not seem to be anyway to disable them other than uninstalling the Maven support.
The location where Eclipse saves working sets is workspace/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml. If you're on Windows try setting this to readonly, hopefully this works.
When you remove Java Main|Test Sources from Eclipse, it removes the corresponding lines there. However, when you restart Eclipse it generates those lines again.
I'm on Linux, I thought setting the file owner to root:root with -rw-rw-r-- permissions would have been enough. On start up it throws an error, but quickly corrects itself, deletes the folder and reconstructs the settings from the files it was able to read. Setting the folder to root:root as well means you can read the error that is thrown (Cannot save) but it still creates the workspaces, just can't save them for you...

How can I disable "Initialize Java Tooling" on Eclipse startup?

In our application which is a Eclipse plugin, when Eclipse starts it takes long time and the users are seeing "Initialize Java tooling" message on the left down corner of application. Because our users don't have anything to do with java, I wonder if it is possible to disable Initialize Java tooling.
Another question: What is Initialize Java tooling?
Try to terminate eclipse then backup and delete the folder
.metadata/.plugins/org.eclipse.core.resources/.history
Restarting eclipse will not hang the Java Tooling process.
from Command prompt just type
eclipse.exe -clean
The java-tooling implement a Java IDE supporting the development of any Java application, including Eclipse plug-ins. It adds a Java project nature and Java perspective to the Eclipse Workbench as well as a number of views, editors, wizards, builders, and code merging and refactoring tools. The Java-tooling provides a development environment to developer.
how to disable plugin at startup
you can try disabling the java-tooling while launching the application.I am giving you a snapshot.
go find perspective as Window->Preferences->Run&Launching->java Application-> and make debug an run combobox to none value.
Hope this can solve your problem.
In case of Eclipse Oxygen, this settings can be found at:
Eclipse > Preferences > Run/Debug > Launching > Perspectives > Java Application > Eclipse JDT Launcher
There will be a folder .metadata in your project workspace directory. Just delete the .log files in it and restart eclipse.
Just uncheck "Build Automatically" and force quit Eclipse. Then start it again.
Project>Build Automatically - uncheck
-force quit
-start Eclipse
I know kind of late advice but because I have this issue 3 days now and I am very very frustrated....just have a copy of your eclipse IDE "virgin" as much possible to rerun it. And any plugin you want to have just do it on a direct copied version of this "virgin" eclipse. This is the only way to get away with clumsy plugins and staff under the hood that you cannot control.
It's devastating to import the projects all the time from the start or deleting the metadata folders....
Is to remove or rename the .projects folder in .metadata/.plugins/org.eclipse.core.resources in the workspace folder. This doesn’t seem to affect any project and the .project folder will be recreated when Eclipse restarts

Editor does not contain a main type - messed up Build path config

Does anyone know of any complete guide that shows how to reconfigure from scratch the "Build Path" in Eclipse?
In the attempt to add a .jar file I messed up the current configuration. Or if you think volunteering pictures of your Eclipse config screen may help, that would be appreciated it too!
I hope I will not have to reinstall Eclipse.
The error I keep getting (for any classes, also those who used to run perfectly) is: "Editor does not contain a main type." (BEFORE any program even LAUNCHES).
I had deleted JRE but then I put JRE back by right clicking the root of "package explorer" - Build path - Add libraries - JRE System Library. Still same error.
The "Build Path" -> "Configure Build Path" tool can be used to fix a lot of problems that other build path modifying techniques can cause.
Open that tool and look through the tabs and see if you can find the entry that is causing the problem. Pay special attention to the Libraries tab. You may just want to remove all the entries in this tab and re-add the ones you need one by one. Build path problems are often broken entries in this tab.
You might also try looking through "Run" -> "Run Configurations" tool and remove any run configurations associated with the project.
I didn't have any source folder added in the Build path configuration. I just went to Build Path configuration and added the folder in the "Source" panel. (I had previously deleted it by mistake.)
This solved my problem, now my applets and console classes run perfectly like they used to.
http://zenverse.net/editor-does-not-contain-a-main-type-error-in-eclipse/

Purpose of the "Build Automatically" option in eclipse

What is the purpose of Build Automatically option in Eclipse (Project-->Build Automatically)? Mine will always be checked. But when ever I have some java code changes I still have to do a full build. I was told that it should always be checked. I don't see any benefit in doing so. Please somebody explain.
Eclipse has a good answer on their website:
You have two modes of working: auto-build mode and manual build mode. By default, you are in auto-build mode and Eclipse takes care of compiling source files automatically. Builds occur automatically in the background every time you change files in the workspace (for example saving an editor). Auto-build is convenient because it means problems view, binaries, etc. are are up-to-date at all times. The downside is that in large workspaces auto-builds can be time-consuming if you are changing files in projects with lots of downstream dependent projects.
If auto-build is taking too long and is interfering with ongoing development, it can be turned off. Once in manual build mode, the user is in complete control over when builds occur and what gets built. Project > Build All (Ctrl+B) can be invoked at any time to trigger what auto-build was doing automatically. This allows you to build up a larger set of changes before invoking a build (Eclipse remembers which files have changed so that it does not have to do more work than required when you do ask for a build.
Note that when they say "auto-build mode" they mean if you have checked "Build Automatically", when they say "manual build mode" they mean you do not have "Build Automatically" checked.
Yes, you still have to do a build - but it's done automatically when you save (not an external build like an Ant build, but the "internal" build). If you didn't want to build on save, you'd uncheck the box. Having it build automatically makes some people nervous, I believe.
NOTE
For C/C++ users it's told (from help.eclipse.org):
By default, the Eclipse workbench is configured to build projects automatically. However, for C/C++ development you should disable this option, otherwise your entire project will be rebuilt whenever, for example, you save a change to your makefile or source files. Click Project > Build Automatically and ensure there is no checkmark beside the Build Automatically menu item.
Project - Disable Autobuild option does not always mean autobuild is off. For example "Makegood" test automation plugin will trigger autobuild when Preferences - Run/Debug - launching - (General opt) Build before launch is ON. So turn it off if manual build needed.
One thing that people didn't mention here (and it took a while for me to figure this out too) is that eclipse build (either automatic or manual) would basically follow what you have outlined in the project's "Java Build Path" source tab. So when a file is covered in that build source tab, when you change the file, it gets copied/compiled to the output folder that was specified for that directory/file.
One more difference is:
Most of the time while working on JSPs it helps me when checking "Build Automatically". It automatically picks up the changes in JSPs.
But if you make changes in your java classes/XMLs you need a manual build.
Since I'm using resin server which is run outside eclipse via command prompt, i prefer checking the option.
When i have my server setup in eclipse, i turn it off and use Publish on server.
This is the way i use and the answer is based on my experience.
If Build Automatically is checked, the IDE will automatically compile your Java code whenever you modify and save a file. This does not mean it will completely build and package your entire solution as if you were going to deploy it such as if you are working in a Web project on a WAR module. It basically really just compiles your code.

Debugging with Eclipse using multiple windows

I usually run a dual-monitor setup, so I have two Eclipse windows open for the same workspace, displaying different files. When I'm debugging and a breakpoint is hit, Eclipse switches to the "Debug" perspective, but it also shows the file/line where the breakpoint is in both of my windows. This occurs even if the file containing the breakpoint was open in one window but not the other (before the breakpoint was hit).
This is really annoying.
How can I have Eclipse only show the file containing the breakpoint in one window? Ideally, it would choose which window based on where the file is open already. If it's not already open somewhere, I don't really care which window it pops up in.
You can create another workspace and in that workspace create a new project from the same src code (same files in file system) of the one in your current project in your current workspace.
That would let you stop on one breakpoint without the other window stopping their too.
Notice that after you make some code modifications in one project you'd have to refresh the other project for those changes to apply in it.
Eclipse switches to the debug perspective for all windows the debug perspective has been opened once (i.e. the little icon on the right top corner is available). If you close that perspective (switch to another perspective is not sufficient), it won't switch to it anymore on that window.
At least, that's the behaviour I observed on Kepler (I know, that question is older but just came across, maybe it still helps someone).
This worked for me:
In Window->Preferences->Run/Debug->Launching->Launch Configurations enable "Apply window working set(s)"
Personally I find this more efficient than creating two workspaces.
Closing the Debug perspective (righ-click on the little icon on the right top corner) worked for me.
I'm using Oxygen and I have the following settings in the Run/Debug Preferences:
Open the associated perspective when launching: Never
Open the associated perspective when an application suspends: Prompt
Maybe you select the sources for Debugging by "File System Directory" instead of by "Java Project". To change this go to Run=>Debug Configuration=>Add Sources=Button: ADD...=>Java Project and select your Projects.
Make sure, that the added sources are found first by moving them to the top.
To disable multiple debugging in multiple windows in eclipse, go to Windows > Preferences > Run/Debug and uncheck Activate the debug view when a breakpoint is hit

Categories