Re: CLI Java Glitch

Discussion in 'Java' started by Jeff Higgins, Jun 22, 2011.

  1. Jeff Higgins

    Jeff Higgins Guest

    On 06/20/2011 05:24 PM, Gene Wirchenko wrote:
    > Dear Java'ers:
    >
    > Given
    >
    > class HelloWorld
    > {
    > public static void main(String[] args)
    > {
    > System.out.println("Hello, world!");
    > }
    > }
    >
    > is there any way around the following?
    >
    > C:\cbs2dev\test>java helloworld
    > Exception in thread "main" java.lang.NoClassDefFoundError: helloworld
    > (wrong nam
    > e: HelloWorld)


    It seems so far the consensus for a "way around" is
    some variation on the theme of "wrapper script".
    Jeff Higgins, Jun 22, 2011
    #1
    1. Advertising

  2. On 11-06-21 10:52 PM, Jeff Higgins wrote:
    > On 06/20/2011 05:24 PM, Gene Wirchenko wrote:
    >> Dear Java'ers:
    >>
    >> Given
    >>
    >> class HelloWorld
    >> {
    >> public static void main(String[] args)
    >> {
    >> System.out.println("Hello, world!");
    >> }
    >> }
    >>
    >> is there any way around the following?
    >>
    >> C:\cbs2dev\test>java helloworld
    >> Exception in thread "main" java.lang.NoClassDefFoundError: helloworld
    >> (wrong nam
    >> e: HelloWorld)

    >
    > It seems so far the consensus for a "way around" is
    > some variation on the theme of "wrapper script".
    >

    That may be so, but it's not unanimous. Another camp, and I'm in it, is
    happy to leave things as is.

    Joe Average Computer User doesn't normally open up a terminal or a
    command prompt and run Java commands. So this is really a discussion
    about making a simple thing easier for _techie_ types. I don't think it
    warrants the effort, and in some ways it introduces problems where none
    existed before. Simplify the issue for some programmers on some systems;
    complicate it for other programmers on other systems. I don't agree.

    AHS
    Arved Sandstrom, Jun 22, 2011
    #2
    1. Advertising

  3. Jeff Higgins

    Jeff Higgins Guest

    On 06/22/2011 06:56 AM, Arved Sandstrom wrote:
    > On 11-06-21 10:52 PM, Jeff Higgins wrote:
    >> On 06/20/2011 05:24 PM, Gene Wirchenko wrote:
    >>

    > That may be so, but it's not unanimous. Another camp, and I'm in it, is
    > happy to leave things as is.
    >
    > Joe Average Computer User doesn't normally open up a terminal or a
    > command prompt and run Java commands. So this is really a discussion
    > about making a simple thing easier for _techie_ types. I don't think it
    > warrants the effort, and in some ways it introduces problems where none
    > existed before. Simplify the issue for some programmers on some systems;
    > complicate it for other programmers on other systems. I don't agree.


    I read the OP as wanting to make a simple thing easier for_Gene
    Wirchenko_. Others seem to be addressing a request to "fix" the java
    executable. Maybe Lew is right; we must be precise, precise, precise!
    Jeff Higgins, Jun 22, 2011
    #3
  4. On Wed, 22 Jun 2011 08:02:25 -0400, Jeff Higgins
    <> wrote:

    [snip]

    >I read the OP as wanting to make a simple thing easier for_Gene
    >Wirchenko_. Others seem to be addressing a request to "fix" the java
    >executable. Maybe Lew is right; we must be precise, precise, precise!


    Of course I want to make it easier for myself! That is why most
    of use who use computers use computers.

    Look at it this way. If Java were being spec'ed right now, would
    you have an objection to what I propose? Why not make it easier?

    Sincerely,

    Gene Wirchenko
    Gene Wirchenko, Jun 22, 2011
    #4
  5. Jeff Higgins

    Jeff Higgins Guest

    On 06/22/2011 01:18 PM, Gene Wirchenko wrote:
    > On Wed, 22 Jun 2011 08:02:25 -0400, Jeff Higgins
    > <> wrote:
    >
    > [snip]
    >
    >> I read the OP as wanting to make a simple thing easier for_Gene
    >> Wirchenko_. Others seem to be addressing a request to "fix" the java
    >> executable. Maybe Lew is right; we must be precise, precise, precise!

    >
    > Of course I want to make it easier for myself! That is why most
    > of use who use computers use computers.


    That is why I proposed a personal solution.

    > Look at it this way. If Java were being spec'ed right now,


    The behavior under discussion has been specified and is implemented and
    can now only be re-specified and implemented.

    > would you have an objection to what I propose?


    Yes because it would break a lot of others stuff.

    Why not make it easier?

    Back to the personal solution.
    Jeff Higgins, Jun 22, 2011
    #5
  6. On Wed, 22 Jun 2011 15:01:20 -0400, Jeff Higgins
    <> wrote:

    >On 06/22/2011 01:18 PM, Gene Wirchenko wrote:


    [snip]

    >> Look at it this way. If Java were being spec'ed right now,

    >
    >The behavior under discussion has been specified and is implemented and
    >can now only be re-specified and implemented.
    >
    >> would you have an objection to what I propose?

    >
    >Yes because it would break a lot of others stuff.


    What stuff?

    "If Java were being spec'ed right now", then nothing would get
    broken.

    [snip]

    Sincerely,

    Gene Wirchenko
    Gene Wirchenko, Jun 22, 2011
    #6
  7. On 11-06-22 02:18 PM, Gene Wirchenko wrote:
    > On Wed, 22 Jun 2011 08:02:25 -0400, Jeff Higgins
    > <> wrote:
    >
    > [snip]
    >
    >> I read the OP as wanting to make a simple thing easier for_Gene
    >> Wirchenko_. Others seem to be addressing a request to "fix" the java
    >> executable. Maybe Lew is right; we must be precise, precise, precise!

    >
    > Of course I want to make it easier for myself! That is why most
    > of use who use computers use computers.
    >
    > Look at it this way. If Java were being spec'ed right now, would
    > you have an objection to what I propose? Why not make it easier?
    >
    > Sincerely,
    >
    > Gene Wirchenko


    If I were spec'ing Java right now, I'd be muckling onto some C# ideas as
    far as packaging and structure go: folder and file names don't have to
    match namespace names or class names, and partial class/interface
    definitions (and partial methods for that matter) are available.

    AHS
    Arved Sandstrom, Jun 22, 2011
    #7
  8. Gene Wirchenko wrote:
    >
    > Look at it this way. If Java were being spec'ed right now, would
    > you have an objection to what I propose? Why not make it easier?


    Yes, because it misunderstands the nature of what the java executable
    is doing in that use case (as I noted in another message, which I
    believe was posted after you wrote the one I'm quoting here, so you
    won't have seen it).

    When you run "java foo", you are asking the java executable to create
    a JVM instance, load a class named "foo", instantiate it, find its
    "main" method, and execute it.

    As it happens, on most OSes, when the java executable is asked to load
    a class and is not given any other information about where that class
    resides, it searches a configurable list of filesystem locations for a
    file with the same name as the class, plus the extension ".class". It
    is conceivable that in environments where this doesn't make sense, a
    java executable, or its equivalent, could do something else to load
    the named class.

    You are *not* telling the java executable to open the file "foo.class"
    and muck about in it, trying to find some class with a main method to
    execute.

    Your proposal sets the cart before the horse.

    --
    Michael Wojcik
    Micro Focus
    Rhetoric & Writing, Michigan State University
    Michael Wojcik, Jun 23, 2011
    #8
  9. Jeff Higgins

    Arne Vajhøj Guest

    On 6/22/2011 5:52 PM, Arved Sandstrom wrote:
    > If I were spec'ing Java right now, I'd be muckling onto some C# ideas as
    > far as packaging and structure go: folder and file names don't have to
    > match namespace names or class names, and partial class/interface
    > definitions (and partial methods for that matter) are available.


    The Java package structure source code structure dependency can be a bit
    cumbersome to work with, but it does what I assume it was created for.
    You can always find the source code (within the project). With the
    free style you have to cross your fingers that the developer actually
    followed a reasonable practice.

    Partial classes are great for generated code. But there are not
    much tradition in the Java world for having IDE's generate code
    based on WYSIWYG.

    Arne
    Arne Vajhøj, Jul 22, 2011
    #9
    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. Stefan Ram

    Re: CLI Java Glitch

    Stefan Ram, Jun 20, 2011, in forum: Java
    Replies:
    2
    Views:
    294
    Stefan Ram
    Jun 21, 2011
  2. Martin Gregorie

    Re: CLI Java Glitch

    Martin Gregorie, Jun 20, 2011, in forum: Java
    Replies:
    54
    Views:
    1,283
    Andreas Leitgeb
    Jul 25, 2011
  3. Jeff Higgins

    Re: CLI Java Glitch

    Jeff Higgins, Jun 21, 2011, in forum: Java
    Replies:
    9
    Views:
    373
    Tom Anderson
    Jun 21, 2011
  4. Roedy Green

    Re: CLI Java Glitch

    Roedy Green, Jun 21, 2011, in forum: Java
    Replies:
    9
    Views:
    313
    Arne Vajhøj
    Jul 22, 2011
  5. Tom Anderson

    Re: CLI Java Glitch

    Tom Anderson, Jun 21, 2011, in forum: Java
    Replies:
    2
    Views:
    270
    Arne Vajhøj
    Jul 22, 2011
Loading...

Share This Page