Skip to main content

Is there any README.txt for the very beginners?

6 replies [Last post]
Joined: 2008-01-24

Guys, here I have no much idea what I am actually missing to get something very basic. Before I start hacking all the .java sources, maybe somebody can explain why does this happens and how to begin with this:

$ zipinfo /tmp/SquawkHello.jar
Archive: /tmp/SquawkHello.jar 1454 bytes 4 files
drwxr-xr-x 2.0 unx 0 bx stor 10-Jan-09 14:56 META-INF/
-rw-r--r-- 2.0 unx 199 b- stor 10-Jan-09 14:56 META-INF/MANIFEST.MF
drwxr-xr-x 2.0 unx 0 b- stor 10-Jan-09 14:56 squawkhello/
-rw-r--r-- 2.0 unx 795 b- stor 10-Jan-09 14:56 squawkhello/Main.class
4 files, 994 bytes uncompressed, 994 bytes compressed: 0.0%

$ java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

$ java -jar /tmp/SquawkHello.jar
Hi, dude!

$ java -cp /tmp/SquawkHello.jar squawkhello.Main
Hi, dude!

$ ./squawk -cp:/tmp/SquawkHello.jar squawkhello.Main
No such class squawkhello.Main: java.lang.ClassNotFoundException: squawkhello.Main

Hits - Class:91.37% Monitor:76.96% Exit:100.00% New:94.20%
GCs: 0 full, 0 partial
** VM stopped: exit code = 999 **

OK, jars probably broken, change dir to sources and make it that simple:

$ javac
$ java Main
Hi, dude!

$ ./squawk Main
No such class Main: java.lang.ClassNotFoundException: Main [The current isolate has no class path]

Hits - Class:90.93% Monitor:76.12% Exit:100.00% New:94.40%
GCs: 0 full, 0 partial
** VM stopped: exit code = 999 **

Does that mean for Squawk does not work at all and can not even run very simple hello world? If it can, is there very very simple step-by-step instruction of very few sentences how to build own hello world and run it with Squawk?

I can not find any...

Thanks for taking your time reading this.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-07-15

Squawk does not support loading of classes from a classpath. You need to translate a set of classes/jar into a suite.

We have a couple of ways of getting a hello world project up and going, however we have not made it as simple as it should be yet. We really do need to spend time doing this.

Let me pull some stuff together and give you a starting point. One thing that would help for this particular case would be, are you using an IDE? Are you using a Java ME/UEI aware IDE?

Joined: 2008-01-24

[i]> Squawk does not support loading of classes from a classpath.[/i]

$ ./squawk -h

Usage: squawk [-options] class [args...] | [-MIDlet-x]

if there is no class specified, then try MIDlet-1 property to find a MIDlet
where options include:[b]
paths where classes, suites and sources can be found[/b]
-suite: suite name (without ".suite") to load
host path to look for suite's in

So maybe it is much better to just throw away this from help message then? :-)

[i]> You need to translate a set of classes/jar into a suite.[/i]

What is suite and how to do that?

[i]> Let me pull some stuff together and give you a starting point. One thing that would help for this particular case would be, are you using an IDE? Are you using a Java ME/UEI aware IDE?[/i]

Truly appreciate that! IDE: NetBeans 6.5, of course! What else good-and-opensource exists?.. :-)

Message was edited by: shourisha

Message was edited by: shourisha

Joined: 2004-07-15

You are indeed correct, the -cp option MUST be removed, apologies for that. This comes from the days, not too long ago, where Squawk could dynamically load classes. I was the one who made the decision to remove that flexibility. For us its a size and semantic issue that I think gives us more freedom, even though we lose some.

A suite is a pre-compiled form of a jar. When you do a fresh build of squawk, you will see a squawk.suite file. This is what we call the bootstrap suite and contains the core code of the Squawk system, all of the java.lang.* classes, and the com.sun.squawk.* classes.

Ok, if you have the mobility module installed, then you can do the following
d uei

And then go to the NetBeans add platform dialog and point it to the /uei/build directory . This will allow you to write an app inside NetBeans and then run it within Squawk.

Joined: 2008-01-24

Eric, I really appreciate your answer!

Thank you for explanation what suite is and I think it is definitely better idea than use plain jars. But I still am puzzled then what those squawk_classes.jar and squawk.jar are doing in my Squawk directory? Are you saying they are completely useless? :-) Then they shall be removed as well, I think... No?

Although, if somebody (you?) would write truly simple doc README.txt-like of one-two paragraphs somewhere in Wiki like how to build a simple Hello World, compile it to suite and run in squawk within a simple command line, please? It is what this project is definitely missing big time, I think. Who knows how to use this thing, if it appeared that help even does not reflects the reality? This would really make a start-up point to lot of geeks, who (like me) is looking is it really worth to invest a time in hacking this project or simply look for something else... See, it currently it is a complete black box than nobody on the Earth know how to deal with it, unless you read entire source code. :-(

Also I would like to know, if you would not mind to answer: can I strip everything away, include these shell scripts like and other stuff, but leave only what I really-really need to run my stuff? For example, if somebody would like to use Squawk for like embedded Java VM into an application on a system, where there is no Java installed? Is it possible? Looks like it is and should be, but what is mandatory and what can be thrown? Can I use plain squawk binary + very required classpath + my own app?

Currently I want to use Squawk as a standalone embedded VM (for just experiments) on a regular servers or regular desktops (no mobility or embedded systems yet).

Thank you very much.

Joined: 2004-07-15

We will put up a doc as soon as we can. At the moment I am behind on a number of projects, one of which I need to get going before the end of the day tomorrow.

As for what can be stripped away? EVERYTHING but the "squawk.exe", "squawk.suite". Take these two pieces away and you have a running Java application.

Try this after you've built squawk
squawk com.sun.squawk.Test

This will run a simple set of tests from a class we have.

Here is an easy answer on how to do hello world for you for NOW. Add a new package, or use an existing one, inside the cldc module of Squawk. Then build squawk and invoke squawk with the class you built up.

I am not sure you realize this, but Squawk is the VM that is used on Project Sun SPOT, see, which is an embedded device.

The source in this tree can be classified into the following
- Java VM
- Java library
- Squawk tools

Which is why most of it can be removed.

Have you tried to read the information found at
There should be some links to papers we've published, check out the VEE one.

Although for some unknown reason, seems down, which is not a good thing :(

Joined: 2006-09-08

In the "Meeting the Letter of the Request If Not the Intent" Department...

We've just added a "tests" directory that contains simple tests and two (2!) versions of Hello World. One as a MIDlet and one as a traditional class with a "main" method.

It also contains a file called "README.txt". So there you go.

It isn't a warm, hand-holding introduction to building applications with Squawk. Its more like text message as written by someone paying by the character :-)

It should provide enough clues to get started though. Feel free to comment here with questions or post further information on the wiki.