When I create a new Java project or open an existing one, IntelliJ doesn’t highlight any of the text nor does it suggest anything. All the code is 1 single color. I’ve marked my src file, made sure power safe is off, made sure highlight is enabled, and even reinstalled IntelliJ CE. I’ve also disabled all plugins. Any suggestions is appreciated.
picture here
Your screenshot shows that the file is not recognized as a java source file.
Go to Preferences -> Editor -> File types
Scroll down in the list of Recognized File Types and click Java.
In the list of registered patterns make sure it shows *.java.
Also ensure the file is not marked in the Ignore files and folders section at the bottom of this preferences panel. Perhaps you added it by accident (with some shortcut).
Also, while reinstalling IntelliJ, you have probably imported your previous settings. With it, you inherited this issue.
If this doesn't help, please share a screenshot of your project/module structure and setup.
Last but not least, try to create the file using the context menu. E.g. try to right click on your src folder and select new and select Java class or Package from the options. Would be good to check anyway, to see if these are valid options. If they do not appear here, it indicates the project setup is erroneous.
Solved! Thanks to #yole I did the following 'make sure that the *.java extension is listed in "Registered patterns" for the Java file type in Settings | Editor | File Types".
Related
So I'm trying to add jar files to a java project.
I've been told the following:
If you want a more beginner-friendly way of adding libraries, you can
also use the Project Manager for Java extension, which is included in
the Java Extension Pack. With it, you can click the + icon on
Referenced Libraries in the JAVA PROJECTS view, as shown in this
example. A quick tip if you need to add many libraries from a folder
is to Shift or Alt + click the + icon, which will let you select an
entire folder containing multiple .jar files.
After installing Project manager extension and creating a new Java project in VS code, I get to this screen.
As mentioned by VS code, I should be able to see the project view tab after creating my java project. The issue is I don't see the project view tab as shown in the image above. VS code says I should see the 3 dots by the explorer subheading to enable it, but again, I don't have these 3 dots as shown in the first image.
I have both project manager and the extension pack installed, so I really don't understand why I cant see or enable project view.
Any suggestions on enabling project view?
Have you tried to open a java file? Because the extension activated depends on the opened filename extension.
You can refer to here.
If it still does not work, could you provide the OS and the versions of the
VSCode and extensions?
I have struggled quite a bit with this and none of the 'obvious' solutions worked.
The way I ended up solving the issue is by creating a new Java Project and looking at the difference in the config of the files.
Especially in the .project file, there were missing entries. Some also in the .settings/*.prefs files
After updating those in my own project, it got detected properly.
As for the 3 dots, here's what I think: different versions may be slightly different, you see, there are no three points in this one enter image description here. So you may update it when you are free.
As for the project view, you may have to open a project before it appears, Steven-MSFT has said it in detail, you can see it first. If you still have questions, you can provide some details again.
Anyway, you can try the following 2 steps:
open a .java file
reboot your vscode
I am new to Java programming language and the IntelliJ IDEA 2017.1 IDE.
I just installed the IDE and I activated all the various inspections but the IDE is unable to detect the errors any time I make a mistake such as omitting a bracket or a semicolon.
This image displays the activated inspections:
This is a screenshot of my code with multiple errors but no detected by the IDE:
Kindly help me solve this problem.
Java file is not analyzed since it's located outside of the source root. You need to either relocate the file or reconfigure your content roots so that it resides under the folder configured as the Sources root.
Sources root is marked in blue in the project view. Here is the example of the properly configured project (notice the class icon is different than on your screenshot):
One more reason could be IntelliJ is running on power saver mode, this could be disabled following way:
File Menu -> Power Saver Mode
This is finally what worked for me! Phew!
My Problem: Whenever I exit Intellij and try to open up an old/existing project, I have trouble getting the builds and execute to work on my localhost. I'm just using localhost.
Here are the steps that finally worked on my localhost environment:
1. Go to Project Structure and Select Project
a. Set the SDK to 10 (“Java Version 10.0.2”) or whatever you are using.
b. (I think this was the main step I was missing) Set the project compiler output to point to where I want the compiled output to sit: C:\Users\kbala\OneDrive - MatrixCare\SoftWLearnings\Javamyfun\NewHelloWorld\out
c. Project Language Level: I chose “SDK Default”
2. Go to Project Structure and Select Modules
a. Click on src (this is where my source code sits).
b. Then, Click on the “Sources” folder icon on the top. This adds src to the “Source folders” on the right. You will see the color change to Blue
c. Click ok.
3. Then, click on “Add Configuration” (top right corner of Intellij)
a. Select + at the top left hand corner.
b. Select “Application”
c. Change the name to “Main”
d. Now click on the Ellipsis (three dots) in “Main Class”. You should now see your Main Class. Select it.
e. You should now see the execute arrow at that top right of Intellij. And you should see the build icon (Hammer).
This should work!
If you use a build system (Maven, Gradle, etc.):
Open its panel in IntelliJ, then click the reimport button. For Gradle, this button looks like a sync icon and its hovertext says "Reload All Gradle Projects".
Why it works:
Since the build system is in charge of compiling your code, it knows which files are source code. It would be a waste of computing power to look for missing semicolons in a compiled binary file, so IntelliJ won't try to find errors until it knows the file is source code.
Most build systems, Maven and Gradle included, are also dependency managers. When you write code that uses libraries or depends on a different module, IntelliJ needs to be able to understand the dependency to tell you whether your code makes sense, or whether you made a mistake like forgetting an import statement or passing the wrong type of argument into a library function. When IntelliJ doesn't understand your dependencies, it displays all your uses of imported code in red text.
I was getting the same issue, I just clicked on the re-import button on the maven panel and it solved the problem .
I had the same issue and here it is how I solved it:
Some files where ignored and I Unignored them. To do this go to Maven tab on the right panel -> right click on each project that is in grey color and click Unignore projects.
I'll add an another reason for it. For me it was Reader mode enabled. I was not even been aware of its existence. Can be disabled in Settings -> Editor -> Reader mode.
In my case was a maven option!
When you open the proyect in intellij, it create a notification.
There is no syntax highlighting in java files in my eclipse..This happened all of a sudden..Not sure why..
This is how it is looking now..
As mentioned in other posts..i tried to change the color from preferences window and there is nothing when i type java..something really messed up...
AAny suggestions..
Update:
It seems Java plugin is not installed..as per the below screeenshot
And when i try to install java plugin it says new version is already installed as per the below screenshot
Closing the file's tab and re-opening it fixed it for me.
(I actually closed all the tabs...)
I faced the same issue all of a sudden after a commit/update project operation.
The point is, default editor of Eclipse has changed somehow and we have to set it back to normal.
Try the below method,
1. Goto Windows -> Click Preferences
2. From the Preferences window goto General -> Editors -> Click File Associations
3. You can choose the default editor for *.java files here
When I first opened Preferences, 'Text editor' was set as the default editor for .java files and then I changed it back to 'Java Editor'.
Now it works perfectly fine.
You probably have a corrupt installation or you have recently installed a corrupt plugin.
The following steps might help.
In your Install window,
view your "already installed" plugins.
select the "Installation History" tab.
select a previous stable configuration
Click the "Revert" button
TLDR; open another workspace, then come back to the original workspace.
Ok this is odd, but for me, all the highlighting suddenly went away for Java files. I explored all of these ideas here, with no effect. I created a new workspace, planning to move everything to it. I realized that can be a pain to move many projects over, so I went back into the original workspace to look at some settings, and poof - the highlighting was working again.
I have one java class file like a text editor.
I tried following,
Select the respective java class file from eclipse.
Right click on the file and mouse hover on "Open with".
Select java editor.
Now its works.
I'm working on a Java project in eclipse. Trying to open a file through Ctrl+Mouse click, I got a popup that asked me if I want to add "Xtext nature to my project". I said ok. And now, I tried to put on a CSS file the following line:
#import "myfile.css";
as first line. But I get this error, because of Xtext Check (fast):
missing EOF at ';'.
Can anybody help me on how to deal with this kind of error?
Thanks.
You have two ways to solve this issue:
First, you could uninstall the plug-in contributing the CssDsl editor. A quick Google search told me that it is contributed by the e(fx)Eclipse plugins. To uninstall a plug-in, go to the About dialog, click on the Installation details feature, and in the upcoming dialog you could look for the feature to uninstall.
If the previous solution does not work for you (e.g. you need the e(fx)Eclipse environment), you have to change the default file associations to avoid opening css files with the Xtext-based editor, and remove the Xtext nature from the projects you added.
Setting file associations: open Eclipse Preferences, navigate to the General->Editors -> File Associations page, where you can look for the CSS extension, and select a different default editor for it.
Removing the Xtext nature: you can right click on your project, and select Configure -> Remove Xtext nature. If that does not work for some reason, you have to open the hidden .project file, and remove the <nature>org.eclipse.xtext.ui.shared.xtextNature</nature> entry and the corresponding org.eclipse.xtext.ui.shared.xtextBuilder buildCommand manually.
I had the same error, when I was creating CSS via New -> Other... -> Web -> CSS File.
Zoltan's solutions did not work, but when I create the file with New -> File and name it *.css the error did not occur.
I have a problem with Eclipse Indigo regarding library source code. When I open a library class (e.g. from the JDK, but also from some other included libraries, such as Guava), either using the Open Type dialogue or simply through Ctrl+ click on the class name or some of its methods, once in a while (not always) something breaks.
Don't get me wrong, the source is always displayed without any problem (either JDK source shipped with the JDK itself or Guava source downloaded by Maven). What actually stops to work:
When I open the Quick Outline popup in that given class using Ctrl + O, the list of methods and fields displays normally, but when I click on any of them, Eclipse doesn't move the view on it as it should. Also Ctrl + clicking any of the methods or fields of that class in my code doesn't bring me directly to it, but simply at the top of the source file.
When I hover over that said class or its methods, no JavaDoc appears in the popup as you can see in the attached image. I am in the HashSet class, the source is clearly there, but it isn't displayed in the popup.
I found out that this can be fixed by opening the Outline View and briefly clicking through the class's methods and fields. After a few clicks, Eclipse catches on and starts to work correctly, but only for this one class, not for all which are broken in this way at the moment.
Has anybody met this kind of bug? Is it tracked at Eclipse Bugzilla? Thanks in advance for any advice.
For completeness, this is my configuration:
Windows 7 Professional x64
Oracle JDK 1.7 Update 2 32b
Eclipse Indigo for Java EE Developers 32b
your issue #2 may be resolved by following these steps :
Go to http://java.sun.com/j2se/1.5.0/download.jsp and choose to
download the JDK 5.0 Source Code.
For JDK 5.0, select Download(SCSL source).
Download JDK (SCSL) 5.0 (1.5.0). This will give you a file jdk-1_5_0-src.scsl.zip. You do not need to unzip this file; Eclipse likes it the way it is.
In Eclipse, go to Projects -> Properties -> Java Build Path -> Libraries and expand JRE System Library [jre 1.5.0], then rt.jar. Select Source attachment and click Edit...
Select the above zip file. and Finish by exiting the dialog boxes.
source
Hope this helps..
Sounds like wrong sources are attached to the libs inside Eclipse.
I had similar symptoms in a project where a class exist in both: inside a lib and in the project's src folder. Same canonical class name, but different implementations.
I would recommend to verify (or reinstall) your JDK-Installation and re-configurating it in Eclipse.
Hitting Ctrl+Shift+T and typing HashSet and taking a screenshot of that window may help here, too.
To answer my own question, I didn't find out how to solve the problem in Indigo, but updating to Juno fixed it.