Menu

Unable to resolve Test.class

Help
Jeremy
2003-03-07
2013-04-15
  • Jeremy

    Jeremy - 2003-03-07

    I have a class :

    public class Test {}

    and in the same directory: build.xml

        <genjar jarfile="test.jar">
            <class name="Test"/>
        </genjar>

    It keeps saying "Unable to resolve Test.class" in ant 1.5.2 and genjar 1.0.2 on windows 2000.

     
    • Jesse Stockall

      Jesse Stockall - 2003-03-07

      You need to specify the classpath that GenJar should use to locate Test.class

      <genjar jarfile="test.jar">
          <class name="Test"/>
          <classpath>
              <pathelement location="."/>
          </classpath>
      </genjar>

      Jesse

       
    • Olivier Jouny

      Olivier Jouny - 2003-03-10

      This solve the problem if Test.class and build.xml are in the same location (current directory).

      But I still have the same problem if the given class to consider is located in deeper directory.

      <genjar jarfile="test.jar">
                  <class name="a.b.c.MyClass"/>
                  <classpath>
                      <pathelement location="."/>
                  </classpath>
      </genjar>

      Under the current directory, I have the package 'a', so it should be able to find it.

      Any idea ?

      Olivier.

       
    • Jesse Stockall

      Jesse Stockall - 2003-03-14

      There is most likely a problem with your directory layout.

      I build a test case using a classpath of '.' and it worked as expected.

      Does running ant with '-debug' shed any more light on the situation?

      Jesse

       
    • James Moger

      James Moger - 2003-04-23

      I have the same problem.  Was there a resolution?  One thing I found interesting:

      When I tried the Test.class & build.xml example where both are located in the same folder _and_ Test.class has no references outside itself, everything builds just fine - just like reported above.

      I then create an instance variable in Test which points to a class within a package off of the current directory.  When I execute the build I get the "Unable to resolve Test.class" message.

      If I delete the reference to the class - everything builds fine again.

      I am using 1.0.2 with Eclipse 2.1 on XP Pro.

      James

       
    • Jesse Stockall

      Jesse Stockall - 2003-04-23

      Can you create a bug report and attach the target from your build file as well as the source to the files that are causing the problems.

      Thanks

      Jesse

       
    • James Moger

      James Moger - 2003-04-23

      There is no bug in GenJar - only in my head.  My issue related to references to packages/classes that exist in other Eclipse projects but were not explicitly set in the GenJar build file.  While my Eclipse projects are linked for build order, that linkage isn't transparent to GenJar/Ant - so it seems.

      I've got a temporary solution using <classpath> with jar snapshots of my other projects to make GenJar happy and the <classfilter> tag to keep those snapshot jars out of my new GenJar jar.

      What really threw me was the error message that reported failure for the explicitly referenced <class>.  Perhaps, if possible, it would be better to fail with a message that identifies the first missing class definition.

      Anyway, I hope this is useful to others who reference classes from multiple projects and who want to use GenJar.

      Cheers,
      James

       
    • Ed Mansfield

      Ed Mansfield - 2006-12-02

      Thanks, James.  I was wrestling with the same problem and you pointed me in the right direction.  I agree that the error message is very misleading, as I spent a considerable amount of time trying to figure out why it couldn't find the specified class, which wasn't the problem at all as you indicated.

      Ed

       

Log in to post a comment.