Share

GenJar

Subscribe

Unable to resolve class problem

  1. 2009-10-27 13:42:06 UTC

    I can't even get hello world to work. Can anybody shed any light on my problem?

    <pre> <b>steveo@steveo</b>:~/hello$ ls -lah which ant lrwxrwxrwx 1 root root 20 2009-07-25 08:30 /usr/bin/ant -> ../share/ant/bin/ant steveo@steveo:~/hello$ ls -lah /usr/share/ant/lib/GenJar.jar -rw-r--r-- 1 root root 32K 2009-10-26 13:24 /usr/share/ant/lib/GenJar.jar <b>steveo@steveo</b>:~/hello$ cat Hello.java public class Hello { public static void main(String[] args){ System.out.println("Hello World"); } } <b>steveo@steveo</b>:~/hello$ javac Hello.java <b>steveo@steveo</b>:~/hello$ java Hello Hello World <b>steveo@steveo</b>:~/hello$ ls build.xml Hello.class Hello.java <b>steveo@steveo</b>:~/hello$ cat build.xml &lt;?xml version="1.0"?> &lt;project name="HelloWorld"> &lt;taskdef resource="genjar.properties"/> &lt;genjar jarfile="hello.jar"> &lt;class name="Hello"/> &lt;/genjar> &lt;/project> <b>steveo@steveo</b>:~/hello$ ant Buildfile: build.xml [genjar] Generating jar: /home/steveo/hello/hello.jar

    BUILD FAILED /home/steveo/hello/build.xml:4: Unable to resolve: Hello.class

    Total time: 0 seconds </pre>

  2. 2009-10-27 13:44:51 UTC

    Preview indicated that would be formatted better. Let me try again.

    <pre> steveo@steveo:~/hello$ ls -lah which ant lrwxrwxrwx 1 root root 20 2009-07-25 08:30 /usr/bin/ant -> ../share/ant/bin/ant steveo@steveo:~/hello$ ls -lah /usr/share/ant/lib/GenJar.jar -rw-r--r-- 1 root root 32K 2009-10-26 13:24 /usr/share/ant/lib/GenJar.jar steveo@steveo:~/hello$ cat Hello.java public class Hello { public static void main(String[] args){ System.out.println("Hello World"); } } steveo@steveo:~/hello$ javac Hello.java steveo@steveo:~/hello$ java Hello Hello World steveo@steveo:~/hello$ ls build.xml Hello.class Hello.java steveo@steveo:~/hello$ cat build.xml <?xml version="1.0"?> <project name="HelloWorld"> <taskdef resource="genjar.properties"/> <genjar jarfile="hello.jar"> <class name="Hello"/> </genjar> </project> steveo@steveo:~/hello$ ant Buildfile: build.xml [genjar] Generating jar: /home/steveo/hello/hello.jar

    BUILD FAILED /home/steveo/hello/build.xml:4: Unable to resolve: Hello.class

    Total time: 0 seconds </pre>

  3. 2009-10-27 13:46:11 UTC
    steveo@steveo:~/hello$ ls -lah which ant
    lrwxrwxrwx 1 root root 20 2009-07-25 08:30 /usr/bin/ant -&gt; ../share/ant/bin/ant
    steveo@steveo:~/hello$ ls -lah /usr/share/ant/lib/GenJar.jar 
    -rw-r--r-- 1 root root 32K 2009-10-26 13:24 /usr/share/ant/lib/GenJar.jar
    steveo@steveo:~/hello$ cat Hello.java
    public class Hello {
        public static void main(String[] args){
            System.out.println(&quot;Hello World&quot;);
        }
    }
    steveo@steveo:~/hello$ javac Hello.java
    steveo@steveo:~/hello$ java Hello
    Hello World
    steveo@steveo:~/hello$ ls
    build.xml  Hello.class  Hello.java
    steveo@steveo:~/hello$ cat build.xml 
    &lt;?xml version=&quot;1.0&quot;?&gt;
    &lt;project name=&quot;HelloWorld&quot;&gt;
      &lt;taskdef resource=&quot;genjar.properties&quot;/&gt;
      &lt;genjar jarfile=&quot;hello.jar&quot;&gt;
        &lt;class name=&quot;Hello&quot;/&gt;
      &lt;/genjar&gt;
    &lt;/project&gt;
    steveo@steveo:~/hello$ ant
    Buildfile: build.xml
       [genjar] Generating jar: /home/steveo/hello/hello.jar
    
    BUILD FAILED
    /home/steveo/hello/build.xml:4: Unable to resolve: Hello.class
    
    Total time: 0 seconds
    
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.