Windows integration of the JRE and JDK

Discussion in 'Java' started by Stefan Ram, Dec 2, 2010.

  1. Stefan Ram

    Stefan Ram Guest

    What could be reasons that Sun did never implement
    the following behaviour upon installation of the JDK
    (or possibly, the JRE) on Windows, which after all
    is an important plattform. (Similar things might be
    possible under other operating systems, too.)

    The following behaviors seem so obvious to me:

    - The directory with the commands »java« and
    »javac« is added to the Windows »path«.

    - When a *.class file is »opened« in the explorer
    and this file has a static main method it is
    opened with the java command (when it extends
    Applet/JApplet it could be opend with appletviewer
    and a default HTML wrapper file; when it contains
    a reference to Swing or AWT, it is opened with javaw.)
    When it needs other classes, they are compiled
    if this is necessary.

    - When a *.java file is »opened« in the explorer
    it is compiled to a *.class file, which is kept
    in memory and then treated as described above.

    - (if possible)When »example ...« is typed on the
    command line and a file »example.class ...« exists
    but no file »example« exists then this treated as
    if »java example ...« would have been typed
    (I don't know if this is possible).

    - All of the above options are indicated with a
    checked checkmark in the installation program,
    so that a user can deselect them, if he does not
    want them.
     
    Stefan Ram, Dec 2, 2010
    #1
    1. Advertising

  2. Stefan Ram

    Arne Vajhøj Guest

    On 02-12-2010 01:31, Stefan Ram wrote:
    > What could be reasons that Sun did never implement
    > the following behaviour upon installation of the JDK
    > (or possibly, the JRE) on Windows, which after all
    > is an important plattform. (Similar things might be
    > possible under other operating systems, too.)
    >
    > The following behaviors seem so obvious to me:
    >
    > - The directory with the commands »java« and
    > »javac« is added to the Windows »path«.


    JRE java.exe is copied to somewhere in PATH.

    Putting JDK bin dir in PATH and setting JAVA_HOME could
    make sense.

    But then Java and Windows was never that integrated.

    > - When a *.class file is »opened« in the explorer
    > and this file has a static main method it is
    > opened with the java command (when it extends
    > Applet/JApplet it could be opend with appletviewer
    > and a default HTML wrapper file; when it contains
    > a reference to Swing or AWT, it is opened with javaw.)
    > When it needs other classes, they are compiled
    > if this is necessary.


    Probably too little benefits. Most real world apps require
    various classpaths to be defined.

    > - When a *.java file is »opened« in the explorer
    > it is compiled to a *.class file, which is kept
    > in memory and then treated as described above.


    Nothing else does that on Windows. At least not something I know.

    > - (if possible)When »example ...« is typed on the
    > command line and a file »example.class ...« exists
    > but no file »example« exists then this treated as
    > if »java example ...« would have been typed
    > (I don't know if this is possible).


    That may be very closely related to the explorer option.

    > - All of the above options are indicated with a
    > checked checkmark in the installation program,
    > so that a user can deselect them, if he does not
    > want them.


    Except for the auto compile and run option then I would not
    complain.

    Arne
     
    Arne Vajhøj, Dec 2, 2010
    #2
    1. Advertising

  3. Stefan Ram

    markspace Guest

    On 12/1/2010 10:31 PM, Stefan Ram wrote:

    > The following behaviors seem so obvious to me:
    >
    > - The directory with the commands »java« and
    > »javac« is added to the Windows »path«.



    Could be bad if you already have a PATH for Java set. Programmers can
    deal with this, messing up the PATH of a normal user probably is not the
    best idea.


    >
    > - When a *.class file is »opened« in the explorer
    > and this file has a static main method it is
    > opened with the java command (when it extends
    > Applet/JApplet it could be opend with appletviewer
    > and a default HTML wrapper file; when it contains
    > a reference to Swing or AWT, it is opened with javaw.)
    > When it needs other classes, they are compiled
    > if this is necessary.



    This works with Jar files on my system. I'm not sure extending it to
    ..class files is needed, but it should be possible to do. Note that to
    test the interface type of a .class file you'll need a launcher, because
    the neither java.exe nor java.exe -jar do this now.


    >
    > - When a *.java file is »opened« in the explorer
    > it is compiled to a *.class file, which is kept
    > in memory and then treated as described above.



    Pernicious. When I open a .java file, I want to edit the text. Get an IDE.


    >
    > - (if possible)When »example ...« is typed on the
    > command line and a file »example.class ...« exists
    > but no file »example« exists then this treated as
    > if »java example ...« would have been typed
    > (I don't know if this is possible).



    This works now for Jar files. Again I'm not sure of the value of doing
    this for .class files too. It might create some confusion if the user
    misspells a .class file name, or at least might provoke a lot of
    unneeded searching amongst bazillions of loose .class files on the
    average developer hard drive.


    >
    > - All of the above options are indicated with a
    > checked checkmark in the installation program,
    > so that a user can deselect them, if he does not
    > want them.



    Fair enough.
     
    markspace, Dec 2, 2010
    #3
  4. Stefan Ram

    Roedy Green Guest

    On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    quoted or indirectly quoted someone who said :

    >The following behaviors seem so obvious to me:
    >
    > - The directory with the commands »java« and
    > »javac« is added to the Windows »path«.


    It would have to be optional because developers so often keep several
    JDK and JRE versions installed.

    The path is not needed for Browser use which is what most casual users
    are doing. They are not clever enough to run anything from the
    command line, much less Java's awkward java.exe -jar .
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    In programming, and documenting programs, keep vocabulary consistent and precisely defined! Variation in vocabulary to relieve the tedium is for novels.
     
    Roedy Green, Dec 2, 2010
    #4
  5. Stefan Ram

    Roedy Green Guest

    On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    quoted or indirectly quoted someone who said :

    > - When a *.class file is »opened« in the explorer
    > and this file has a static main method it is
    > opened with the java command (when it extends
    > Applet/JApplet it could be opend with appletviewer
    > and a default HTML wrapper file; when it contains
    > a reference to Swing or AWT, it is opened with javaw.)
    > When it needs other classes, they are compiled
    > if this is necessary.


    see http://mindprod.com/jgloss/extension.html

    I could see this for a jar -- automatically setting up the .jar
    extensions -- something I have asked for many times myself. It then
    can work both in browsers and on the command line.

    There is not as good an argument for a bare class file. It needs a
    corresponding classpath, usually provided by the invoking .bat file.

    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    In programming, and documenting programs, keep vocabulary consistent and precisely defined! Variation in vocabulary to relieve the tedium is for novels.
     
    Roedy Green, Dec 2, 2010
    #5
  6. Stefan Ram

    Roedy Green Guest

    On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    quoted or indirectly quoted someone who said :

    > - When a *.java file is »opened« in the explorer
    > it is compiled to a *.class file, which is kept
    > in memory and then treated as described above.


    That would require distributing Javac in the JRE. Users already balk
    at the size of the JRE. You would also need some way to provide all
    the options of Javac.exe and Java.exe. One way out of that would be
    for Oracle to twist arms of computer manufacturers to preinstall
    JDK/JRE and to have a transparent INCREMENTAL way of keeping them up
    to date.


    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    In programming, and documenting programs, keep vocabulary consistent and precisely defined! Variation in vocabulary to relieve the tedium is for novels.
     
    Roedy Green, Dec 2, 2010
    #6
  7. Stefan Ram

    Roedy Green Guest

    On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    quoted or indirectly quoted someone who said :

    >- (if possible)When »example ...« is typed on the
    > command line and a file »example.class ...« exists
    > but no file »example« exists then this treated as
    > if »java example ...« would have been typed
    > (I don't know if this is possible).



    I fooled around trying to make that work back in the 1990s. I
    discovered that Windows extensions mechanism was not clever enough to
    generate the needed effect. Unfortunately Microsoft feels about Java
    the same way the Republicans feel about Obama. They are willing to do
    anything to make it fail.

    See http://mindprod.com/project/kicker.html

    As my kludge.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    In programming, and documenting programs, keep vocabulary consistent and precisely defined! Variation in vocabulary to relieve the tedium is for novels.
     
    Roedy Green, Dec 2, 2010
    #7
  8. Stefan Ram

    Roedy Green Guest

    On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    quoted or indirectly quoted someone who said :

    > - All of the above options are indicated with a
    > checked checkmark in the installation program,
    > so that a user can deselect them, if he does not
    > want them.


    There are two kinds of user
    1. a developer who wants micro control over everything.
    2. an end user who wants it all to work automagically without asking
    any questions, preferably without even putting up a dialog box.

    There probably be separate download links for both.

    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    In programming, and documenting programs, keep vocabulary consistent and precisely defined! Variation in vocabulary to relieve the tedium is for novels.
     
    Roedy Green, Dec 2, 2010
    #8
  9. Stefan Ram

    Roedy Green Guest

    On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    quoted or indirectly quoted someone who said :

    >The following behaviors seem so obvious to me:
    >
    > - The directory with the commands »java« and
    > »javac« is added to the Windows »path«.


    It would have to be optional because developers so often keep several
    JDK and JRE versions installed.

    The path is not needed for Browser use which is what most casual users
    are doing. They are not clever enough to run anything from the
    command line, much less Java's awkward java.exe -jar .
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    In programming, and documenting programs, keep vocabulary consistent and precisely defined! Variation in vocabulary to relieve the tedium is for novels.
     
    Roedy Green, Dec 2, 2010
    #9
  10. Stefan Ram

    Roedy Green Guest

    On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    quoted or indirectly quoted someone who said :

    > - When a *.class file is »opened« in the explorer
    > and this file has a static main method it is
    > opened with the java command (when it extends
    > Applet/JApplet it could be opend with appletviewer
    > and a default HTML wrapper file; when it contains
    > a reference to Swing or AWT, it is opened with javaw.)
    > When it needs other classes, they are compiled
    > if this is necessary.


    see http://mindprod.com/jgloss/extension.html

    I could see this for a jar -- automatically setting up the .jar
    extensions -- something I have asked for many times myself. It then
    can work both in browsers and on the command line.

    There is not as good an argument for a bare class file. It needs a
    corresponding classpath, usually provided by the invoking .bat file.

    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    In programming, and documenting programs, keep vocabulary consistent and precisely defined! Variation in vocabulary to relieve the tedium is for novels.
     
    Roedy Green, Dec 2, 2010
    #10
  11. Stefan Ram

    Roedy Green Guest

    On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    quoted or indirectly quoted someone who said :

    >- (if possible)When »example ...« is typed on the
    > command line and a file »example.class ...« exists
    > but no file »example« exists then this treated as
    > if »java example ...« would have been typed
    > (I don't know if this is possible).



    I fooled around trying to make that work back in the 1990s. I
    discovered that Windows extensions mechanism was not clever enough to
    generate the needed effect. Unfortunately Microsoft feels about Java
    the same way the Republicans feel about Obama. They are willing to do
    anything to make it fail.

    See http://mindprod.com/project/kicker.html

    As my kludge.
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    In programming, and documenting programs, keep vocabulary consistent and precisely defined! Variation in vocabulary to relieve the tedium is for novels.
     
    Roedy Green, Dec 2, 2010
    #11
  12. Stefan Ram

    Arne Vajhøj Guest

    On 02-12-2010 16:36, Roedy Green wrote:
    > On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    > quoted or indirectly quoted someone who said :
    >
    >> - When a *.class file is »opened« in the explorer
    >> and this file has a static main method it is
    >> opened with the java command (when it extends
    >> Applet/JApplet it could be opend with appletviewer
    >> and a default HTML wrapper file; when it contains
    >> a reference to Swing or AWT, it is opened with javaw.)
    >> When it needs other classes, they are compiled
    >> if this is necessary.

    >
    > see http://mindprod.com/jgloss/extension.html


    Why ?

    It does not contain anything relevant for the thread.

    > I could see this for a jar -- automatically setting up the .jar
    > extensions -- something I have asked for many times myself. It then
    > can work both in browsers and on the command line.


    It already does.

    Arne
     
    Arne Vajhøj, Dec 3, 2010
    #12
  13. Stefan Ram

    Arne Vajhøj Guest

    On 02-12-2010 16:39, Roedy Green wrote:
    > On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    > quoted or indirectly quoted someone who said :
    >
    >> - When a *.java file is »opened« in the explorer
    >> it is compiled to a *.class file, which is kept
    >> in memory and then treated as described above.

    >
    > That would require distributing Javac in the JRE.


    Not necessarily - the feature could require JDK.

    Arne
     
    Arne Vajhøj, Dec 3, 2010
    #13
  14. Stefan Ram

    Lew Guest

    On 12/02/2010 08:21 PM, Arne Vajhøj wrote:
    > On 02-12-2010 16:39, Roedy Green wrote:
    >> On 2 Dec 2010 06:31:13 GMT, -berlin.de (Stefan Ram) wrote,
    >> quoted or indirectly quoted someone who said :
    >>
    >>> - When a *.java file is »opened« in the explorer
    >>> it is compiled to a *.class file, which is kept
    >>> in memory and then treated as described above.

    >>
    >> That would require distributing Javac in the JRE.

    >
    > Not necessarily - the feature could require JDK.


    A good point made somewhere upthread, apologies for deliberate laziness in
    researching by whom: The Java platform already provides packaging systems to
    run under various JRE configurations (SE, EE, ...). Windows and Unices can
    run JAR files as executables if configured similarly to how Excel spreadsheets
    automatically bring up their commander. JARs have mechanisms to deliver all
    needed dependencies, although setup is required in many scenarios. (For what
    programs is that not true?) For complex installations there are installer
    programs. Java even provides Java WebStart.

    The segregation of the runtime from the JDK was deliberate to facilitate
    widespread deployment. Java has enough handicaps in that area as it is, some
    might say. It isn't all that outré really. Java certainly didn't invent the
    notion of a separate runtime engine.

    Often Java's delivery and deployment mechanisms are primitive and clunky.
    OTOH they do run under unprivileged logins just about anywhere. "jar" and its
    kin suffice to create self-contained packages. The packaging and deployment
    primitives can in turn be packaged and deployed more elegantly, as they are
    for some well-known Java products already. It ain't perfect, but the
    compromises aren't egregious and can be ameliorated.

    --
    Lew
     
    Lew, Dec 3, 2010
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nospawn
    Replies:
    2
    Views:
    551
    Real Gagnon
    Apr 25, 2006
  2. Ulf Meinhardt
    Replies:
    0
    Views:
    6,493
    Ulf Meinhardt
    Aug 10, 2006
  3. Prasoon
    Replies:
    1
    Views:
    498
    Andrew Thompson
    Apr 13, 2007
  4. Artur McCennon
    Replies:
    0
    Views:
    435
    Artur McCennon
    Jul 22, 2009
  5. Jochen Brenzlinger
    Replies:
    5
    Views:
    995
    Roedy Green
    Sep 2, 2011
Loading...

Share This Page