Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Determining which versions of java a program will run on?

Reply
Thread Tools

Determining which versions of java a program will run on?

 
 
travel2light
Guest
Posts: n/a
 
      03-08-2008
Is there a way to find this out? Thanks for any advice.

Michael
 
Reply With Quote
 
 
 
 
Jeff Higgins
Guest
Posts: n/a
 
      03-08-2008

travel2light wrote:

Determining which versions of java a program will run on?

> Is there a way to find this out? Thanks for any advice.
>


This article may help.
Check out class file format.
<http://www.javaworld.com/javaworld/javaqa/2003-05/02-qa-0523-version.html>


 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      03-08-2008
On Mar 9, 2:26*am, travel2light <(E-Mail Removed)> wrote:
> Is there a way to find this out?


Please repeat subject line in the body of the message.

What app.? Yours or someone elses?

For your own, you might try compiling the code
using the -bootclasspath option, and pointing it
to the rt.jar of the earlier version.

--
Andrew T.
PkySci.org
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      03-08-2008
On Sat, 8 Mar 2008 08:26:13 -0800 (PST), travel2light
<(E-Mail Removed)> wrote, quoted or indirectly quoted
someone who said :

>Is there a way to find this out? Thanks for any advice.


see http://mindprod.com/project/jdkversion.html
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
travel2light
Guest
Posts: n/a
 
      03-09-2008
On 8 Mar, 23:35, Andrew Thompson <(E-Mail Removed)> wrote:
> On Mar 9, 2:26 am, travel2light <(E-Mail Removed)> wrote:
>
> > Is there a way to find this out?

>
> Please repeat subject line in the body of the message.


No problem.

>
> What app.? Yours or someone elses?
>
> For your own, you might try compiling the code
> using the -bootclasspath option, and pointing it
> to the rt.jar of the earlier version.
>
> --
> Andrew T.
> PkySci.org


This is my application. Actually I think I explained it incorrectly. I
only want to find out what versions of java the compiled code will run
on. I am using 1.6.0_03-b05. I don't intend to recompile it for
different versions.

Michael

 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      03-09-2008
On Mar 9, 10:27*am, travel2light <(E-Mail Removed)> wrote:
> On 8 Mar, 23:35, Andrew Thompson <(E-Mail Removed)> wrote:

...
> > For your own (app), you might try compiling the code
> > using the -bootclasspath option, and pointing it
> > to the rt.jar of the earlier version.

...
> ...I
> only want to find out what versions of java the compiled code will run
> on. I am using 1.6.0_03-b05. I don't intend to recompile it for
> different versions.


You don't need to. Any code that is compiled
to run on Java 1.4 (for example) will also run
just fine in Java 1.5 and 1.6 (etcetera).

The -bootclasspath option is useful because
it ensures the bytecodes are *really* compatible
with the target minimum version, as opposed to
simply having the bytecodes written in the form
expected for 1.4. That is what Jeff was referring
to when he mentioned the class file format.

So, it works like this, you compile code
using the 1.6 SDK, but specify the -bootclasspath
option and point that towards a 1.4 rt.jar
(as well, specify the -source and -target,
but the -bootclasspath is the one most people
miss).

The binary will be compatible with 1.4+.

Using -bootclasspath is also a good 'acid test'
for whether the code is truly compatible with
the target minimum version.

--
Andrew T.
PhySci.org
 
Reply With Quote
 
Arne Vajh°j
Guest
Posts: n/a
 
      03-09-2008
travel2light wrote:
> Is there a way to find this out? Thanks for any advice.


javap -verbose -classpath . yourpackage.YourClass

will display major and minor version number.

Version X will run on versions >X but not on version <X.

Basically JDK version 1.n.x uses major version 44+n.

Arne
 
Reply With Quote
 
Kenneth P. Turvey
Guest
Posts: n/a
 
      03-10-2008
On Sat, 08 Mar 2008 18:10:28 -0800, Andrew Thompson wrote:

[Snip]
> So, it works like this, you compile code
> using the 1.6 SDK, but specify the -bootclasspath
> option and point that towards a 1.4 rt.jar
> (as well, specify the -source and -target,
> but the -bootclasspath is the one most people
> miss).


I'm not the original poster, but I have a related question. You always
see the -source and -target options used together and set to the same java
version. Is this required these days. What I would like to do is to
create a 1.4 class file from 1.6 sources using a 1.4 rt.jar. So I could
use modern java language features, but restrict myself to the older
libraries and produce a class file that can be read by older versions of
the JRE?

Am I asking too much here?

Thanks.



--
Kenneth P. Turvey <(E-Mail Removed)>
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      03-10-2008
On Mar 10, 10:41*am, "Kenneth P. Turvey" <kt-
(E-Mail Removed)> wrote:
...
> I'm not the original poster, but I have a related question. *You always
> see the -source and -target options used together and set to the same java
> version. *


You might. I don't.

-source never has any meaning below '1.3',
whereas the -target might specify '1.1'.

>..Is this required these days. *What I would like to do is to
> create a 1.4 class file from 1.6 sources using a 1.4 rt.jar. *So I could
> use modern java language features, but restrict myself to the older
> libraries and produce a class file that can be read by older versions of
> the JRE? *


I am not entirely sure what you are asking,
but note that generics (for e.g.) cannot be
used in any code intended to run on 1.4.

--
Andrew T.
PhySci.org
 
Reply With Quote
 
Kenneth P. Turvey
Guest
Posts: n/a
 
      03-10-2008
On Sun, 09 Mar 2008 17:58:15 -0700, Andrew Thompson wrote:

> I am not entirely sure what you are asking,
> but note that generics (for e.g.) cannot be
> used in any code intended to run on 1.4.


Well, that would be one feature I would like. Would this give the modern
looping constructs (a favorite of mine)? What about assertions?

Thanks?



--
Kenneth P. Turvey <(E-Mail Removed)>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
making applets run on older versions of java? yawnmoth Java 1 08-04-2008 12:56 AM
Determining on which system is program running DeoXMAN Java 3 04-29-2007 11:56 AM
Can Java program evoke and run a FORTRAN program directly? Shawn Java 2 12-06-2006 07:08 PM
ADSL WIC support - which NM's, and which IOS versions? Kralizec Craig Cisco 5 12-08-2005 02:20 AM
How to javac a java program w/ another java program which is w/o a main method cjeffwang@yahoo.com Java 1 10-31-2005 04:25 AM



Advertisments