Eclipse IDE's Java Build Path has changed. Which do i choose? - java

I am trying to follow some tutorials on Selenium, but get stumped at this point.
Right-click on "project" and select Properties.
On the Properties dialog, click on "Java Build Path".
Click on the Libraries tab, and then
Click on "Add External JARs..
The Add External JARS button is grayed out, and disabled.
The dialog shows Modulepath and Classpath.
If I pick either of these, the buttons are enabled.
The question is, which one do I pick?
I am trying to add the selenium WebDriver's into Java Build Path.

Select Classpath for the previous/legacy behavior.
Modulepath is for modular Java 9 applications.

You have to select Java SE 1.8 while creating project.

Related

I don't get importing Maven Project options

I am new to Java
I have been trying to compile my open source application
with provided steps
Import Project from Maven
1. Start IntelliJ IDEa.
2. In the "Quick Start" menu, select "Import Project".
This will open a "Select File or Directory to Import" dialog.
3. Browse to your local cTakes repository root directory and select the pom.xml file.
4. Click "Ok".
This will open an "Import Project from Maven" dialog.
5. Make sure the "Search for projects recursively" box is selected, just in case any cTakes modules are not in the pom.
6. Make sure that "Create IntelliJ IDEa modules for aggregator projects" is not selected.
If you plan to add new module, 'disable' a present cTakes module or make other changes to the main pom.xml, check the "Import Maven projects automatically" box.
See also: http://www.jetbrains.com/idea/webhelp/maven-importing.html
7. Make sure that "Create module rgoups for multi-module Maven projects" is not selected.
8. Make sure that "Keep source and test folders on reimport is selected.
9. Make sure that "Exclude build directory (%PROJECT_ROOT%/target)" is selected.
10. Make sure that "Use Maven output directories" is selected.
11. Make sure that the "Generated sources folders" option "Detect automatically" is selected.
12. For the "Phase to be used for folders update" the default option "process-resources" should be fine.
13. For the "Automatically download" options, you may select what you like, but be wary that if broken code has been checked in you may need to revert manually.
14. The default "Dependency types" are fine.
15. Click "Environment settings...".
This will open a dialog that can be used to set options about the Maven environment.
16. The default maven environment settings should be fine. If $M2_HOME is not set in your environment you may select a "Maven home directory", but it is better to set $M2_HOME in your environment.
17. Click "Next".
This will inspect the cTakes Maven settings and search for profiles. It should display a dialog with the possible cTakes profiles.
If you plan to run the UIMA CVD or CPE then select the appropriate profile. Neither is necessary
18. Click "Next".
This will open an "Import" dialog with the current version of cTakes displayed.
19. Click "Next".
This will open a dialog allowing you to select a Java SDK version.
20. Click the "+" button in the top left.
This will display a drop-down box with options for an SDK.
21. Select "JDK".
This will open a dialog to select a Java JDK directory.
22. Navigate to a directory with a JDK version 1.8 or later and click "Ok".
This will display a listing of the file paths associated with the selected JDK.
23. Click "Next".
24. Click "Ok/Next"
The project will load. This may take a while.
25. Important: If you are asked about adding any .iml files to svn, click "No".
26. You should now see the full cTakes project structure in IntelliJ.
I get everything up to step 4
but step 5 does not exist in my case
I mean in step 5
5. Make sure the "Search for projects recursively" box is selected, just in case any cTakes modules are not in the pom.
There are no options I get, it immediately takes me to the IntelliJ project
I get this screen
after I ckick finish , it takes me to this
Am I using older version? or doing something wrong?
How to get the Maven options as the instructions suggested?
It appears that you're in a unique position where the import and the recursive scanning of projects has Just Worked™ for your use case.
Given that IntelliJ IDEA 2019.3 came out at the end of November 2019 and I'm not reasonably convinced that those instructions were written or revised between the end of November and now, it could easily be the case that the instructions you've seen are out of date.
The big thing to be sure of is that your subprojects also build. On the right-hand side there, you have a list of Maven projects. Any one of those should be subprojects. Be sure that any Maven build command (e.g. mvn clean install) executes in the context of that subproject.

How to configure/Run an Ant Java project in Eclipse

I have a working java project (in ubuntu 12.04LTS, configured and compiled using ant). Is there a way I can configure and run it in Eclipse? Every time I try to load it in eclipse it gives a bunch of errors because of packages not being where its expecting I guess. Also, it will help if you could tell whats build path. I'm using Eclipse Java EE IDE Kepler Release.
My project structure looks like this:
project
build.xml
build.properties
build.common
projFolder - proj code, 3rd party lib/bin/src,
commons - proj code, ui code, 3rd party lib and binaries
dist - has a bunch of scripts and jars and may be some binaries
And how I got my project in Eclipse (this is probably not the most efficient way to have the project running in Eclipse, not sure)
I did new->java project then enter project name, unchecked 'use default location' and provided the location of my project so it imported my project in eclipse. then in my classes i have all the errors (red cross at the display) and it says imports cannot be resolved, objects can't be resolved to a type and such.
import com.psid.codedata.projects.TProjectDRD;
import com.psid.codedata.projects.TProjectsDRD;
error on above imports:
The import cannot be resolved
It probably needs you to add all your source folders to the build path:
Right-click on your project and select Properties,
Along the left-hand side click "Java Build Path",
Click the "Source" tab if it isn't already selected,
Click the "Add Folder..." button on the right-hand side,
Select whatever your source folders are in projFolder and commons,
Click the "Libraries" tab,
Click the "Add JARs..." button on the right-hand side,
Select whatever your libraries are in projFolder, commons and dist,
Click the "OK" button.
Note that "New -> Java project" is for creating a brand new, empty project. Since you want to create an Eclipse project from an existing project with an Ant script, you should select the appropriate selection under the "Ant" subsection in the New Project dialog. See this answer to a related SO question for details.
add this line to nbproject/project.properties:
j2ee.server.home=http://localhost

How to organize jar files in a libraries folder in Eclipse?

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.

Integrate Map/Reducer and Java Project Eclipse

I have a Java Project & Map/Reducer Project in eclipse Workspace, I want to use a class file of Map/Reducer Project from java project to perform computation, I am new to Apache Hadoop & Map/Reducer thing, please Suggest.
If a hadoop project is just like a Java project (and it probably is); right click on the other project in the package explorer, select properties, and then choose java build path. After that, click on the projects tab and select the add button. A dialog box should come up, and you should be able to select your hadoop project.
Both projects must be in the workspace, of course.

How to create an Eclipse RCP application re-using some "Eclipse IDE plugins"?

How can I create a RCP application, which looks exactly like the Eclipse IDE with all menus, views, dialogs...?
Here is one example: http://richclientplatform.blogspot.com/2007/12/oil-and-gas-industry-using-eclipse.html
I followed Lars Vogel's tutorial to create a simple RCP application: http://www.vogella.de/articles/EclipseRCP/article.html.
... what are the next steps?
The ide bundle provides you with classes and extension points that allow you to use the workspace metaphor but it does not include the extensions that add all the functionality that you would see in the Eclipse IDE.
Since each bundle in an RCP app application adds menu, views, and dialogs the way to get your application to look like the IDE is to include all of the bundle that come with the IDE.
Usually you start with a pretty bare application like something tutorials that Vogel (who I find puts out good tutorials) puts out describe. Then when you find something that you want to add you research which bundle provides it and you add that bundle. As you do this your application will grow in functionality without picking up functionality your user does not need.
EDIT: Let me walk you through creating a simple RCP application.
Create a new Project by going to File -> New -> Project
Select Plug-in Project
Set the Project name to com.mydomain.rcp
Click Next
Under Rich Client Application select Yes
Click Next
Select RCP Mail Template
Click Finish
You now have an RCP app with some functionality. Next we will run it:
Select Run -> Run Configurations...
Select Eclipse Application on the left
Right click and select New
Look for Program to Run/Run a Product. Select com.mydomain.rcp.product
Click on the Plug-ins tab
Find Launch with at the top and select plug-ins selected below only
Click Deselect All on the right
In you list of plug-ins select com.mydomain.rcp
At the bottom de-select Add new workspace plug-ins to this launch configuration automatically
On the right click on Add Required Plug-ins
On the bottom click on Run
The application should be running the sample mail application. Go ahead and close it down. Now let's add a plugin so we can get the Search menu to show up like it does in the Eclipse IDE.
In your com.mydomain.rcp project open up your plugin.xml file
Click on the Dependencies tab
Under Required Plug-ins click Add...
Type in org.eclipse.search
Select org.eclipse.search (not the source one)
Click OK
Save the plugin.xml file
From the menu select Run -> Run Configurations...
Click on the Plug-ins tab
On the right click on Add Required Plug-ins
On the bottom click on Run
You should now see the Search menu with the File Search option just like the IDE has. You will not see the Java Search or the Plug-in Search though because we did not add the appropriate JDT or PDE plugins containing those additions. Hopefully this gives you an idea how to add new plugins.

Categories

Resources