Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Eclipse (How to add file to Project?)

Thread view: 
Duke McPherson - 08 May 2006 20:17 GMT
Using Eclipse, how do you get an existing java file to become part of
the project, so that other java files can use it (equivalent to
#include in C)?  This seems like it should be easier than it is...

Thanks!
Larry - 08 May 2006 20:33 GMT
> Using Eclipse, how do you get an existing java file to become part of
> the project, so that other java files can use it (equivalent to
> #include in C)?  This seems like it should be easier than it is...
>
> Thanks!

If it is a JAR file you want to add, goto Projects -> Properties ->
Java Build Path and select "Add External JARs".
IchBin - 08 May 2006 20:41 GMT
> Using Eclipse, how do you get an existing java file to become part of
> the project, so that other java files can use it (equivalent to
> #include in C)?  This seems like it should be easier than it is...
>
> Thanks!

You did not specify if this is a java source and or class file. There
are at least three two ways to do what you want to do.

First
- put your target file into a jar file.
- Right click on your Eclipse project and select "Properties"
- Select "Java Build Path"
- Select "Add External Jar" and add that jar file you created
- Your project now has access.

Second
- Select main menu Windows\Preferences\Java\Build Path\Classpath Variables
- Add a path to your external code
- then you can add to your projects

Third
- Create a project in Eclipse for you external code.
- House it here
- Any other project that wants to reference this code the do the
following:
- Right click on your Eclipse project sand select "Properties"
- Select Project references
- Select the project you just created do that

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)
Duke McPherson - 09 May 2006 00:28 GMT
> You did not specify if this is a java source and or class file. There
> are at least three two ways to do what you want to do.

Java source file.  I already have my Eclipse project.  I just want
other .java files to be part of the project.

Thanks for the help!
James McGill - 09 May 2006 00:37 GMT
> Java source file.  I already have my Eclipse project.  I just want
> other .java files to be part of the project.

Put them in the correct dir under your project, and hit File->refresh in
Eclipse.
IchBin - 09 May 2006 00:51 GMT
>> You did not specify if this is a java source and or class file. There
>> are at least three two ways to do what you want to do.
[quoted text clipped - 3 lines]
>
> Thanks for the help!

OK.. Just select you project or package you want load then into:

- right click and the select "Import"
- Select file system
- Browse to the when the programs are then select the ones you want
- Then "finish"

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)
Duke McPherson - 09 May 2006 02:03 GMT
Thanks you guys, that worked.   ; )
Alex - 09 May 2006 02:19 GMT
Easiest way is drag/drop java file from your windows folder to folder
inside Eclipse (not Windows! Just in the Eclipse!).
Oliver Wong - 08 May 2006 20:48 GMT
> Using Eclipse, how do you get an existing java file to become part of
> the project, so that other java files can use it (equivalent to
> #include in C)?  This seems like it should be easier than it is...

   Two others have given you some answers. Note that "#INCLUDE" in C is a
preprocessor directive, and is part of the preprocessor language. It's
independent of any IDE. That is, the #INCLUDE directive should function the
same way whether you're using Notepad, Emacs, vi, or anything else.

   The way you've phrased your question makes it sound like you're asking
about how to do something specifically within Eclipse, which is why the
others have given the answers they did. If they answered the "wrong"
question, you should probably clarify this inconsistency above.

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.