• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

import to eclipse

 
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
sarah Marsh
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I knew how to run the ant build file in eclipse, but I got the error
...\lib not found.
 
sarah Marsh
Ranch Hand
Posts: 282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I import the files at the very top level of file system, it works. Thanks, everybody!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic