You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by John Lukar <jl...@gmail.com> on 2006/06/01 20:43:04 UTC

J2se 5.0 and EnvironmentCheck not working - works with JDK 1.4.x however

jdk: jdk1.5.0_07

I try running this utility as prescribed in the document using link:
http://xml.apache.org/xalan-j/faq.html#environmentcheck


the command I use is:
java org.apache.xalan.xslt.EnvironmentCheck

this results in:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/xalan/xslt/EnvironmentCheck

above works if I use JDK 1.4.x however.



checking the jdk rt.jar of jdk1.5  where xalan package resides I see
the EnvironmentCheck utility class sits in:
com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.class

so changing the command to:
java com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck

results in:
Exception in thread "main" java.lang.NoSuchMethodError: main


any help appreciated.

Re: J2se 5.0 and EnvironmentCheck not working - works with JDK 1.4.x however

Posted by John Lukar <jl...@gmail.com>.
indeed your right:

[me@myserver:/opt/j2sdk1.4.2_06/bin] ./javap org.apache.xalan.xslt.Process
Compiled from "Process.java"
public class org.apache.xalan.xslt.Process extends java.lang.Object{
    public org.apache.xalan.xslt.Process();
    static void doExit(int);
    public static void main(java.lang.String[]);
    protected static void printArgOptions(java.util.ResourceBundle);
}


what does underscore mean ?

I guess I am still confused about their release notes. If they didn't
want us to use the command line options, it should be stated
somewhere.

If anyone can shed light on that it would be great.


thanks Kevin for clearing things up a bit more. I will try adding the
jars and see. I think I'll use the "endoresed" method mentioned in the
documentation for xalan as the doc says just adding them to CLASSPATH
wont work:

here..

http://xml.apache.org/xalan-j/faq.html#environmentcheck





On 6/1/06, Kevin Cormier <ke...@gmail.com> wrote:
> Hi again,
>
>
> On 6/1/06, John Lukar <jl...@gmail.com> wrote:
> > My underestanding was that the xalan, xerces and jaxp  are all roled
> > into the JDK 1.5 and hence no need for me to add them to the
> > classpath.
>
>
>  Ah, I see.  In 1.5, if I run "javap
> com/sun/org/apache/xalan/internal/xslt/Process" I get the
> following output:
>
>  Compiled from "Process.java"
>  public class
> com.sun.org.apache.xalan.internal.xslt.Process extends
> java.lang.Object{
>      public
> com.sun.org.apache.xalan.internal.xslt.Process();
>      protected static void printArgOptions(java.util.ResourceBundle);
>      public static void _main(java.lang.String[]);
>      static void doExit(int);
>  }
>
>  Note how there's an underscore in front of the main() method.  I'm guessing
> that if you try this with your 1.4 version of the JDK (which I don't have
> installed) that it won't be there.
>
>  Seems like they want you to be able to access Xalan through the JAXP API,
> but they do not want you to be able to use the extras in Xalan like the
> command line applications.
>
>  The included version is out-of-date anyways, so it might be best just to
> download the latest version from the Xalan site.
>
>  -Kevin
>

Re: J2se 5.0 and EnvironmentCheck not working - works with JDK 1.4.x however

Posted by Kevin Cormier <ke...@gmail.com>.
Hi again,

On 6/1/06, John Lukar <jl...@gmail.com> wrote:
>
> My underestanding was that the xalan, xerces and jaxp  are all roled
> into the JDK 1.5 and hence no need for me to add them to the
> classpath.


Ah, I see.  In 1.5, if I run "javap
com/sun/org/apache/xalan/internal/xslt/Process" I get the following output:

Compiled from "Process.java"
public class com.sun.org.apache.xalan.internal.xslt.Process extends
java.lang.Object{
    public com.sun.org.apache.xalan.internal.xslt.Process();
    protected static void printArgOptions(java.util.ResourceBundle);
    public static void _main(java.lang.String[]);
    static void doExit(int);
}

Note how there's an underscore in front of the main() method.  I'm guessing
that if you try this with your 1.4 version of the JDK (which I don't have
installed) that it won't be there.

Seems like they want you to be able to access Xalan through the JAXP API,
but they do not want you to be able to use the extras in Xalan like the
command line applications.

The included version is out-of-date anyways, so it might be best just to
download the latest version from the Xalan site.

-Kevin

Re: J2se 5.0 and EnvironmentCheck not working - works with JDK 1.4.x however

Posted by John Lukar <jl...@gmail.com>.
Kevin,
thanks for the response.

My underestanding was that the xalan, xerces and jaxp  are all roled
into the JDK 1.5 and hence no need for me to add them to the
classpath.

from 1.5 release notes at:
http://java.sun.com/j2se/1.5.0/docs/guide/xml/jaxp/ReleaseNotes_150.html#versions

" Component Versions
These versions of the relevant technologies have been incorporated
into the reference implementation.
    * Xerces version 2.6.2 + (Xerces version 2.6.2 with controlled bug fixes)
    * XSLTC version 2.6.0 + (XSLTC version 2.6.0 , with controlled bug
fixes, based on the Xalan 2.6.0 release) "


so thats where I am comming from.

I unjared the rt.jar and noticed bunch of xalan and xerces packages
prefixed with com/sun/....

