This discussion is archived
2 Replies Latest reply: Sep 12, 2013 12:16 PM by jschellSomeoneStoleMyAlias RSS

Classpath with Ant not working

tyelford Newbie
Currently Being Moderated

Hi,

 

I am having an issue that I cannot seem to resolve with Ant deployments and my Classpath.

 

I have a module that is needed to run with Open Wonderland but for some reason when I run this particular module deployment it doesn't recognize part of the classpath

 

On my server I have a class called JadeRunner.class and it is included in my classpath.  I can verify but running the following code:

[CODE]

public class testClassPath{

     public static void main(String args[]){

          String classArg = args[0];

          try{

             Class testClass = Class.forName(classArg);

          }catch(ClassNotFoundException e){

             e.printStackTrace();

          }

     }

}

[/CODE]

I just enter the name of the class as an argument and if I get no errors that it can find the class.  This works if I enter it directly from the command line.  However with my ant deployment I get a ClassNotFoundException for this class.


I run my ant deployment as root but I use the -E switch so it picks up my environment variables.  The ant deployment finds all my other environment variables except this one.  I have some sample outputs:

$ java testClassPath org.jdesktop.wonderland.modules.mas.jade.weblib.JadeRunner  (this give no output, so it finds the class)

$ sudo -E java testClassPath org.jdesktop.wonderland.modules.mas.jade.weblib.JadeRunner  (again no output, so it finds the class)


$ sudo -E ant deploy

This gives ClassNotFoundException: org.jdesktop.wonderland.modules.mas.jade.weblib.JadeRunner


Does anyone have any insight to this?


  • 1. Re: Classpath with Ant not working
    rp0428 Guru
    Currently Being Moderated
    Does anyone have any insight to this?

    How would that even be possible?

     

    First - this forum is for Java questions or issues.

     

    Second - your complaint is about an ant or ant configuration file issue but you don't bother to post ANYTHING related to ant or the file ant is trying to execute.

     

    Repost your problem in an Ant support forum. When you do, anyone that wants to help you will need the details about what you are trying to do and the contents of the file you are trying to do it with.

  • 2. Re: Classpath with Ant not working
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated

    > it is included in my classpath

     

    Presumably you mean that you have an environment variable called CLASSPATH.

     

    As far as I can recall Ant constructs its own class path.  Everything else probably works because the Ant files has the correct information on the class paths for everything else.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points