Author |
Message |
marc #1 / 16
|
 where is my main method(like java)??
hello. i'm an experienced java programmer and at the moment i'm doing my first steps in Smalltalk. i build an application but i can just let it run via my workpad. 1) is there something like a main method like in java 2) how to package the applications to use these as standalone apps. thank you marco paga
|
Mon, 25 Oct 2004 00:42:28 GMT |
|
 |
Andy Bowe #2 / 16
|
 where is my main method(like java)??
Macro, Quote: > i'm an experienced java programmer and at the moment i'm doing my first > steps in smalltalk. > i build an application but i can just let it run via my workpad. > 1) is there something like a main method like in java > 2) how to package the applications to use these as standalone apps.
It depends what version of Smalltalk are you running? In Dolphin Smalltalk you have a #main method in the SessionManager class which you can override in your own sublclass. For example, Hello World in Dolphin is implemented in the CommandLineHelloWorld class as: CommandLineHelloWorld>>main "Implement the main body of the Headless Hello World application by printing that familiar greeting to the standard output stream." self stdout nextPutAll: 'Hello World!'; cr; flush. self stderr nextPutAll: 'Press <Enter> to exit:'; flush. self stdin nextLin. To deploy this as an executable you invoke an "image {*filter*}" to remove all unwanted classes from the image. The Dolphin image {*filter*} wizard only comes with the professional edition but will strip down a 5Mb development image to a 300K single file EXE for Hello World (including the VM). Best Regards, Andy Bower Object Arts Ltd. http://www.*-*-*.com/ --- Are you trying too hard? http://www.*-*-*.com/ ---
|
Mon, 25 Oct 2004 01:12:04 GMT |
|
 |
Steven T Abel #3 / 16
|
 where is my main method(like java)??
Quote: > 1) is there something like a main method like in java
Depends which Smalltalk you are using. In most, there is no "main". You set up your application, then you sort of "freeze-dry" it. There are tools for removing the stuff your code doesn't need, for example, the development tool classes. You then shut down your app and distribute the saved image. When the user loads your image file, he sees the same stuff you saw when you saved it. If there are things that need to be explicitly started, such as socket or database connections, the different vendors have various ways of telling your code to do things when the image is loaded. In VW, investigate making your initialization code dependent on ObjectMemory. Steve -- Steven T Abell Software Designer http://www.brising.com In software, nothing is more concrete than a good abstraction.
|
Mon, 25 Oct 2004 02:10:26 GMT |
|
 |
Chris Lopema #4 / 16
|
 where is my main method(like java)??
Really at this stage I would not worry about packaging, stripping or even automatically starting your application. Concentrate on all the wonderful things you can do. Quote:
> hello. > i'm an experienced java programmer and at the moment i'm doing my first > steps in smalltalk. > i build an application but i can just let it run via my workpad. > 1) is there something like a main method like in java > 2) how to package the applications to use these as standalone apps. > thank you > marco paga
|
Mon, 25 Oct 2004 02:11:13 GMT |
|
 |
Randall Steven #5 / 16
|
 where is my main method(like java)??
Quote:
> hello. > i'm an experienced java programmer and at the moment i'm doing my first > steps in smalltalk. > i build an application but i can just let it run via my workpad. > 1) is there something like a main method like in java > 2) how to package the applications to use these as standalone apps. > thank you > marco paga
Do did not state which Smalltalk version you were using, so I 'll take a stab at it from the VisualWorks 2.5.2 perspective. There is no main method, however you will generally design a class with initialization methods. Using RuntimePackager, you would state the class and initialization method as well as the packaged application name.
|
Mon, 25 Oct 2004 03:43:52 GMT |
|
 |
no spa #6 / 16
|
 where is my main method(like java)??
well, you probably have a long way to go before you get to that stage. there is a lot of info on doing this stuff on this newsgroup as well as the commercial versions of smalltalk now include a lot of what you need. you can download visualworks for free and it comes with all the documentation you need. if you can get your hands on an old copy of V from digitalk, you can create an exe file. -- ****************************** Fred Parker I hail from Hotmail My Handle is eticket2000 ******************************
Quote: > hello. > i'm an experienced java programmer and at the moment i'm doing my first > steps in smalltalk. > i build an application but i can just let it run via my workpad. > 1) is there something like a main method like in java > 2) how to package the applications to use these as standalone apps. > thank you > marco paga
|
Mon, 25 Oct 2004 05:48:12 GMT |
|
 |
jaro.. #7 / 16
|
 where is my main method(like java)??
