Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / May 2004

Tip: Looking for answers? Try searching our database.

running a java.class file

Thread view: 
don - 16 May 2004 00:21 GMT
When I run a compiled java file from an MS DOS window I always have to type
java in front of the program....... how can I get around this..... I'm using
JBuilder9 to write and compile my source code..........
Roedy Green - 16 May 2004 01:39 GMT
>When I run a compiled java file from an MS DOS window I always have to type
>java in front of the program....... how can I get around this..... I'm using
>JBuilder9 to write and compile my source code..........

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

Signature

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Stewart Gordon - 17 May 2004 14:51 GMT
>>When I run a compiled java file from an MS DOS window I always have to type
>>java in front of the program....... how can I get around this..... I'm using
>>JBuilder9 to write and compile my source code..........
>
> see http://mindprod.com/jgloss/associations.html

Does this mean that 1.4.2 or 1.5.0 has started accepting a filename in
place of a class name, or that Win2K/XP has a way around this limitation?

OP: If your system doesn't meet these criteria, see
http://groups.google.co.uk/groups?threadm=3cad8490%40212.67.96.135
for a launcher program to do the trick.

Stewart.

Signature

My e-mail is valid but not my primary mailbox, aside from its being the
unfortunate victim of intensive mail-bombing at the moment.  Please keep
replies on the 'group where everyone may benefit.

Roedy Green - 17 May 2004 19:10 GMT
>Does this mean that 1.4.2 or 1.5.0 has started accepting a filename in
>place of a class name, or that Win2K/XP has a way around this limitation?

no.  You bundle your program in a jar and set up the association for
*.jar to java.exe

see http://mindprod.com/jgloss/jar.htm#EXECUTING

Signature

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Stewart Gordon - 19 May 2004 13:49 GMT
<snip>
> no.  You bundle your program in a jar and set up the association for
> *.jar to java.exe

That would add an extra step to the building of any app, which some
would consider overkill for one-class tests/samples.

And when developing, rejarring for every little change would defeat the
object of the exercise.  OK, so whether there's any point here would
probably depend to some extent on the DE and project structure....

> see http://mindprod.com/jgloss/jar.htm#EXECUTING

404 at the mo.

Stewart.

Signature

My e-mail is valid but not my primary mailbox, aside from its being the
unfortunate victim of intensive mail-bombing at the moment.  Please keep
replies on the 'group where everyone may benefit.

Roedy Green - 19 May 2004 18:58 GMT
>> see http://mindprod.com/jgloss/jar.htm#EXECUTING
>
>404 at the mo.

try

http://mindprod.com/jgloss/jar.html#EXECUTING

or just look up "jar" in the index on nearly every page.

Signature

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Tom - 17 May 2004 04:30 GMT
> When I run a compiled java file from an MS DOS window I always have to type
> java in front of the program....... how can I get around this..... I'm using
> JBuilder9 to write and compile my source code..........

It doesn't really matter what editor that you are using.  Java runs
the same way regardless of the editor used, or the platform that it
was created on.

Java does not run directly on any computer.  When you type in java
SomeProgram, what you are doing is running a program called the Java
Virtual Machine, and telling it to run the program defined in
SomeProgram.  Someone or something has to start the JVM.

One workaround, if you are writing programs with a GUI interface, is
to put the program in a Jar file.  On Windows and Mac's, Jar files can
be run by clicking on the file, just like a native application
(assuming that Java is installed on the computer).  If your program
does not have a GUI, then Jars won't help.
Stewart Gordon - 17 May 2004 14:35 GMT
<snip>
> One workaround, if you are writing programs with a GUI interface, is
> to put the program in a Jar file.  On Windows and Mac's, Jar files can
> be run by clicking on the file, just like a native application
> (assuming that Java is installed on the computer).  If your program
> does not have a GUI, then Jars won't help.

Wrong.  You can change the association of .jar from javaw to java, just
as you can with any file type.

Stewart.

Signature

My e-mail is valid but not my primary mailbox, aside from its being the
unfortunate victim of intensive mail-bombing at the moment.  Please keep
replies on the 'group where everyone may benefit.

Tom - 17 May 2004 22:21 GMT
> <snip>
> > One workaround, if you are writing programs with a GUI interface, is
[quoted text clipped - 5 lines]
> Wrong.  You can change the association of .jar from javaw to java, just
> as you can with any file type.

Mea Culpa.  I didn't think about that - probably because I've never
wanted to do that.  My concern with this is that console programs are
often "beginner" programs that run very quickly and then end.  I
wonder if the DOS window will stay open after the program finishes.  
I don't know if the OP is a newbie or not, but eventually some newbie
will read this post.  If the DOS window doesn't stay open, then any
newbie that tries this will get pretty frustrated.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.