Re: Trying to run first java program

From: Erwin Moller (since_humans_read_this_I_am_spammed_too_much_at_spamyourself.com)
Date: 02/19/04


Date: Thu, 19 Feb 2004 12:51:23 +0100

Larry Higgins wrote:

> After many attempts, with help from this newsgroup I got my first program
> to
> compile. Now when I try to run it I get three error messages:
>
> Registry key 'Software\Javasoft\Java Runtime
> Environment\CurrentVersion'
> has value '1.5', but '1.3' is required.
> Error: could not find java.dll
> Error: could not find Java 2 Runtime Environment
>
> My hard drive has the remnants of several aborted attempts to install
> different versions of sdk, along with the 1.5 beta that finally installed
> OK. I'm wondering whether I need to get rid of those remnants. If
> there's a different version of javac or java that might explain why it's
> looking for
> 1.3 instead of 1.5. Or, maybe if I find java.dll and Java 2 Runtime
> Environment, and add their locations to the path environment variable,
> that might cure the "could not
> find" errors. Suggestions?
>
> TIA
>
> Larry

Hi Larry,

Java evolves as do most languages.
That means that Sun creates new versions, sometimes called 'runtimes'.
They are numbered 1.1 1.2 1.3 etc.

At this moment the latest version is 1.4
And 1.5 is in still in beta, I think.

The program you try to run explicitly asks for Java runtime 1.3
You have installed 1.5 on your system.
That is why it complains.

There are several solutions to your problem, depending on what you want to
achieve.
IF you want that particular program to run, you should get JRE 1.3
You can download older version (like 1.3) from suns website.

If you want your 1.5 installation to coexist with 1.3, that is possible.
Just download AND unpack 1.3 somewhere on your HD.
Go to the bin directory.
You will find several executable in there.
Important are javac and java
use javac to compile your sourcecode (*.java file)
eg: javac myFirstProgram.java
use java to run your already compiled program.
eg: java myFirstProgram (without the .class extension)

If you call the java runtime from the directory the java program is in, THAT
version will be used.
You can also type in the full pathname to your 1.3/bin directory.

It is just like you have different programs called 'print' in different
directories that can do different things.

In general: try to use the latest version (1.4).

Warning: if you try to use java or javac from a different directory, your
PATH environment variable will be used to find java or javac. It is
probably set to your latest install. SO stick to the right directory

Hope that helps you going.
Hang in. :P

Regards and succes,
Erwin Moller



Relevant Pages

  • Re: newbee in java programming
    ... On my machine I have this java version ... Posted via NewsDemon.com - Premium Uncensored Newsgroup Service ... the full install of JDK on my machine< ... then compile and run ...
    (comp.lang.java.programmer)
  • Re: ERROR: BOOTDIR environment variable
    ... |>I am trying to install Java from my /usr/ports/java/jdk13 ports. ... Before you can compile and install jdk13 you need to have ... Start by installing the Diablo JDK port -- which is ...
    (freebsd-questions)
  • Re: newbee in java programming
    ... On my machine I have this java version ... Posted via NewsDemon.com - Premium Uncensored Newsgroup Service ... When you install the JDK on Windows it installs the compiler as well but doesn't set up the path so you can run it. ... then compile and run your program. ...
    (comp.lang.java.programmer)
  • Re: Producing a binary install
    ... It did bomb once, about 4 hours into the compile, and demanded I ... Java, and other packages are not available in pre-compiled form. ... install for her over the net, and then do the rest of the install ... Otherwise doing a 'make package' after the port has been installed will create a package for you. ...
    (freebsd-questions)
  • Re: visual j++ and javax?
    ... >> using JDK's javac. ... > to develop in Java, and the differences between Java and Microsoft's ... Not that I want to have 'javac' compile the code, I want VJ to compile and ... the JDK's java/lang/Object and VJ's old java/lang/Object. ...
    (comp.lang.java.programmer)