Ant Cannot Find Symbol Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any ant build cannot find symbol questions you might have Meta Discuss the workings and policies cannot find symbol error symbol class of this site About Us Learn more about Stack Overflow the company Business Learn more about
Cannot Find Symbol Error In Java Compile
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow
Cannot Find Symbol Error In Java Interface
is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ANT - javac compile failure due to cannot find symbol up vote 7 down vote favorite I'm trying to compile ActionFactory.java file which imports one of my package, RegisterAction.java Here cannot find symbol error symbol method is the file structure: /com/masatosan/actions/register/RegisterAction.java /com/masatosan/redirector/ActionFactory.java According to the ANT output, I think ANT cannot find RegisterAction.java which is imported in ActionFactory.java It does compile successfully when I manually run javac on console so this must be some classpath setting that ANT is not looking at. I know I can add some jar to ANT_HOME/lib but in my case, ANT seems not be able to find ActionRegister.java, not jar or something else. Could anyone help me find out what's wrong? ANT script
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about
Eclipse Ant Build Cannot Find Symbol
Stack Overflow the company Business Learn more about hiring developers or posting ads with ant build package does not exist us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is package javax.servlet.http does not exist ant build a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Javac Ant task can't find a class even though it is contained in the http://stackoverflow.com/questions/3844047/ant-javac-compile-failure-due-to-cannot-find-symbol classpath up vote 1 down vote favorite My javac Ant task produces errors like those shown below: [javac] C:\dp\dev\trunk\MyProduct\MyUnitTest.java:109: error: cannot find symbol [javac] private MyClass createFactoryMock() throws Exception { [javac] ^ [javac] symbol: class MyClass [javac] location: class MyUnitTest I ran the task in a verbose mode (ant -verbose test-compile) and found MyClass in the classpath output of the task, from which I conclude that MyClass is present in http://stackoverflow.com/questions/18953742/javac-ant-task-cant-find-a-class-even-though-it-is-contained-in-the-classpath the classpath. [javac] Compiling 9 source files to C:\dp\dev\trunk\MyProduct\temp\test-build [javac] Using modern compiler [javac] Compilation arguments: [javac] '-d' [javac] 'C:\dp\dev\trunk\MyProduct\temp\test-build' [javac] '-classpath' [javac] '[...]C:\dp\dev\trunk\MyProduct\temp\build\MyProduct\MyClass.class[...] What else (apart from classpath issues) can be the cause of the error? java ant share|improve this question edited Mar 14 at 19:24 Roman C 34k133559 asked Sep 23 '13 at 7:23 DP_ 1,7441978164 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote accepted I fixed the problem by changing
(1)Ant (16)Apache Web Server (8)Bioinformatics (10)Cascading Style Sheets (47)Classes and Objects (14)Database (13)Design Patterns (22)Eclipse (39)Files (62)General Java (69)JSPs (9)Java Basics (11)Linux http://www.avajava.com/tutorials/lessons/how-do-i-compile-my-project-using-ant.html (23)Logging (5)Maven (88)Search (12)Servlets (20)Struts (1)Text (19)Tomcat (8)Version Control (8)Windows (2)XML (1) How do I compile my project using Ant? Author: Deron Eriksson Description: This Ant tutorial describes how to compile Java http://www.sitepoint.com/forums/showthread.php?585705-Ant-Classpath-Problem classes using the javac task and filesets. Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 1.5.1 || Tomcat 5.5.20 Page: 1 2> The AntSW 'javac' cannot find task makes compiling classes in a project in EclipseSW very easy. In this short tutorial, we'll utilize the following 'tomcat-demo' project. This is a simple project that features a servletW. This project runs in TomcatSW, so it requires some of the jarW files that come with Tomcat in order to be compiled. The servlet utilizes the commons-lang library, so Ant needs to cannot find symbol 'know' about this library when it compiles our JavaSW classes for us. The project also features a test.properties file that we'll copy from the src to the bin directory. Out simple TestServlet class is as follows: TestServlet.java package test; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; public class TestServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("This is the Test Servlet
"); out.println(StringUtils.swapCase("Howdy how are you")); } } The output of this trivial servlet is: This is the Test Servlet hOWDY HOW ARE YOU Let's go ahead and jump right in. To start off, let's create a 'compile' target that utilizes the javac task to try to compile the javaSW files in the src directory (via 'srcdir') and puts the compiled class files in the bin directory (via 'destdir'):
& Application Design Issues Ant Classpath Problem The SitePoint Forums have moved. You can now find them here. This forum is now closed to new posts, but you can browse existing content. You can find out more information about the move and how to open a new account (if necessary) here. If you get stuck you can get support by emailing forums@sitepoint.com If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. SitePoint Sponsor User Tag List Results 1 to 14 of 14 Thread: Ant Classpath Problem Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Nov 27, 2008,02:51 #1 russell42 View Profile View Forum Posts SitePoint Member Join Date Nov 2008 Posts 7 Mentioned 0 Post(s) Tagged 0 Thread(s) Ant Classpath Problem Hi, I'm using Eclipse and Ant to create a Spring web application project which builds and deploys fine on its own, but when I add another project (a jar library) and call methods in the jar I get build errors from Ant. Does anyone know what I'm doing wrong? I've dropped the TestLibrary.jar into SpringSkeleton/WEB-INF/lib but the following compiler errors appear: Code: Buildfile: /Users/russell/Projects/Eclipse/SpringSkeleton/build.xml Compile: [javac] Compiling 1 source file to /Users/russell/Projects/Eclipse/SpringSkeleton/WEB-INF/classes [javac] /Users/russell/Projects/Eclipse/SpringSkeleton/src/springskeleton/controllers/ServerTimeController.java:10: package testlibrary does not exist [javac] import testlibrary.Foo; [javac] ^ [javac] /Users/russell/Projects/Eclipse/SpringSkeleton/src/springskeleton/controllers/ServerTimeController.java:19: cannot find symbol [javac] symbol : variable Foo [javac] location: class springskeleton.controllers.ServerTimeController [javac] String s = Foo.f(); [javac] ^ [javac] 2 errors BUILD FAILED ---- build.xml for TestLibrary Code: