• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst] Java/Tomcat - javac.Main is not on the classpath

Suse 9.3

Hoffe mit dieser Frage nicht zu nerven, habe viel gesucht und gelesen, kriege es trotzdem nicht hin:

javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK

Habe wahrscheinlich Pfadprobleme mit Java... :cry:

Ich weiss, die Umgebungsvariablen sind zu setzen mit

PATH=/Pfad/zum/Java/bin:$PATH
export PATH

JAVA_HOME=/Pfad/zum/Java
export JAVA_HOME

...nur wie lautet der zu setzende Pfad den genau unter Suse 9.3?

Was ich gemacht habe:
linux:/home/flyingfischer # update-alternatives --config java

There are 2 programs which provide `java'.

Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-sun/bin/java
*+ 2 /usr/lib/jvm/jre-1.5.0-sun/bin/java

Enter to keep the default[*], or type selection number: 2
Using `/usr/lib/jvm/jre-1.5.0-sun/bin/java' to provide `java'.

Per apt-get install java-1_5_0-sun-devel für die SDK gezogen (stimmt das so?)

echo $JAVA_HOME liefert
/usr/lib/jvm/java (da habe ich schon rumgebastelt und stimmt sehr wahrscheinlich nicht...?)

echo $PATH
/usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin

Wenn ich mein Java-Projekt mit Tomcat unter Eclipse starte, und im Browser betrachte kriege ich:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1000)
org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:560)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:209)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105)
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:929)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:758)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:407)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1062)
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1000)
org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:560)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:209)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.

Javac kann ich in der Konsole mit javac aufrufen...

Ich bin verwirrt :? und dankbar für Hilfe!
 
OP
flyingfischer

flyingfischer

Member
...habe es hingekriegt mit:

http://cvs.sourceforge.net/viewcvs.py/abbot/abbot.swt/doc/swt/building.html?rev=1.9

Note that you must build using a Sun JRE. E.g. if you use Eclipse's included IBM JRE, build via Run>Run>External Tools, and see an error like

Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK

then you will need to

1. ensure you have a Sun JRE installed
2. go to Windows>Preferences>Java>Installed JREs and ensure there is a pointer to a Sun JRE
3. choose Run As, Ant Build... (the second item, not the first), choose the JRE tab, and ensure that Runtime JRE points to your Sun JRE (choose it from the dropdown list)

Punkt 1 und 2 haben das Problem gelöst! :D
 
Oben