Or even just checking System property java.version.
-Tom
On Fri, 17 Feb 2006, Charles O Nutter defenestrated me:
> The getenv from 1.4- is, as you mention, deprecated. That won't
> prevent it from being called. However the 1.5 version has a new
> signature, so searching for it using reflection and catching NSME
> should be fine.
>
> 1.4- version: String getenv(String)
> 1.5 version: Map<String,String> getenv()
>
> On 2/17/06, Galarneau, Neil <[EMAIL PROTECTED]> wrote:
> > A comment on this implementation:
> >
> > My impression is that Java 1.4.2 won't throw NoSuchMethodException
> > as getenv in that version is deprecated, not missing.
> >
> > This would mean that you could call getenv() directly instead of
> > reflectively as long as it was only called on Java 5.
> >
> >
> > Neil
> >
> >
> > + protected Method getSystemGetenvMethod() {
> > + Method getenvMethod = null;
> > + try {
> > + getenvMethod = java.lang.System.class.getMethod("getenv",
> > (Class[]) null);
> > + if (!getenvMethod.getReturnType().equals(java.util.Map.class))
> > {
> > + // wrong return type
> > + getenvMethod = null;
> > + }
> > + } catch (NoSuchMethodException e) {
> > + // This is the error you get if using Java 1.4.2
> > + getenvMethod = null;
> > + } catch (Exception e) {
> > + // Some other e.g. security problem
> > + getenvMethod = null;
> > + }
> >
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> > for problems? Stop! Download the new AJAX search engine that makes
> > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
> > _______________________________________________
> > Jruby-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/jruby-devel
> >
>
>
> --
> Charles Oliver Nutter @ headius.blogspot.com
> JRuby Developer @ jruby.sourceforge.net
> Application Architect @ www.ventera.com
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
> for problems? Stop! Download the new AJAX search engine that makes
> searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
> _______________________________________________
> Jruby-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jruby-devel
--
+ http://www.tc.umn.edu/~enebo +---- mailto:[EMAIL PROTECTED] ----+
| Thomas E Enebo, Protagonist | "Luck favors the prepared |
| | mind." -Louis Pasteur |
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Jruby-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jruby-devel