AntSecurityException when opening ant-file in eclipse - java

one in a while eclipse refuses to open antfiles. The error log tells me that an "AntSecurityException" is the cause. The javadoc for org.eclipse.ant.core.AntSecurityException tells me that the exception is thrown when an ant task wants to stop the jvm. But just opening an ant build should not start any targets or tasks. The only solution is to restart eclipse.
Does someone know how to stop this rather irritating behavior of eclipse.
Regards, Jan

I have never come across this exception myself. Just out of interest what version of Eclipse are you using?
I did find a solution on the web regarding this though and it is in the folding option of the Ant editor. Try disabling the folding option for Ant editor by going:
Windows -> Preferences -> Ant -> Editor -> Folding tab. Uncheck 'Enable folding'

For me disabling Folding did not solve the problem. I dig deeper and found Bug 143416 in Eclipse.
I could get rid of this by removing the xercesImpl.jar and xml-api.jar from the Ant installation that I used, not sure if you are facing the exact same problem or if there are multiple things that cause the exception to appear. It seems the version of xerces/xml-apis in my Ant (v. 1.7.1) interferes with the classes in Eclipse/JDK itself.

Windows -> Preferences -> Ant -> Show error dialog when ant fails

I have this problem very often.
Now I saw a setting Window-> Preferences-> Ant-> Editor-> Problems-> Security Problems.
I set it to Ignore and 'll see if it helps. :-)

Close eclipse , go to workspace, delete the .metadata, start the eclipse,
only one drawback you have to do all the manual setting again

Related

Java syntax highlighting and code suggestion stopped working for certain file

All out of a sudden, it stopped working, for both Eclipse Kepler and Luna.
Take a look at the following comparison:
This is the file with correct syntax highlighting and code suggestion still:
And this is the not-working one:
I have tried to use Eclipse's Help >> Check for updates but the problem persists.
I have checked the Content Assit under Preferences as suggested somewhere on StackOverflow:
Of course, I have cleaned the project, the whole workspace and restarted my Eclipse a few times.
What am I missing?
I had the same or a similar issue recently. To me it seems your Java highlighting is gone, either because your JDK selection is gone, or because you have a build error.
For the first:
Try Preferences->Installed JREs (select JDK)
and or:
Preferences->Installed JREs-> Execution Environment (select a JDK on the right window).
For the second: Have a look at your build file, e.g. pom.xml for Maven, and see if something has changed in this file recently (e.g. maven compiler plugin).

No completions available, strange Eclipse behavior

I think I tried every suggested solution, but this Eclipse auto-complete problem is quite particular:
I launch Eclipse, content assist works fine;
I want to create a LineBorder in my Swing project;
I type LineBorder panelBorder = new Li and hit Ctrl+Space;
No popup appears and in the status bar it writes in red "No completion available";
I try Ctrl+Space on the elements where content assist worked fine 2 secs earlier, it doesn't work anymore.
I try the same thing on other project, on the same project after closing and reopening it, after cleaning it and content assist works just fine before I try using LineBorder constructor, then it crashes.
What I tried:
Reset to defaults in 'Preferences->Java->Editor->Content Assist->Advanced';
Check every single checkbox in the same menu;
Create a new workspace and try it there;
Delete .index files and 'savedIndexNames.txt' in .metadata/.plugins/org.eclipse.jdt.core;
Check for the duplicate libraries.
What I didn't try is reinstalling Eclipse. The version I use is Eclipse IDE for Java Developers (Juno).
Nothing seems to work.
UPDATE:
Checked the logs as iGili suggested.
There are some exceptions raised at the time of failure:
org.eclipse.e4.core.di.InjectionException: org.eclipse.core.commands.ExecutionException: While executing the action, an exception occurred
Caused by: org.eclipse.core.commands.ExecutionException: While executing the action, an exception occurred
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.eclipse.jdt.internal.codeassist.InternalCompletionProposal.findConstructorParameterNames(InternalCompletionProposal.java:257)
at org.eclipse.jdt.internal.codeassist.InternalCompletionProposal.findParameterNames(InternalCompletionProposal.java:1456)
at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.appendUnboundedParameterList(CompletionProposalLabelProvider.java:113)
at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.createMethodProposalLabel(CompletionProposalLabelProvider.java:272)
at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.createStyledLabel(CompletionProposalLabelProvider.java:570)
at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.computeDisplayString(LazyJavaCompletionProposal.java:262)
at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getStyledDisplayString(LazyJavaCompletionProposal.java:238)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.handleSetData(CompletionProposalPopup.java:841)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$24(CompletionProposalPopup.java:831)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup$3.handleEvent(CompletionProposalPopup.java:593)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
at org.eclipse.swt.widgets.Table.checkData(Table.java:1166)
at org.eclipse.swt.widgets.Table.wmNotifyChild(Table.java:6749)
at org.eclipse.swt.widgets.Control.wmNotify(Control.java:5534)
at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:1896)
at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5086)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4584)
at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1627)
at org.eclipse.swt.widgets.Shell.windowProc(Shell.java:2069)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:4989)
at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2440)
at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:564)
at org.eclipse.swt.widgets.Table.callWindowProc(Table.java:430)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4623)
and it goes on, I don't know what is the convention for posting long stack traces
I had the same. Windows -> Preferences -> Java -> Editor -> Content Assist -> Advanced. Make sure "Java Proposals" checkbox is ticked at default content assist list (1st panel of the pop up).
By clicking "Restore Defaults" button at the bottom "Java Proposals" could be checked automatically.
Go back to the Advanced Content Assist preference page and Restore Defaults. Close the dialog using the OK button.
I had the same problem. Actually I had the content assist pop up, but that was smaller than a couple of pixels.(Who shrunk this and why was it shrunk no idea whatsoever...)
But if you see something strange(in my case, that was the letters 'Rp', but I guess it can be anything) where normally the content assist should appear, try to expand it, and you might get it back. Good luck.
None of these answers helped me: Java Proposals was ticked, and restoring defaults didn't do anything. It started working only after I restarted Eclipse.
Windows -> Preferences -> Java -> Editor -> Content Assist -> Advanced ( Java Proposals) need to be choosen.
What worked for me was to create a new workspace and copy all the projects to that workspace. The issue now only occurs on the previous workspace.
I think you are running into a known defect in 3.6. see here
try to download a newer release- it is fixed since 3.7
[edit] I just realized that you've wrote 'Juno'- are you using the latest (4.2.2)?
I just fixed the same problem in Juno switching workspace and then switching back. Other solutions didn't work.
I had the same problem but in only one particular file in my project (completion worked fine on other files). I'm also using Eclipse Juno.
I fixed the problem by removing some warnings due to unused imports in the file where completion failed... and it started working again!
This checkbox "java proposals" will be ticked until I have failed and got "No completions available". After that, it will show as unticked the next time I am opening the settings.
Go to
Eclipse → Preferences → Java → Editor → Content Assist → Restore Defaults
and then
Project → Clean
I couldn't expand sysout this morning. After a couple of wasted hours, I found that I was trying to put System.out.println() outside a method. When I did it inside a method, it all worked perfectly.
I had the same issue just now with Eclipse version 2019-06 (4.12). For me a Project clean solved the problem.

