Re: Trying to run first java program

From: Skippy (a_at_b.invalid)
Date: 02/20/04


Date: Fri, 20 Feb 2004 12:21:10 +0100


> Skippy wrote:
>
> >> It just occured to me you are better off using the target option from
> >> your 1.5 commandline
> >>
> >> try this:
> >> javac -target 1.3 myFirstProgram.java
> >>
> >> It will compile to 1.3 java class instead of 1.5
> >>
> >> That is probably a lot easier than installing old java versions. :-)
> >
> > I can't believe you say this...
>
> Hi Skippy,
>
> (blushes)
> I agree my posting didn't make sense.
>
> Now I reread it, I wanted I thought that over before posting.
> I didn't only miss the point technically, but also logically. :-(
> Sorry for the misinformation.
> Thanks for putting that right. I stand corrected.
>
> But I still wonder where this comes from:
>
> Registry key 'Software\Javasoft\Java Runtime Environment\CurrentVersion'
> has value '1.5', but '1.3' is required.
>
> That made me think he installed 1.5, but he is trying to run bytecode
> compiled for 1.3.
>
> What do you make of it?
>
> >
> > First you think the app depends on 1.3, then you suggest compiling for
> > 1.3...
>
> Which was clearly bull. I agree.
>
> >
> > What this guy needs is a working java environment to run his first app
> > (how can your first app -like HelloWorld - require 1.3 ?!)
>
> Where did OP state that he was compiling HelloWorld, or something like
that?

The title of his posting was: "Trying to run first java program", which I
assume isn't very complex - more like HelloWorld, but ofcourse could be a
new Eclipse build as well.

> Now I reread the OP message, I have to say I don't understand his problem.
> Maybe he is trying to run an existing classfile without sourcecode that
for
> some reason demands 1.3.
> But I am confused. :-/

You're not the only one. I think this is some kind of checking of the JVM
before it launches the app: if(!regVersion.equals(binVersion)) {
jvm.crash(); }

Could be something else...

> > This is the way to go: uninstall all aborted/outdated java installations
> > and install the one you want to use.
>
> which is? 1.4?

1.4.2_03 or if you are just testing: 1.5.0-beta

> > From then on you won't have
> > versioning-problems like that and your source-code will compile and run
as
> > it should.
>
> I might as well take advantage of this situation and ask you this: Is it
> possible to use constructs/classes in your sourcecode that needs 1.3 and
> will not compile under a higher version?

Yeso and No. All bytecode *should* be backwards-compatible. You can ofcourse
code your own checks using System.getProperty("java.version") but the
compiled code itself has no limitations.

Since there are some syntax-changes in 1.5 and 1.4 (assert) it might be a
probl;em to *compile* some sourcecode with a variable named 'assert' with
'-target 1.4" as a jvm-command. Same for keywords like 'enum' in 1.5.
Running successfully *compiled* code with these variable-names should be no
problem on any jvm-version.

(I don't mean only the
> 'deprecated' warning, but more a 'deprecated and flushed and we don't
> support this stuff anymore' kind of situation.)
> Does that exist?

No... that would break almost any applet on the internet (java 1.0-1.1) when
running the latest JVM / JRE.

> (I have only seen deprecated untill now)

As you should :o)

> Thanks for your time and sorry for the misinformation, Larry!

Have fun coding...!



Relevant Pages

  • Re: VS 2005: __clrcall error exporting DLL functions which are not __clrcall? + /clr:pure/safe quest
    ... > This posting is provided "AS IS" with no warranties, and confers no ... >> A code like this will compile on 2003 without problems but will fail to ...
    (microsoft.public.dotnet.languages.vc)
  • Re: OT: Tools for Sale
    ... Simply a Heads-Up while I compile the list and photos for anyone ... I've been posting here for many years, so denizens should ...
    (rec.woodworking)
  • Re: Javascript In A Servlet??
    ... Steve Burrus wrote: ... Top posting is what you've been doing. ... that he included a link (most newsreaders will make it "clickable") ... then it's easier to compile and test. ...
    (comp.lang.java.programmer)
  • Re: C scripting (continued)
    ... The code will compile and run under windows and unix... ... I reformated for posting to avoid line breaks. ... And your reformatting broke the code. ... And just in case you feel like I'm picking on you personally, ...
    (comp.lang.c)
  • Re: beginners Question
    ... > I get approx 200 errormessages when I try to compile the following ... > sourcecode with javac. ... in how you enter the javac command. ...
    (comp.lang.java.help)