Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #30995
| From | v_borchert@despammed.com (Volker Borchert) |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: catch unsupported class version error |
| Date | 2015-02-02 00:29 +0000 |
| Organization | Private site at Eddersheim, Germany |
| Message-ID | <mamgdm$ha6$3@Gaia.teknon.de> (permalink) |
| References | <mamaha$28kl$1@ariadne.rz.tu-clausthal.de> <54ceb004$0$283$14726298@news.sunsite.dk> |
Arne Vajh??j wrote:
> On 2/1/2015 5:49 PM, Philipp Kraus wrote:
> > because within the source I use some 1.8 features e.g. thread-stealing pool.
> >
> > If I run the Jar on a version < 1.8 I get the error "unsupported
> > major.minor version" with a stacktrace.
> >
> > IMHO I cannot catch the error, because it is thrown by a native method
> > of the VM, I have found a solution,
> >
> > that I can compile a class with e.h. 1.7 option and check the running
> > version of the VM and create an error
> >
> > message on a wrong version.
> >
> > I would like to create error like "You are need Java 1.8" and the user,
> > which run's the Jar does not see the stacktrace.
> >
> > How can I do check the VM version and create a nice error message?
>
> Maybe:
> System.getProperty("java.version")
What about
try {
Class.forName("some.class.compiled.with.1_8")
} catch (UnsupportedClassVersionError e) {
...
} catch (ReflectiveOperationException e) {
...
}
--
"I'm a doctor, not a mechanic." Dr Leonard McCoy <mccoy@ncc1701.starfleet.fed>
"I'm a mechanic, not a doctor." Volker Borchert <v_borchert@despammed.com>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
catch unsupported class version error Philipp Kraus <philipp.kraus@flashpixx.de> - 2015-02-01 23:49 +0100
Re: catch unsupported class version error Arne Vajhøj <arne@vajhoej.dk> - 2015-02-01 18:00 -0500
Re: catch unsupported class version error v_borchert@despammed.com (Volker Borchert) - 2015-02-02 00:29 +0000
Re: catch unsupported class version error Arne Vajhøj <arne@vajhoej.dk> - 2015-02-01 21:26 -0500
Re: catch unsupported class version error Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2015-02-02 06:53 +0000
csiph-web