Eclipse code completion automatic deactivation

Whenever I run Eclipse, it suddenly deactivates some completions tags (but not all) with no reason. This happens always during, when I write some code. At the start of Eclipse, everything is okay but after a while this problem occurs. Every time I solve this by resetting the preferences and restarting Eclipse. But it takes too much time and annoys me.
Is there a special Hot-Key to (de)activate some completions tags?
I would bet on a plugin malfunction. Try to reinstall Eclipse from scratch without any custom plugins, and add only what you need, then add them one by one until you run into this problem.
Alternatively, open Eclipse->preferences->install/update->unintsall or update (link)->configuration->view error log and see if you get any exceptions on any plugins, if you identify something fishy, uninstall that plugin.
In my case the Eclipse Preferences named Type Filters (under Java | Appearance) seemed to cause that experience. We had excluded all common root package names (com., org., sun.), but also java. and javax.*. After deaktivating those entries in the "Filter list" Eclipse's Ctrl-Space again provides the missed proposals.

Eclipse building the code again and again (without any changes)?

I am noticing a strange issue with Eclipse Indigo. It is Building Workspace again and again even though there is no change in the code!
In Progress bar it prints
Building Workspace 44%
..
Building Workspace 10%
..
Building Workspace 33%
Any idea what is going on here? For the time being I have unchecked the 'Build Automatically' flag.
I have tried the following trick couple of times and this seems to work more often than not:
Uncheck Build Automatically flag
Refresh all the projects in the workspace
Re-enable the automatic build after sometime by checking the Build Automatically flag
Note that as I mentioned earlier this is a trick and not a resolution. But, hope others facing these issues will find this helpful.
Yes, I have noticed that too and it can be rather annoying. I have reverted to manual compiling in Eclipse by switching auto-building off (under project).
Compiling manually is a bit old-school, but it works for me. I prefer to compile, package and test the code at the command line using maven.
(I'll probably get a downvote for this approach (i.e. not using integrated tools, etc.), but it works for me and it works well! At least I'm not using VIM for coding Java! :))
If you are using Windows 7, then the Windows indexing in some directories can cause automatic rebuilds in Eclipse: see Bug 342931 - Windows 7 Libraries trigger rebuilds.

Errors in Eclipse for no reason

I'm building an Android app.
I worked today on my app, and suddenly I saw that all the projects in the workspace are marked with an error. I don't know what caused it, and I can't find explanation of the error anywhere.
I'm using Helios with Windows 7. I even tried downloading Eclipse again but it didn't help.
Today I tried to integrate Facebook with my app. Their tutorial required me to try to get a hesh key from a keystore. In the process I added an Environment Variable named JAVA_HOME, and pointed it to the JDK.
I don't know if it's the cause of my problem, but I think it might be related.
I really don't know what to do.
Thanks!
Try this. In eclipse, go to Project --> Clean --> Select "clean all projects". This should rebuild all projects.
Try cleaning your android project. I get problems with Eclipse sometime, and if I clean the project, it fixes it.
Find the "Problems" view. That will give you more details. Post the description of the problems, we can get more information.
click Window -> Show View -> Problems
Typically, the problem is with a resource you've recently added to your project (drawable, assets, raw, etc.)
Some things to check are:
Invalid XML files
Invalid 9-patch images (outer 1-pixel border must be full black or transparent)
Typically, just start by removing a resource, then cleaning your project (Project > Clean). If the errors go away, that resource is your problem. If not, continue this process until the error DOES go away. Start with the most recent resources you've added, naturally.
i solved error or all project showing errors this way.... close eclipse.
then Right Click on eclipse shortcut-->open file location-->open command widows there and type "eclipse.exe -clean" eclipse the starts..and in my case errors were gone...hope it helps

Categories

Resources