• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ANT and Eclipse "Java Build Path"

 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I tell Eclipse to make ANT recognize the build path for my project?

I get compile errors on HttpServletRequest, et c.

I right click on my project and choose properties.

I choose Java Build Path, then Libraries.

I added all the Jars from tomcat/lib; annotations-api.jar catalina.jar, catalina-ant.jar, et c.

I still get the compile errors though.

What should I do?
What should
[ May 05, 2007: Message edited by: Garrett Smith ]
 
Ranch Hand
Posts: 346
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Re-check and make sure you have included the right javaEE libraries on the java build path..


Could you post the error log it is probably something real damn simple that you forgot to include and thus it will be posted when you post that log here and we comment back..
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Garrett, in which way are you using Ant?
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using ANT with Eclipse. I added the buildfile in Eclipse.


I added the jars of tomcat6/lib to my buildpath.
 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how are trying to specify classpath? I just started experiementing with struts and i had a similar problem, but i modified the build.xml and it worked.
Also, its not enough to add the jar files in your eclipse, you have to specify the classpath in your build.xml file.
[ May 05, 2007: Message edited by: v ray ]
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh I figured it out!

http://www.onjava.com/pub/a/onjava/excerpt/anttdg2_ch11/index1.html

Modifying the Ant Classpath

When using an optional or custom task, adding extra libraries to the classpath may be necessary. The Ant classpath can be modified globally or by using an individual project's launch configuration. To set the Ant classpath for an individual Eclipse project, open the Ant launch configuration for the project and click the Classpath tab. You can add external JARs by clicking the Add External JARs button.

You can modify the Ant classpath globally for all projects. To do that, select Window→ Preferences→ Ant→ Runtime, and click the Classpath tab. You can add JAR files as needed here, and they'll be used globally for all Ant builds.

 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you using Ant to compile your project *inside eclipse*?
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is funny. There is an Eclipse plugin for ANT. The project is deployed to tomcat/webapps.

Why do it this way? Because it is easy.

I take it you're a netbeans user. Or stick to the command line.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Garrett Smith:
That is funny. There is an Eclipse plugin for ANT.



Well, I'm using Ant inside Eclipse, actually - but certainly *not* to compile the Java source code.


The project is deployed to tomcat/webapps.



We are using the sysdeo Tomcat plugin, which means that we don't have to deploy our app to test it.


Why do it this way? Because it is easy.



That's not really an answer that helps me to help you, but that's ok with me.


I take it you're a netbeans user. Or stick to the command line.



Nope. I use Eclipse - and naturally use the Eclipse compiler to compile my sources. No need to use Ant for that.

We *do* use Ant to compile the sources outside of Eclipse, for example when compiling inside the continuous integration server.
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ilja,

I followed instructions here: http://www.sipages.com/jet.html#sysdeo

This looks very useful. This will change my development process, when I get it to work.

I get an error when I try and start tomcat:

I am sure that that path exists!
The permissions are as liberal as they can be. What could be wrong?
I've restarted Eclipse and I get the same thing.

What could be wrong?

Thank you,

Garrett
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's using server.xml (I think I should be able to continue using server.xml, right?)

If I choose option Contexts directory, I get
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't know what the problem in the first case is. The second looks like you aren't allowed to use port 80 - perhaps there is already a server running on that port?
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat 6 was running on port 80, but I stopped it. Then using sysdeo plugin in Eclipse, I got the errors.

I just restarted my computer and tried sysdeo to start tomcat through Eclipse and got the same errors.

Have you tried using sysdeo with Tomcat using port 80?
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ports number less than 4096 - including port 80 - are protected. Only the root user can run apps using these ports. It was originally thought that having a protected range of ports would afford extra protection.

In Unix/Linux, the port limitations are enforced by the OS. Under Windows, I don't think that's the case, but the JRE may enforce limitiations just for portability's sake.

You can run Tomcat on port 80, but you have to launch it from a root account, not as an ordinary user.

In practice, often people set up a forward from Apache port 80 to Tomcat port 8080 - or whatever high-numbered port you like. It used to be a way to enhance performance on static content. Since Tomcat's gotten more efficient, you no longer need Apache as a booster, so you could also set up the OS firewall to do internal port-forwarding, if it supports it, or use netcat if not.
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim, I should set up the OS Firewall to do internal port forwarding, huh? I have no idea how to do that. Can you break it down for me, please?

I am on a mac, os X (X.4.9, or 10.4.9. I'm not sure how it's called now.)

I don't generally understand how netcat works. I don't know what tunneling is. I'm afraid I might screw something up and I don't know how to fix it.

I want to use sysdeo but I don't want to use netcat because I don't know what it is or how to install it/uninstall it.
[ May 07, 2007: Message edited by: Garrett Smith ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic