I am having some problems when I build the file build.xml. I know it some problem with the class path of the tag javac, but i don't know how to solve it.
[java] Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/core/Response
[java] at java.lang.Class.getDeclaredMethods0(Native Method)
[java] at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
[java] at java.lang.Class.getMethod0(Class.java:2764)
[java] at java.lang.Class.getMethod(Class.java:1653)
[java] at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
[java] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
[java] Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Response
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
The library of my project is in the "/WebContent/WEB-INF/lib/", and this is my file "build.xml":
<property name="src" value="\${basedir}/src" />
<property name="build" value="classes" />
<property name="dist" value="dist" />
<property name="package" value="*" />
<target name="init">
<echo> Criando os diretorio classes, doc e dist.</echo>
<mkdir dir="..\${build}" />
<mkdir dir="..\${dist}" />
</target>
<target name="compile" depends="init" >
<echo> Compilando o projeto.</echo>
<javac srcdir="\${src}" destdir="..\${build}" includeantruntime="false">
<classpath>
<fileset dir="\${basedir}/WebContent/WEB-INF/lib/">
<include name="jersey-server-1.4.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="dist" depends="compile">
<echo> Gerando o .jar do projeto.</echo>
<jar jarfile="..\${dist}/InfosoundWebApp.jar" basedir="..\${build}">
<!-- Tornando o jar executável-->
<manifest>
<attribute name="Main-Class" value="com.informatec.restfull.ServerRestfull"/>
</manifest>
</jar>
</target>
<target name="all" depends="dist">
<echo> Executa o projeto.</echo>
<java jar="..\${dist}/InfosoundWebApp.jar" fork="true" />
</target>
<target name="clear">
<delete dir="..\${build}" />
<delete dir="..\${dist}" />
</target>
If someone can help me, I will be grateful.
It looks like you are trying to run the JavaEE app from JavaSE. The class javax/ws/rs/core/Response is only available under JavaEE (on your webserver). Your build.xml target="all" tries to execute your webapp under JavaSE. Get rid of it. Make target="dist" the default target and then upload your jar to your webserver (Tomat, etc.).