• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

ClassPath

 
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems as though when I was getting started using ANT/Eclipse I had a classpath problem. Does ANT in Eclipse use the classpath of the environment it runs under while Eclipse uses the buildpath to create the targets?
The question that showed up from my user is

I have an Ant build.xml file that has a target, which is the default target. When I run the Ant build from the shell, the process goes smoothly and the JUnit test succeeds.
However, when I run the Ant build from inside Eclipse, I get ClassDefNotFoundErrors for javax.rmi.PortableRemoteObject.
Running the Ant build with -verbose setting, I see that the classpath being used is (linebreaks added for readability):
"Using CLASSPATH
D:\data\Software Development\eclipse\ContactMgt\build\classes;
D:\swdev\java\j2se\jdk1.3.1_02\jre\lib\rt.jar;
D:\swdev\java\j2sdkee1.3.1\lib\j2ee.jar;
D:\swdev\JBoss\jboss-3.2.1_tomcat-4.1.24\client\jbossall-client.jar;
D:\swdev\java\jUnit\junit3.8.1\junit.jar;
D:\swdev\ApacheGroup\Log4J\jakarta-log4j-1.2.8\dist\lib\log4j-1.2.8.jar;
D:\swdev\eclipse\plugins\org.apache.ant_1.5.1\ant.jar;
D:\swdev\eclipse\plugins\org.apache.ant_1.5.1\optional.jar"
On inspection, I found that rt.jar contains the javax.rmi.PortableRemoteObject, and rt.jar IS on the classpath.
So in short, the same build script works fine with Ant from the command line, but not with Ant within Eclipse.
Anyone have any ideas?


We eventually got the system to work but we're not sure what we did to fix it.
 
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can get some strange compile issues from within Eclipse if you don't set the compiler to match the default eclipse compiler. Try adding this to your build.xml and setting it as a dependency on your compile step...
 
Author
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rufus BugleWeed:
Does ANT in Eclipse use the classpath of the environment it runs under while Eclipse uses the buildpath to create the targets?


First of all running Ant in Eclipse uses the same JVM that Eclipse is using. There's a new option to start up a new JVM for Ant in the 3.0 version but it's off by default because using the existing one is faster.
Next, Ant or anything else running under Eclipse doesn't use the CLASSPATH environment variable. CLASSPATH is the root of all evil so this is ok with me, but it suprises many new users. To get something on Ant's classpath, use Window > Preferences > Ant > Runtime.
 
If you try to please everybody, your progress is limited by the noisiest fool. And this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic