Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: CLI Java Glitch

Reply
Thread Tools

Re: CLI Java Glitch

 
 
Jeff Higgins
Guest
Posts: n/a
 
      06-22-2011
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".

 
Reply With Quote
 
 
 
 
Arved Sandstrom
Guest
Posts: n/a
 
      06-22-2011
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
 
Reply With Quote
 
 
 
 
Jeff Higgins
Guest
Posts: n/a
 
      06-22-2011
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!
 
Reply With Quote
 
Gene Wirchenko
Guest
Posts: n/a
 
      06-22-2011
On Wed, 22 Jun 2011 08:02:25 -0400, Jeff Higgins
<(E-Mail Removed)> 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
 
Reply With Quote
 
Jeff Higgins
Guest
Posts: n/a
 
      06-22-2011
On 06/22/2011 01:18 PM, Gene Wirchenko wrote:
> On Wed, 22 Jun 2011 08:02:25 -0400, Jeff Higgins
> <(E-Mail Removed)> 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.
 
Reply With Quote
 
Gene Wirchenko
Guest
Posts: n/a
 
      06-22-2011
On Wed, 22 Jun 2011 15:01:20 -0400, Jeff Higgins
<(E-Mail Removed)> 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

 
Reply With Quote
 
Arved Sandstrom
Guest
Posts: n/a
 
      06-22-2011
On 11-06-22 02:18 PM, Gene Wirchenko wrote:
> On Wed, 22 Jun 2011 08:02:25 -0400, Jeff Higgins
> <(E-Mail Removed)> 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
 
Reply With Quote
 
Michael Wojcik
Guest
Posts: n/a
 
      06-23-2011
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
 
Reply With Quote
 
Arne Vajh°j
Guest
Posts: n/a
 
      07-22-2011
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


 
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
Re: CLI Java Glitch Martin Gregorie Java 54 07-25-2011 11:25 AM
Re: CLI Java Glitch Tom Anderson Java 2 07-22-2011 09:47 PM
Re: CLI Java Glitch Roedy Green Java 9 07-22-2011 09:45 PM
Re: CLI Java Glitch Jeff Higgins Java 9 06-21-2011 09:45 PM
Re: CLI Java Glitch Stefan Ram Java 2 06-21-2011 07:43 AM



Advertisments