简体   繁体   中英

Can't compile .java code, no changes were made

I have downloaded example session bean servlet from here http://www.roseindia.net/jboss/sessionbeanservlet.shtml , download is under "Download the code of this lesson." label. Files are compiled using ant and just after downloading it works. I compile ant script and build is successfull but when I delete one letter from one of the files with .java code and write it back and save it I receive few errors.

Output: http://pastebin.com/H0JYUckX

Any ideas?

//I took src files and I've made netbeans project and it works. So I don't more have to worry about this issue. Greets.

The servlet API is not part of the standard Java API. You have to add the JAR file that contains the servlet API to the classpath to be able to compile code that uses this API.

If you're using for example Apache Tomcat , you can find the JAR file servlet-api.jar in the lib directory of your Tomcat installation.

在类路径中包含servlet.jar

I assume you have downloaded both the source and the compiled version of the code.

This can mean that the code is not re-compiled as you have a compiled version already. However it is when you modify the file that you discover that your program would never have built, most likely because your environment is not setup to build this file. ie There are libraries this source needs which you don't have in your build.

I went back to this issue and solution is adding servlet-api.jar and jboss-j2ee.jar to ant/lib folder. In console I could see information that build is successful, but really this files weren't compiled. It just assumed that .class files are in package so it doesn't need to compile it again. Message was "BUILD SUCCESSFUL" but it hasn't been compiled at all. So when I deleted them real compilation started and I needed to provide this .jar files.

Greets.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM