I just wanted to edit a existing program (or project) where I have the source code folder (which has already java files, not class files... so I don't have to decompile that) of that. But how do I import that in Eclipse?
Screenshot:
You have a maven build file (pom.xml), then it's pretty easy: do a mvn eclipse:eclipse on the pom file. That will create a project at that location (iaw, it will create a .project and a .classpath file).
Then, simply import the project into a workspace.
With Neon: File > Open projects from filesystem.... With older versions or if you prefer it in Neon, File > Import > Maven > Existing Maven Projects.
Related
I am using ColdFusion 2016 and want to use this java library from within ColdFusion.
https://github.com/getstream/stream-java
It is not clear what folders are needed to make this work. I'm very new to doing something specifically like this so please excuse my question if isn't phrased correctly.
I tried downloading the entire zip file from github, renaming it with a .jar extension, and dropping it in my CF classpath but I couldn't seem to instantiate any of the classes.
That's because they're not classes. What you downloaded are the .java source files. Sources must be compiled into *.class files before you can use them. The project is set up for Maven, so you can use an IDE like Eclipse to import the project, then run a Maven build which will compile and create the jar for you.
Download and install Eclipse with JDK 1.8 or higher (not JRE version)
Extract the .zip sources to a folder on disk
In Eclipse, import the project sources.
Select File > Import > Maven > Existing Maven Projects then click Next
Click Browse and navigate to the folder where you extracted the .zip files. Select the root folder stream-java-master and click Select Folder > Finish
Build the jar
Go to Package Explorer, right click the project stream-core and select Run As > Maven Install
Check the console for a success/failure message:
[INFO] BUILD SUCCESS
The compiled jar will be located in a subdirectory named /target. Example:
C:\temp\stream-java-master\stream-core\target\stream-core-2.0.2-SNAPSHOT.jar
If needed, repeat step 4 ("Build a jar") for the other 3 projects.
The Apache Maven Eclipse Plugin is retired. What is the equivalent command line or in Eclipse UI for:
mvn eclipse:eclipse
that generates the files that a project requires to be seen as a Java project in Eclipse?
The eclipse goal of the maven-eclipse-plugin would actually:
generates the Eclipse configuration files.
Which basically means .project, .classpath and the .settings folder.
These folders and procedure is handled by the Import action, where you can actually specify to import an existing project as a Maven project:
Right click on the Projects view > Import > Import... The procedure will properly create the aforementioned files and configure Eclipse accordingly.
However, shall you already have the project imported (in that case files would already exist), you can convert the existing project to Maven via the Configure action:
A right click on the concerned project > Configure > Convert to Maven Nature would then modify the existing files and settings to recognize the Maven build (mostly adding the org.eclipse.m2e.core.maven2Nature nature and org.eclipse.m2e.core.maven2Builder information to the existing .project file).
I have imported Perforce Project to my local Drive and then i create workspace in Eclipse Luna, but when i try to import project using File->Import->General->Existing Projects into Workspace then i select root directory of my project. Import wizard scans whole project and then gives me the warning
No projects are found to import. I know the project that i am importing does not have any .classpath and project file. Is there any straight forward way to import the project from Local directory ?
Any help is greatly appreciated.
Import Existing Projects will only import Eclipse projects - which always have a .project file.
To import something else you will first have to create an appropriate project in Eclipse with 'File > New > Project....'. Once you have the project you can use 'File > Import > File System' to import the project files in to your new project.
If it doesn't have .classpath and project files it's not an eclipse project. Import from filesystem.
I downloaded both the .jar file and the "source and documentation" zip archive from the JParsec download section. Somehow I failed to import the JParsec source code using the Eclipse IDE (and also to find any documentation). Can someone please explain how to import it?
Thanks a lot!
You need to create a Java project and add the appropriate .jar file into the build path. You can also link the source file to the .jar file using the "Build Path" choice.
The codehaus project is no longer active, jparsec is now hosted on github. If you clone the source code from there, you can import the project using the maven plugin for Eclipse, or alternatively do mvm eclipse:eclipse inside the project source tree and then open the project in Eclipse.
I read this article which shows how to import/export projects in Eclipse (although it seems a little outdated and I'm using 3.7 Indigo).
To export a project, you go to File >> Export and it creates some kind of "project archive" file on the local file system. You could then email it to someone else, who could then import the archive as a new project or into an existing project.
But what if you don't have an "archive" file to begin with?!? What if you just have the project files and directories but without all the Eclipse-metatdata (.project file, etc.)? Is there anyway to tell Eclipse to look at, say:
/home/myuser/some/path/to/project/root/
src/main/java
SomeObject.java
build.xml
...and get it to read that as a new Java project?
Try the steps below:
Create a Java Project in Eclipse as below:
Load the project contents from your file system as below:
Hope this works for you.
.project and .classpath files are the base of the project structure. Without a .project file Eclipse won't recognize your project. The .classpath is important too but that one changes between environments. Should you use the files from another environment you'll have to reconfigure some settings.
Rather than emailing code, I suggest you use a Version Control system and, also, some Eclipse plugins. SVN + Subclipse for example.
If you trully want to send the project to another person just send him the project's folder and import it as an existing project by doing right click on the project explorer and selecting Import > Existing Project into workspace.