aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes import to eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "import to eclipse" Watch "import to eclipse" New topic
Author

import to eclipse

sarah Marsh
Ranch Hand

Joined: Mar 06, 2001
Posts: 282
Hello:

I create a Java project in eclipse, then I want to import source code from file system but I don't want to copy the file to the workplace of eclipse. How could I import those source code that already in the file system?

Thanks in advance!
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
Maybe this is what you want:

The java project creation wizard lets you select "create project from existing source"....

File - New - Project...
select "Java Project", hit next button ... the next screen has a radio button labeled as above.

That's what the wizard scenario looks like in my eclipse 3.1, but similar functionality was there in earlier versions.
sarah Marsh
Ranch Hand

Joined: Mar 06, 2001
Posts: 282
Thanks Carol.

I have more question to ask:
Actually I have a working application, after I create a project and import the source code, how should I import Jar files, config files and ant build.xml to build the ear/war when run ant build inside Eclipse?

Thanks a lot!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

You import everything. But I think what you really are looking for is to make your Eclipse project know about them.

Normally when you import a project, the java project import wizard detects source directories and notes them in the .project file, but it's less successful at finding libraries. So you have to open the Project Properties (right-click on the project's root) and setup the java build paths.

For the Ant build.xml files, you don't have to do anything special, the Java WorkBench already understands them and adds menu options to the right-click menu for the build.xml files in the navigational view.


Customer surveys are for companies who didn't pay proper attention to begin with.
sarah Marsh
Ranch Hand

Joined: Mar 06, 2001
Posts: 282
Hello:
There is no .project file, ant build.xml can run successfully on window console. What should I do in this case?

Thanks again!
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
sarah,

could you be more explicit about what you cannot do that you want to do, or what error you are getting when you try to do it?
sarah Marsh
Ranch Hand

Joined: Mar 06, 2001
Posts: 282
I got the source code, lib, config and ant build file of an application, I want to set up a project in eclipse and run ant inside eclipse to build war and ear files. After I import the source code, how to import lib, config file so ant build.xml can find the lib path? I imported the lib into project, but ant build can not find the lib path. Ant build.xml can run successfully on window console, so there must be something wrong the way that I import those files. Any ideas? Thanks!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

You can't see the .project file in the Java Perspective, but you can in the Resource Perspective. You shouldn't have to look at it or change it directly, however.

To make the Ant build work, go to the Navigator, right-click on the build.xml icon, select "Run As" and select one of the 2 "Ant Build" menu options. The first one runs a default config, the second one opens up an ant cofig dialog.

Ant's output is directed into the Eclipse Console task window.
sarah Marsh
Ranch Hand

Joined: Mar 06, 2001
Posts: 282
I knew how to run the ant build file in eclipse, but I got the error
...\lib not found.
sarah Marsh
Ranch Hand

Joined: Mar 06, 2001
Posts: 282
I import the files at the very top level of file system, it works. Thanks, everybody!
 
Don't get me started about those stupid light bulbs.
 
subject: import to eclipse