I think I can provide an explanation and a solution for this problem.  I am
not (yet) an Eclipse user, but from carefully reading the evidence
presented, the problem and solution are perfectly clean.

The problem is that Eclipse want to CREATE a NEW folder.  This is clear
because one of the steps described is "Create New Folder."  If there is no
other function than this to do what we really want, then we simple use this
function.  No problem.

The solution is to start by renaming your folder containing your utility
classes.  In cases like this I like to add an underscore character as the
first character in the name.  This should cause the folder to be listed as
the first entry in the list.  Now go through the steps to get back to the
browse dialogue.  Select the folder that you renamed so it appears in the
input box.  Now edit the entry to remove the leading underscore character
from the name and click OK.  Eclipse should now create a new folder with the
name you want.  With this done, you can move all the files into the new
folder and delete the original folder.  No problem.

I hope this helps,
-Dennis

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Richard O. Hammer
Sent: Thursday, July 31, 2003 4:41 PM
To: Java Users Group
Subject: Re: [Juglist] Eclipse: using library files


Chris Grindstaff wrote:
 > Thursday, July 31, 2003, 3:00:37 PM, you wrote:
 >
 > ROH> Chris Grindstaff wrote:
 >
 >>>Friday, July 25, 2003, 10:53:47 AM, you wrote:
 >>>
 >>>ROH> Hi,
 >>>
 >>>ROH> In Eclipse, using version 2.1.0, I'm trying to use some utility
 >>>ROH> classes which I have in a folder outside of my Eclipse directory.
 >>>ROH> These classes are not in a jar, they are just .class files.
Is there
 >>>ROH> a way that I can get Eclipse to find and use those classes,
perhaps
 >>>ROH> reminiscent of the classpath environment variable I am used
to setting
 >>>ROH> for the JDK?
 >>>
 >>>ROH> I keep finding ways that Eclipse offers to copy ("import")
the files
 >>>ROH> into the Eclipse project folder.  But I want to keep just one
copy of
 >>>ROH> these utility classes.
 >>>
 >>>Rich,
 >>>     If it does exist it's Properties of a Java Project > Java Build
 >>>     Path > Libraries > Add Class Folder. Then choose Create New
 >>>     Folder, click Advanced and Link to folder in the file system.
 >>
 >
 > ROH> Thank you Chris.  I've been trying everything I can think of, but
 > ROH> still can't make it work.  Part of my difficulty may concern the
 > ROH> interplay of package names and folder names.
 >
 > ROH> I get this far
 > (properties >> Java Build Path > Libraries > Add Class Folder >
 > Create New Folder >> Advanced  > Link to folder in the file system >
 > ROH> Browse ...
 >
 > ROH> In the Browse For Folder dialog I select my folder of utility
classes,
 > ROH> then, back in the New Folder dialog,  I reach a confusing
point.  I
 > ROH> get an error message "Folder name must be specified" even
though the
 > ROH> folder I just selected is listed in a text area.  The OK
button is
 > ROH> disabled.
 >
 > ROH> I can proceed by writing a folder name into the Folder name
text area,
 > ROH> but I'm not sure what it expects there.  What does it mean by
forcing
 > ROH> me to specify two folders?  I've tried a half dozen things at
this
 > ROH> point, and I have more ideas for ways to experiment, but still
have
 > ROH> not found a way that works.
 >
 > Rich,
 >      I agree that it's confusing. The name that you specify in the
 >      text area is just that, a name. It's a "handle" or a way to refer
 >      to the linked folder.
 >
 >      Here's a specific example that worked fine for me. I specified a
 >      name of "bob" and selected the c:\temp\classes directory. Click
 >      OK all the way out. Then I went to Windows explorer and unzipped
 >      a jar into the c:\temp\classes directory. Go back to Eclipse,
 >      right mouse click and refresh on my project's "bob" folder and
 >      sure enough all of the classes now appear.
 >
 >      Perhaps you can be more specific?
 >
 > Chris



For instance:
In Navigator, I create a new project "tryUtility", in it I create a
new package "main".  Into this package I copy a class HelloInt.

package main;
public class HelloInt {

    public static void main(String[] args) {
      System.out.println(IntegerFormatter.format(334928,14));
    }
}


My Eclipse directory is C:\B\E\
Elsewhere I have a directory C:\temp\utility which contains
IntegerFormatter.java, a utility which I want to use.

In Navigator, I right click on project tryUtility.  Then
Properties > Libraries > Add Class Folder > Create New Folder >
Advanced > Link to folder in file system > Browse ...

I select C:\temp\utility, and back in the New Folder dialog type "bob"
in the Folder name text field.  I click OK, then OK again.

Then, back in the "Properties for tryUtility" dialog, the OK button is
disabled.  An error message near the top of that dialog says
"Cannot nest 'tryUtility/bob' inside 'tryUtility'.  To enable the
nesting exclude 'bob/' from 'tryUtility'."  For your enjoyment I'll
try to attach a gif of that dialog window.  I am having fun, and hope
you can have fun too.

Rich



_______________________________________________
Juglist mailing list
[EMAIL PROTECTED]
http://trijug.org/mailman/listinfo/juglist_trijug.org

Reply via email to