You can create an exe from a new copy of VisualWorks, so there's no need to go into the way back machine
Quote:
>well, you probably have a long way to go before you get to that stage. there >is a lot of info on doing this stuff on this newsgroup as well as the >commercial versions of smalltalk now include a lot of what you need. you can >download visualworks for free and it comes with all the documentation you >need. >if you can get your hands on an old copy of V from digitalk, you can create >an exe file. >-- >****************************** >Fred Parker >I hail from Hotmail >My Handle is eticket2000 >******************************
>> hello. >> i'm an experienced java programmer and at the moment i'm doing my first >> steps in smalltalk. >> i build an application but i can just let it run via my workpad. >> 1) is there something like a main method like in java >> 2) how to package the applications to use these as standalone apps. >> thank you >> marco paga
-- James A. Robertson Product Manager (Smalltalk), Cincom
<Talk Small and Carry a Big Class Library>
|
Mon, 25 Oct 2004 06:25:06 GMT |
|
 |
Thomas Gagn #8 / 16
|
 where is my main method(like java)??
It's sometimes difficult to explain all this to a new Smalltalker, but some of the other comments already in this thread have indicated it's somewhat depending on the flavor of Smalltalk you're using. After playing with Smalltalk for little over a year, I finally created a #main for some of my applications. Along with it is a way of creating headless applications (run without a GUI) that work with stdin, stdout, and stderr. Unfortuneately, I've been unable to get stdin working on Windows in VisualWorks. It's not a problem on flavors of Unix, however. I think it would be much easier for beginners to have a main()-like function to start their programs with. Eventually you'll understand why there isn't, but that will come in time. Have fun learning Smalltalk! I sure have.
-- .tom
|
Mon, 25 Oct 2004 08:36:54 GMT |
|
 |
Nevin Prat #9 / 16
|
 where is my main method(like java)??
Quote:
> 1) is there something like a main method like in java
If you want one, create one. It's just another class method, that's all. Also remember, you can give your "main" method any actual name you want. If you really do want to call it "main", go ahead. If not, then call it something else. When you package your app, you tell the packager what method of what class to begin execution with. That's why it can have any name you choose. If you haven't yet packaged your app and are still working in the IDE, you can "test" your app by sending your startup message to your startup class from a workspace (or from anywhere else, for that matter). Just type your code, and then evaluate what you've typed (i.e., "do-it"). BTW, why would you care to call your startup method "main", anyway? Why not something more descriptive? Nevin
|
Mon, 25 Oct 2004 23:09:40 GMT |
|
 |
Vlastimil Adamovsk #10 / 16
|
 where is my main method(like java)??
You simply write: aClass doSomething or anInstanceOfaClass doSomething There is no need for a main. Vlastik
Quote: > hello. > i'm an experienced java programmer and at the moment i'm doing my first > steps in smalltalk. > i build an application but i can just let it run via my workpad. > 1) is there something like a main method like in java > 2) how to package the applications to use these as standalone apps. > thank you > marco paga
|
Mon, 25 Oct 2004 00:54:22 GMT |
|
 |
Steve Taylo #11 / 16
|
 where is my main method(like java)??
Quote:
> BTW, why would you care to call your startup method "main", anyway? Why > not something more descriptive?
He did say "something *like* a main method" - a clear starting point. I had the same question when I started learning Smalltalk too. Quote: > Nevin
Steve
|
Thu, 28 Oct 2004 17:37:24 GMT |
|
 |
#12 / 16
|
 where is my main method(like java)??
|
Wed, 18 Jun 1902 08:00:00 GMT |
|
 |
Gerald Zinck #13 / 16
|
 where is my main method(like java)??
Of course there is an equivalent of "main" in all Smalltalks. The only difference is, that Smalltalk does not force you to call this method "main". But if you are used to, name it so. For testing (execution inside the development environment) just type something like MyClass myMain. to an editor pane, select it, open the context menu and execute "do-it". This will invoke the (class-) method "myMain" in class "MyClass". If "MyClass" is derived from a Window-Class the implementation of "myMain" could look like: myMain |mainWindow | mainWindow := MyClass new. mainWindow open. For runtime the basic mechanism is, 1.that every ST environment (development or runtime) has a startup-sequence. 2. The only thing you have to do, to enhance/change one of the methods in that sequence and place a call to your "myMain" method there. The documentation of your Smalltalk should tell you where to find a suitable spot in the startup-sequence. 3. When you then create a run-time image (or an exe) it will startup your code automatically. kind regards gerald Quote:
> hello. > i'm an experienced java programmer and at the moment i'm doing my first > steps in smalltalk. > i build an application but i can just let it run via my workpad. > 1) is there something like a main method like in java > 2) how to package the applications to use these as standalone apps. > thank you > marco paga
|
Fri, 29 Oct 2004 23:44:21 GMT |
|
 |
#14 / 16
|
 where is my main method(like java)??
|
Wed, 18 Jun 1902 08:00:00 GMT |
|
 |
Travis Grigg #15 / 16
|
 where is my main method(like java)??
For many of the purposes main() fills, it seems that a workspace is actually the best match. -- Travis Griggs Key Technology 10 2 letter words: "If it is to be it is up to me"
|
Sat, 30 Oct 2004 00:18:58 GMT |
|
|