so I assumed that they have roled them into rt.jar  that is part of the JDK 1.5

the echo $CLASSPATH for JDK 1.4  is empty and hence there are no extra
jars related to xalan/xerces that are in the classpath as well and yet
that works.

running the command in jdk 1.4.2 is successfull as below:


[me@myserver:/opt/j2sdk1.4.2_06/bin] ./java
org.apache.xalan.xslt.EnvironmentCheck
#---- BEGIN writeEnvironmentReport($Revision: 1.14 $): Useful stuff found: ----
version.DOM.draftlevel=2.0fd
java.class.path=.
version.JAXP=1.1
java.ext.dirs=/opt/j2sdk1.4.2_06/jre/lib/ext
version.xerces2=not-present
version.xerces1=not-present
version.xalan2_2=Xalan Java 2.4.1
version.xalan1=not-present
version.ant=not-present
java.version=1.4.2_06
version.DOM=2.0
version.crimson=present-unknown-version
sun.boot.class.path=/opt/j2sdk1.4.2_06/jre/lib/rt.jar:/opt/j2sdk1.4.2_06/jre/lib/i18n.jar:/opt/j2sdk1.4.2_06/jre/lib/sunrsasign.jar:/opt/j2sdk1.4.2_06/jre/lib/jsse.jar:/opt/j2sdk1.4.2_06/jre/lib/jce.jar:/opt/j2sdk1.4.2_06/jre/lib/charsets.jar:/opt/j2sdk1.4.2_06/jre/classes
version.SAX=2.0
version.xalan2x=Xalan Java 2.4.1
#----- END writeEnvironmentReport: Useful properties found: -----
# YAHOO! Your environment seems to be OK.




running the command in Jdk 1.5 is not successfull:


[me@myserver:/opt/jdk1.5.0_07/bin] java
org.apache.xalan.internal.xslt.EnvironmentCheck
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/xalan/internal/xslt/EnvironmentCheck


I can put the xalan.jar and et al in the classpath and try but I was
hoping I could simply use what is in JDK.


help.




On 6/1/06, Kevin Cormier <ke...@gmail.com> wrote:
> Hi John,
>
>  I'm new to Xalan, but it sounds like your classpath is different for your
> two JDKs.  EnvironmentCheck works for me using JDK 1.5.  You need to have
> xalan.jar (or xsltc.jar), serializer.jar, xml-apis.jar, and xercesImpl.jar
> on your classpath.  If you're not using the -cp or -classpath option to pass
> the appropriate classpath to the JVM, then it comes from the CLASSPATH
> environment variable.  Check the value of it with:
>
>  echo $CLASSPATH
>
>  You'll need to have the actual .jar files in the classpath; just using the
> directory that contains them will not work.
>
>
>
> > checking the jdk rt.jar of jdk1.5  where xalan package resides I see
> > the EnvironmentCheck utility class sits in:
> >
> com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.class
>
>
>  I'm not sure what this class is for, but it is not the class you want.
> Because it's in rt.jar, the JVM can always find it, but it doesn't have a
> main() method.
>
>  Hope this helps,
>
>  -Kevin
>

Re: J2se 5.0 and EnvironmentCheck not working - works with JDK 1.4.x however

Posted by Kevin Cormier <ke...@gmail.com>.
Hi John,

I'm new to Xalan, but it sounds like your classpath is different for your
two JDKs.  EnvironmentCheck works for me using JDK 1.5.  You need to have
xalan.jar (or xsltc.jar), serializer.jar, xml-apis.jar, and
xercesImpl.jaron your classpath.  If you're not using the -cp or
-classpath option to pass
the appropriate classpath to the JVM, then it comes from the CLASSPATH
environment variable.  Check the value of it with:

echo $CLASSPATH

You'll need to have the actual .jar files in the classpath; just using the
directory that contains them will not work.

checking the jdk rt.jar of jdk1.5  where xalan package resides I see
> the EnvironmentCheck utility class sits in:
> com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.class


I'm not sure what this class is for, but it is not the class you want.
Because it's in rt.jar, the JVM can always find it, but it doesn't have a
main() method.

Hope this helps,

-Kevin

Re: J2se 5.0 and EnvironmentCheck not working - works with JDK 1.4.x however

Posted by Mukul Gandhi <ga...@gmail.com>.
This is a bug with JDK 5. Please see
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5099865

I think, the most appropriate workaround to this is to download the
latest Xalan package, and put it in your system's classpath.

Regards,
Mukul

On 6/2/06, John Lukar <jl...@gmail.com> wrote:
> jdk: jdk1.5.0_07
>
> I try running this utility as prescribed in the document using link:
> http://xml.apache.org/xalan-j/faq.html#environmentcheck
>
>
> the command I use is:
> java org.apache.xalan.xslt.EnvironmentCheck
>
> this results in:
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/xalan/xslt/EnvironmentCheck
>
> above works if I use JDK 1.4.x however.
>
>
>
> checking the jdk rt.jar of jdk1.5  where xalan package resides I see
> the EnvironmentCheck utility class sits in:
> com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.class
>
> so changing the command to:
> java com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck
>
> results in:
> Exception in thread "main" java.lang.NoSuchMethodError: main
>
>
> any help appreciated.