what does cross sign means in eclipse - java

I have a project opened in eclipse, its a java web application. In eclipse I can see that there is a red cross sign with my project name, On expanding my project I can see many files have the same red cross sign.
What does this cross sign means in eclipse? Is it showing some compilation error? if error how can I see the error? Also what does that triangle icon means?
Please check the screenshot above and see the cross and triangle signs...

The cross on red ground means an error in this file, while a question mark on yellow ground indicates a warning. You can see them in the Problems tab in eclipse:
You can customize what is treated as an error and as a warning under Window -> Preferences and then search for errors/warnings (Also take a look at the docs: Java Compiler Errors/Warnings Preferences
In addition to the markings on the resources, you can see errors and warnings in an open file next to the scroll bar:

Cross sign shows the error in that Source,Triangle indicates that your source has some warinings
Just open those files could find the Red x under line and marks in the source editor , if warnings will be displayed as Triangle with ! in the side bar of the source editor
If your source code is large then you can use shortcut ctrl + . to see the errors in the source file. The following shortcuts will move to the warnings and errors from top to bottom in your eclipse
Few shortcuts to see the errors in eclipse:
Next error: `Ctrl + .`
Previous error: `Ctrl + ,`
Quick fixes: `Ctrl + 1`

The cross sign indicates that the file web.xml has some error. Also, possibly some files within the 'jsp' and 'lib' directories also have error.
The yellow triangles are warnings. To see the details of all, Go to Window -> Show view -> Problems

I don't see anyone mentioning one thing that may be confusing to a beginner: the red X appears on the file with the error as well as on all its parents. These other marks are a great convenience when your tree is collapsed—they lead you to the file in error, but can also cause confusion when viewing an expanded tree.
Every error marked with the red X annotation also appears in the Problems view, if the view's filter is properly configured. You configure the filter through the view's local menu (accessed through the little downward-facing triangle in the top-right corner of the view's title bar).

It means your projects contains error, if appears red-cross.

It seems that your project contains error,if it shows red-cross
General way you can see Window > Show View > Problems
The easy way using shut cut key Alt+Shift+Q,X

Yes, it means you have an error, whereas the yellow triangle with the exclamation mark means you have a warning.
You can view the error by opening the file. The line with the error will an error mark on the left margin.

Related

What's this grey triangle arrow means in IntelliJ?

What is this icon?
Some codes are "hidden" because of this icon, when I click it, the IDE pops up the code snippet that's supposed to be there before, since codes disappeared, I can't reference it from other files either.
If you are using a version control system (such as Git) in the project you are working on with the IDE, you will see these marks on the files (See sample images below).
File content
Grey triangles: deleted content
Blue rectangles: changed content
Green rectangles: added new content
These are seen when the changes are not yet committed. Once all the changes are committed the marks are gone.
If you click on those marks you will see the content that was there before the change took place.
Files
The same principle is applied for files (see below images)
Green: new file
Blue: modified file
Grey: deleted file
While working you see the files like this (deleted ones are omitted):
And, by the time you're committing changes you will see them like this (you see all files changed):
See official doc for more info.

"Cannot resolve symbol "R" - all XML android:ids are correct

I edited a small amount of my xml code
(tried to add an android:src"#drawable/" but it didn't seem to like it so I deleted it after)
and my java code (added Troop1P1.setVisibility(View.VISIBLE); to the end of an OnClickListener,
and again deleted afterwards [I had already used findViewByID for Troop1P1]).
However, my whole code has now stopped working, with every "R" in (R.id.) being highlighted, with the text "Cannot resolve symbol "R"" when hovered over.
In addition, when I run the code I get the following error:
error: Error: No resource found that matches the given name (at 'layout_above' with value '#id/btnTroop1P2').
However, I've checked and I'm fairly sure I've correctly id'd btnTroop1P2 using android:id="#+id/btnTroop1P2", so I can't find any problems there.
I'd really appreciate any help, I just want to be able to run my project again!
are you using Eclipse? .if yes go to Project -> Clean... -> Tick your project name -> OK.
Give that a try. I always get similar problems and this solves it for me anyway.
When this occurs, it's usually because you have an error in your layout XML. When an error exists there, the R file is not generated. Therefore, Cannot resolve symbol "R" is the only information Java can give you. Go back into your drawable, layout, or any other XML you've been playing with and make sure you have everything properly formatted.

Weird compile error in Eclipse and Netbeans

I am getting an error : Syntax error on tokens, delete these tokens, on valid Java code
My code, copied and pasted from eclipse, is here :
public class Test2 {
    public static void main(String[] args) {
    }
}
I am guessing that there is some hidden character in the code which I can't see.
I tried restarting Eclipse, and cleaning the project, but the error is still there!
Even if I copy and paste this code from SO into eclipse the error is still there!
what is going on here?
EDIT
Its not Eclipse! In Netbeans I get the same error :
Also, the original problem occurred when I tried to copy and paste code examples from this webpage http://blue-walrus.com/2011/05/advanced-swing-multithreading-tutorial/
I just did the following:
Cut and paste the code from your Question to a file and compiled it using javac (Java 8). No compilation errors.
Opened Eclipse (Kepler), created a Test2 class, copied the code from the Question to it, and saved it. No compilation errors.
My tentative conclusion is that there is nothing wrong with the java code. (No funky hidden characters, no nasty homoglyphs, no messed up character encodings.) The most likely cause of these weird errors is that your Eclipse session is messed up:
Try restarting Eclipse.
Try closing and opening the Project.
Try loading your code into a fresh workspace.
In extremis ... try a fresh install of Eclipse (same version as before ...)
Following on from my comments your project must have a valid JDK and JRE defined
If these are missing from your project, go to Window > Preferences> Java Installed JREs and click Add..
If you make any changes select Project > Clean... again
To remove these strange hidden empty space characters, I copy and pasted into Outlook Email, and then copy and pasted into Notepad++, and then copied into Eclipse. All fixed :)
Seems you need to copy and paste situations like this through a few different apps, to 'scrub' the text of any funny characters.
I think the java class path is not set in your computer if that is the case go to my computer->properties->Advanced System settings->Advanced tab click Environment variables find variable path & check if the java class path is there. If its not there i suggest you to copy the java class path & edit variable path & paste the url followed by ";" & then restart the eclipse.
better to check your project build path i.e, JRE system library version/is that set or not in the eclipse
way to go for properties section of eclipse :
right click on project - > choose properties ->build path->Libraries->Add Library Variable->JRE system library->click Add alternate JRE radio button->and select your machine jre->click finish->OK
after that go for java compiler in the same window (left side)->check the enable project settings->and choose your java version from drop down box->click Apply->OK
finally save your program and run it
if it again fails you need to check whether you are setting the classpath in proper or not, for this
please refer this link to set classpath :Link
ZWSP and other non-printing characters
Means a Zero-Width-Space character. You are using UTF8 and some characters have a width of 0 so you can not see them.
Change the Encoding to ANSI and back will solve your Problem.

Why do I get the message "source not found" from Eclipse?

I'm new to Eclipse. When I debug and enter some function, I get the message
"Source not found" despite the code is mine. How can I solve this issue? Is there an addon that might help?
I get error class not found exception with source not found but when I press for F6 (lot)I proceed with the debugging ,the issue is just when I press F5 and want to dive in to some method code (of mine btw that just on different package)– FedorE
You need to add your source code in the debug configuration:
Perform the one of the steps below:
Option1:
Right Click(Java Source) -> Debug As -> Java Applications
Option2: If option1 doesn't help:
Menu ->Run ->Debug Configurations..-> Java Applications ->RightClick & select New.
In right side,
Enter Name
Browse your Project and the class having `main` method
In Classpath, add your project from workspace
Click Debug button in the bottom
Let me know, if it doesn't help.
That is because , while you are in debug, the debugger enters part of code which does not have attached source files.
what you can do is,
IF you have got the source to that file :
when you see that source not found screen, there would be a Attach Source button. press that, and browse to file that should contain source for that class. and hit ok. eclipse will load the source and you would be good to go.
Sometimes debugger on repetitive step into enters some API classes or plugins whose source you may not have, then your best bet is to repetitively press F6 till debugger exists that class

Eclipse autocompletion problem

Just installed Eclipse Helios (Win7 64) and I'm having a strange problem. I type syso-Ctrl-Space which is expected to complete to System.out.println("") but it doesn't work! I searched the web for about an hour now, I set Preferences > Java > Editor > Content Assist to defaults, nothing. Everything else seems to work. Ideas?
To be clear: the shortcut works, it completes everything except "syso" as seen so far, on syso (also tried sysout) it says "No Default Proposals". I couldn't find this kind of shortcuts in the Content Assist, but I set them to default anyway.
If you still cant get auto-completion working,try enabling the Template proposals under Content assist menu.This is the exact location,
Windows->Preferences->Java->Editor->Content Assist->Advanced
And make sure you have only one entry for syso(Under Templates menu).
I believe the right template is "sysout" and I believe this can be configured somewhere but could not tell you where. Try sysout and then Ctrl+Space
It's a template, you can find all templates under
Window -> Preferences -> Java -> Editor -> Templates
There you can see that the template name is "sysout" this will then trigger the string substitution for System.out.writeln() but you can change both the template name (if you prefer syso) and/or the actual code produced by invoking the template
Cheers
I am using Eclipse Galileo and had the same problem. Even after trying the above proposed solutions but it didn't work. After making the below change it finally comes out.
Go to Windows->Preferences->Java->Editor->Templates
Select sysout template and edit it.
Change the context from Java statement to Java.
And it worked for me. I hope this will be helpful for you.
As Peter stated, it is under Window -> Java -> editor -> templates.
Look for the line with the following values.
sysout "Java Statements" "Print to standard out" "on"
the preview should be as follows...
System.out.println(${word_selection}${});${cursor}
Your cursor needs to be located in a place where it would be legal to get that line. If your cursor is within a method definition and you type syso you will get the replacement. However if your cursor is in the portion of the text outside of any method definition, say where you declare variables for your class for instance, then syso will not suggest the illegal line system.output.println();.
I had this problem, read all the answers here, became convinced that it MUST be working in my copy, and realized I had been typing syso BELOW the closing } of my last method instead of in the method.
Eclipse on!
You may try to set the shortcut of Content Assist with ALT+L, if it works, then you can choose your favorite shortcut again. (The shortcut Ctrl+Space conflicts with the shortcut of switching input method). In eclipse on linux, the shortcut of Word Completion is ALT+/, so if you set this as the shortcut of Content Assist it also conflicts.)
Just go to the below address:
Windows->Preferences->Java->Editor->Content Assist->Advanced
and click restore default..........that's all
its work like a charm again.
Also check in this eclipse menu:
Windows -> Preferences -> Java -> Appearance -> Type Filters
If you see java.* or javax.* here then try removing it (or Restore Default will do the job) and see that works, it did for me.
Just found the solution for Eclipse Luna: write syso and press CTRL+Space and click on "enable intelligent code completion" and you are set.
I am sure you can find it somewhere in the options as well but this way it is fast and easy!
DIRTY WORKAROUND:
You can try out the following AutoHotkey-Code if you're still struggling like I am (STILL haven't been able to fix it myself)
#persistent
#ifwinactive ahk_class SWT_Window0 ; eclipse java
:*:syso::
sendraw System.out.println()`;
loop, 2
send {left}
return
#ifwinactive
You need to write this in a .ahk file and run it (AutoHotkey needs to be installed). You might wanna put this file into your startup folder. It's a very useful tool, you might wanna expand it one day.
You might have overlapping shortcuts.. Goto 'Overview' than the 'Keys' subsection. Type "ctrl +space" in the 'filter text' section. You should see the "content assist" and probably another command with the same shortcut. If another shortcut does exists, change its shortcut to something else.

Categories

Resources