Hi,
It is difficult to think of a solution which is both simple and reliable. Maybe 
just grep through the output of "java -version" ? Here is the output of Sun's 
java:

---------------------------
root at www:~# /usr/java/j2sdk1.4.2_11/bin/java -version
java version "1.4.2_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_11-b06)
Java HotSpot(TM) Client VM (build 1.4.2_11-b06, mixed mode)
---------------------------

And here is the output of the GNU java:

---------------------------
root at www:~# java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.0 20060508 (Red Hat 4.1.0-14)

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
---------------------------


So maybe the following will do:

if ! java -version 2>&1 | grep -q 'Java(TM)'; then 
     echo "You need SUN JRE"; 
     exit 1;
fi

With regard to the JAVA_HOME variable, if the xxe script uses JAVA_HOME to 
locate the JRE, I will be able to run XXE with a command-line like:

JAVA_HOME="/usr/java/jdk1.5.0_07/jre/" /usr/local/xxe-std-3_3_0/bin/xxe

without the need to alter the default JRE for the whole system.

Regards,
Vesselin Atanasov

 >----------------------------------
 >
 >Vesselin Atanasov wrote:
 >> Thank you very much for the help. Indeed the xxe script tried to run the 
 >> GNU java implementation instead of the SUN one. After editing the xxe 
 >> script everything runs fine. Just a small idea - maybe it would be better 
 >> if the xxe script would respect the value of an environment variable, e.g. 
 >> JAVA_HOME and use it to locate the java executable. This way it would be 
 >> possible to set the JRE for XXE without system-wide changes and without the 
 >> need to edit the xxe script.
 >
 >Would what you suggest solve the problem of having gcj installed by
 >default on most Linux distributions? I'm not sure (I know nothing at all
 >about gcj).
 >
 >If you have a method, simple[*] and fast, which ensures that the xxe
 >shell script fail with a clear error message, unless XXE is started
 >using Sun's Java[tm], we'll certainly implement it.
 >
 >---
 >[*] Counterexample: the shell script used to start ant (no bashing
 >intended).
 >

-----------------------------------------------------------------
http://ide.li/ - ?????? ?? ????????? ?? ?????. ??????, ??????, ??????, ??????, 
??????????.

Reply via email to