How to import existing files into IntelliJ 10 IDE? - java

I have used Eclipse before. I changed to IntelliJ. Now I am wondering how to import existing files into IntelliJ 10 IDE. In Eclipse I was used to just drag the directory into the src folder, but I cannot do it here.

IDEA doesn't have such feature, you either set up a project on top of the existing sources or you copy files to the existing project externally, using Finder or your favorite file manager.

Actually you can tell IDEA to open a project and when you get prompted with the file explorer you select the eclipse project file. IDEA will then create it's own specific project files and setup the classpath for you. It's pretty nifty.

Related

Import source project in eclipse

I need to import a source Project in eclipse. The project is made by many folder like Classes (that contain .class files), src(that contain .java files) and many others. The source project and the instructions on how to set up eclipse are reported at this link. I tried to follow them but I haven't got anything. I think this is a simple thing but I'm new to eclipse.
My eclipse actual version is eclipse java neon 2.
My OS is ubuntu.
You could choose to create a new Project from the File Options and then select Project from existing sources which choosing the source directory.
Second approach could be to just use File > import Project wizard.

Compile errors everywhere after workspace move

I'm making a webapp in Eclipse. I use to make it in my Desktop. And today I got a laptop and I've copied the workspace in my Desktop to laptop.
And after copying the workspace, I've opened my Eclipse pointing to the copied workspace. And when I opened my Java files, almost every line is red underlined .
In my desktop there was no problem with this app, It used to work fine.
When I started my Eclipse with this copied path, I though the errors were due to the jar files (I used to have jars in my desktop associated to this project).
Even after configuring my Build path, the red lines still appear.
How can I solve this?
A wild guess: The path to the JRE is wrong so the compiler does not find the Java standard library. When none of the standard library classes are found you get compile errors at almost every line.
Solution:
Configure the path to the JRE in the compiler settings:
Preferences → Java → Installed JREs
And/or configure the path to the standard library in the project settings:
Project settings → Java Build Path → Libraries
Edit existing entry for system library or add a new one.
You don't want to just copy the workspace over. You want to import the project into Eclipse. You will also want to make sure that you import, and add, any external .jar files. To import use:
File > Import > Existing Project into Workspace
Did you use the import wizard after setting your workspace (http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-importproject.htm)? This is the important part. Once that's done be sure to do a clean build. If you see errors then, you might still be missing external jars that you had on your desktop.

How to edit an eclipse plugin?

An eclipse plugin called JDTCommentsV2_1.0.9 does the following in eclipse:
I'm trying to add/edit some comments inside. e.g. add Run TestComment or just change one of the comments' name.
I have the .jar file and here's how it looks inside:
Question is which files should i edit and how.
Thank you
edit:
After following #greg449 and #Robin Green's instructions, I exported the jar file to eclipse, and edited the plugins.xml file. But if i export the files now as a jar, it doesn't work (nothing is changed in the menu). Finally i tried what #Robin Green said (Run -> Run As -> eclipse application) but there is no eclipse application under Run As. I got only Java Applet and Java Application. I'm wondering why. Might it be because i'm using ADT?
edit2:
I downloaded another version of eclipse (not ADT) and here i do have the Run As eclipse application bar". Can't i add it to ADT ?
edit3:
The picked answer works for eclipse JDT and not eclipse ADT.
It looks like you have a jar containing an existing Eclipse plugin so in your Eclipse you do File > Import and choose General > Existing Projects into Workspace and select the jar as the source.
Once you have the plugin project installed in your workspace you are going to have to work out how the plugin works by looking at the source and the plugin.xml.
Once you have modified the plugin use Export > Plug-in Development > Deployable plug-ins and fragments to build a new plugin jar.
Generally speaking you check out the source code from its source control repository or download it as an archive file from its website and then import it into Eclipse, same as any other project.

NetBeans open project problem

I created a NetBeans project. I took the project folders zipped to another machine and tried opening it in NetBeans. NetBeans didn't identify it as a NetBeans project. I have transfered projects in this way before but why is it not working now? Are any of my project files corrupted. Is there any way to retrieve my files from this?
Try using create new project from existing resources. This may solve the issue.
I just copied whole project into place in system where NetBeans stores projects (in windows it's user\username\Documents\NetBeansProjects\ by default), then started NetBeans and voila - worked great :)
You can try this:
Create a new project on the target machine
Find where the project you want to open is stored and open the src folder.
Copy all the files and stuff in the /src folder
Go on Netbeans, expand the tree view of the project you have just created, right click on source packages and click paste. It should paste the files in the /src folder as packages. You should also see the code these packages contain.
I discovered this solution and it worked for me: http://netbeans-org.1045718.n5.nabble.com/Netbeans-Crashes-Since-Windows-Update-td5752603.html
The fix is to remove the GodMode shortcut that may have been created on your Desktop or on the root of the %systemdrive%.

How to import java classes from other projects in NetBeans 6.8?

I have just started playing with Java, and I really like the language. I am using the NetBeans IDE, and I find one odd oversight. I can create a new class in a project, but NetBeans doesn't appear to support any way to import an existing class into a project.
I manage to get it done by going to some other project where the desired class already occurs, and then I copy/paste it into the source code folder of the new project, then change the package name at the top of the pasted file to match the package name of the new project.
Is there a nice direct way to do this from the NetBeans interface?
Thanks for any help on this.
In the Projects window you can expand the project that you are working on. Right Click on Libraries and select Add Project.... You will get a dialog allowing you to select another Netbeans Project with the Java classes that you wish to use.
You have to just make the .jar file of that/those java files which you want to use in another project.
right click on file->export->java->.jar then finish.
Now you can use these jar into your another project.
When you build the java project in netbeans it creates a jar file on the dist folder in the current project directory.
You can use this jar file for the other project as a package by adding this as ADD jar in the next project.I have tried this ,i am using my old project jar file for new project development.
Use the 'Clean and build' your project option from the netbeans application, that creates the 'dist' folder which you are looking for (and obviously can't find because you havn't cleaned&buld)
The netbeans itself creates .jar files and you can add the jar file to the current project you are working on.

Categories