I got the problem when installing glassfish v2.1 on SLES 11 and my steps are following:
1. Downloaded glassfish-installer-v2.1-b60e-linux-ml.jar from SUN website.
2. typed command mv glassfish-installer-v2.1-b60e-linux-ml.jar to /opt
3. followed Sun Glassfish Enterprise Server 2.1 Installation Guide,
typed java -Xmx256m -jar glassfish-installer-v2.1-b60e-linux-ml.jar for extracting file.
4. Typed cd to access glassfish directory.
5. Typed lib/ant/bin/ant -f setup.xml and then got the error messages:
kevinsuse:/opt/glassfish # lib/ant/bin/ant -f setup.xml
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: org.apache.tools.ant.launch.Launcher. Program will exit.
I worked all jobs at root.
The other related information on my server are following:
kevinsuse:/opt/glassfish # javac -version
javac 1.6.0_14
kevinsuse:/opt/glassfish # java -version
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)
kevinsuse:/opt/glassfish # echo $JAVA_HOME
/usr/java/jdk1.6.0_14
kevinsuse:/opt/glassfish # which java
/usr/java/jdk1.6.0_14/bin/java
kevinsuse:/opt/glassfish # echo $PATH
/usr/java/jdk1.6.0_14/bin:/usr/java/jdk1.6.0_14/bin:/usr/java/jdk1.6.0_14/bin:/us/java/jdk1.6.0_14 /bin:/sbin:/usr/sbin:/usr/local/sbin:/root/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/opt/gnome/bin:/usr/java/apache-ant-1.7.1/bin:/opt/eclipse/:/usr/java/apache-ant-1.7.1/bin:/opt/eclipse/:/usr/java/apache-ant-1.7.1/bin:/opt/eclipse/
kevinsuse:/opt/glassfish # ant
Buildfile: build.xml does not exist!
Build failed
kevinsuse:/opt/glassfish # ant -version
Apache Ant version 1.7.1 compiled on June 27 2008
kevinsuse:/opt/glassfish # echo $ANT_HOME
/usr/java/apache-ant-1.7.1
I don't know how to solve the problem and need people to give me some help.
Thanks in advance.
[Message sent by forum member 'kw2006' (kw2006)]
http://forums.java.net/jive/thread.jspa?messageID=349904