In Eclipse IDE there are icons to display the project type, but I can't find a text description. I would expect right click -> properties to show this info but according to this all projects are of type "project" (even if they are a java project, or maven project etc.)
Does anyone know?
Thanks!
According to this, you won't find the text description in Eclipse GUI.
One way is to go to the root folder of your project, open the file named .project and check the elements in the tag <natures></natures>.
But don't worry about that, these icons are often explicit.
Related
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".
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.
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 Java Project in Eclipse, and a Java Dynamic Web Project in Eclipse. In the former, all the jar files are shown individually under the top-level project folder. In the latter, the jar files are under a Libraries folder and the navigation is more convenient.
Is it possible to organize them in the same way in the Java Project also? If so, how?
Update: It is the Project Explorer View. For the Java Project, I see: "my_project_name" with the arrow expanded to point downwards, then I see: "package_icon src/main/java" and below that "package_icon src/main/resources" and then 20 jar files one below the other: "jar_icon activation-1.1.jar", ...
For the Java Dynamic Web Project I see: "my_project_name" as above, then I see: "JAX-WS Web Services" (unexpanded), then "Deployment Descriptor" (unexpanded), then "Java Resources" which I have expandeded, so I see the components of it below, of which the first is: "package_icon src/main/java", then below it, "package_icon src/main/resources", then below it "libraries_icon Libraries" instead of 20 jars! I have the option of expanding Libraries if I really need to see the 20 jars.
The only option I found to make things prettier in Eclipse Kepler is to:
In the Project Explorer window there is a down arrow in the upper right corner. Select that and then Customize View.
Select 'Libraries from external' and then OK.
Kind of cheesy...
EDIT: Of course I had to go and do some more digging...and it looks like I'll have to try this and see how it works.
Similar to M Miller's answer (but for Juno), click Show 'Referenced Libraries' Node in the dropdown of the Package Explorer window:
I'm using:
Eclipse IDE for Java Developers
Version: Juno Release
Build id: 20120614-1722
I noticed this "feature" on Eclipse Juno (latest version), when you have a jar file added to the build path it is not shown as a single file on the project.
Try removing one of the jars from the build path to see if it shows up again.
I couldn't find how to turn it off though.
BTW... the project layout for your "Java Project" is more akin to a "Maven Project", which is a bit more powerful.
You should change into the Package Explorer by Window > show View. It will display all the referenced libraries in a Referenced Libraries folder.
I checked out a project from SVN and did not specify the project type, so it checked out as a "default" project. What is the easiest way to quickly convert this into a "Java" project?
I'm using Eclipse version 3.3.2.
Open the .project file and add java nature and builders.
<projectDescription>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
And in .classpath, reference the Java libs:
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>
Manually changing XML and/or settings is very dangerous in eclipse unless you know exactly what you're doing. In the other case you might end up finding your complete project is screwed. Taking a backup is very recommended!
How to do it just using Eclipse?
Select project.
Open the project properties through Project -> Properties.
Go to "Targetted Runtimes" and add the proper runtime. Click APPLY.
Go to "Project Facets" and select the JAVA facet which has appeared due to step 4. Click APPLY
Set your build path.
If it's a Maven project, you might want to select the project, click Maven -> Update Project configuration...
That did it for me. And Eclipse is configured correctly. Hope it'll work for you too.
In recent versions of eclipse the fix is slightly different...
Right click and select Project Properties
Select Project Facets
If necessary, click "Convert to faceted form"
Select "Java" facet
Click OK
I deleted the project without removing content. I then created a new Java project from an existing resource. Pointing at my SVN checkout root folder. This worked for me. Although, Chris' way would have been much quicker. That's good to note for future. Thanks!
Using project Project facets we can configure characteristics and requirements for projects.
To find Project facets on eclipse:
Step 1: Right click on the project and choose properties from the menu.
Step 2:Select project facets option. Click on Convert to faceted form...
Step 3: We can find all available facets you can select and change their settings.
In newer versions of eclipse (I'm using 4.9.0) there is another, possibly easier, methods. As well as Project Facets, there are now Project Natures. Here the process is simple get the Project Natures property page up, and then click the Add... button. This will come up with possible natures included Java Nature and Eclipse Faceted Project Properties. Just add the Java Nature and ignore the various warning messages and your done.
This method might be better as you don't have to convert to Faceted form first. Furthermore Java was not offered in the add Facet menu.
Joe's approach is actually the most effective means that I have found for doing this conversation. To elaborate a little bit more on it, you should right click on the project in the package explorer in eclipse and then select to delete it without removing directory or its contents. Next, you select to create a Java project (File -> New -> Java Project) and in the Contents part of the New Java Project dialog box, select 'Create project from existing source'.
The advantage this approach is that source folders will be properly identified. I found that mucking around with the .project file can lead to the entire directory being considered a source folder which is not what you want.
You can do it directly from eclipse using the Navigator view (Window -> Show View -> Navigator). In the Navigator view select the project and open it so that you can see the file .project. Right click -> Open. You will get a XML editor view. Edit the content of the node natures and insert a new child nature with org.eclipse.jdt.core.javanature as content. Save.
Now create a file .classpath, it will open in the XML editor. Add a node named classpath, add a child named classpathentry with the attributes kind with content con and another one named path and content org.eclipse.jdt.launching.JRE_CONTAINER. Save-
Much easier: copy the files .project and .classpath from an existing Java project and edit the node result name to the name of this project. Maybe you have to refresh the project (F5).
You'll get the same result as with the solution of Chris Marasti-Georg.
Edit
Another possible way is to delete the project from Eclipse (but don't delete the project contents from disk!) and then use the New Java Project wizard to create a project in-place. That wizard will detect the Java code and set up build paths automatically.
Right click on project
Configure -> 'Convert to Faceted Form'
You will get a popup, Select 'Java' in 'Project Facet' column.
Press Apply and Ok.
Depending on the Eclipse in question the required WTP packages may be found with different names. For example in Eclipse Luna I found it easiest to search with "Tools" and choose one that mentioned Tools for Java EE development. That added the project facet functionality. Searching with "WTP" wasn't of much help.