BLOG about IBM Rhapsody. Contains technical information as well as more private travel stories.

Month: January 2019

Training in Bochum: Rhapsody in Java

Introduction

I have been to Bochum before but I normally don’t use Rhapsody in Java… So still a “first”. I can program Java, however! Not as good as C but I’ll manage.

And I have to say… I like RiJ! It is really, really easy to use. Rhapsody brings its own Java so there is no need to install anything! Itjust works.

It’s a long time ago that I gave a training where all students had their “Hello World” running in minutes.

The Framework is, of course, much simpler, Java already brings everything you need to run UML generated code.

The only thing the Framework needs to do is to proces the events and the timers.

Issues

There were not many issues with getting stuff to work. The most important thing was an issue when you installed Rhapsody and selected the wrong java Directory. But this is easy to repair.
in your Rhapsody Share directory there is an “etc” directory. In that directory you will find two batch files: jdkmake.bat and jdkrun.bat. These files have paths in them that need to point to the JDK that Rhapsody delivers by standard.

jdkrun_bat

 

jdkmake_bat

Hello World Example

The first program you make in any new language is “Hello world”. So we will creata a Java Hello world.
Open Rhapsody in Java and create a new project. Call it “HelloWorld” and create it in a directory where you can find it back. (Rhapsody wants to create projects in the Rhapsody data directory by default.
When the project is created you will see an empty Object Model Diagram. Draw a Class (either select the Class from the drawing menu or right click in the diagram and select “Class”. Then draw the class. Cal it “Hello” and give it a constructor, do not give it parameters.
In the constructor write ( in the Tab “Implementation” ) the following:

System.out.println”Hello World”);

Apply the change. Then we need an Object, right click on the Class “Hello” in the Rhapsody Model Browser and select “Make an Object”.
Then press “GMR” (Generate Make Run) and presto: it works!

Happy Modeling with Rhapsody!

Walter vand er Heiden (wvdheiden@willert.de)

 

2019

Introduction

First of all: All a Happy New Year! OK, OK… the year is already 2 weeks old… Dorry… not much time to write earlier. Anyways… please let 2019 be a year full of modeling. There will be lots of exciting things this year, new versions of tools, new versions of standards and, as usual, a lot of work. Unfortunately there will also be a lot of old stuff this year where we are still fighting with. Let me take you on a trip to memory lane.

Paths

It is 2019…. and still we are fighting with path- and filenames containing spaces and slash and or backslash.
I cannot prove what my assumption is, but I think I’m not far off the truth.

The first DOS (MS-DOS) Version did not contain directories. It was all a flat file system where there was room for a maximum of 128 files in the “root”. Since there were only floppy-disks with 360kB disk space this was not a big problem.

In the same time (Start of the 1980’s) there were other systems, one of them was CP/M. They already had directories, although very primitive. You had 26 directories (You can guess…. ‘A’-‘Z’…)

You already had UNIX at that time which was far more advanced then MS-DOS or CP/M, that had real directories. The Bell Lab guys had thought of that. You could type in paths with a ‘/’ (slash) as separator character.

I think that Bill Gates and his staff just stole the concept from Unix without really understanding the true meaning and working (As they would repeat many many times after that) and exchanged the ‘/’ with ‘\’. So no-one would notice that it was stolen (duh…) and not grasping the concept of the ‘\’ (escape character)

Spaces

Since the MS-DOS file system was an early version of FAT, the filenames were limited to 8.3, 8 characters for the filenames, 3 for the extension. Many versions later Microsoft introduced the concept of long filenames. They were “hacked” into the file system, there was a flag indicating that there was a long filename. The short filename was built up from the long name, removing characters and adding a ‘~’. So we jokingly said that the name of the company should have been changed to “Micros~1”

Nowadays most modern tools can handle decent filenames up to 256 characters and long paths. But Windows would not be Windows if it did not have a couple of unpleasant surprises. For compatibility, a lot of old (partly ancient) API calls are still part of Windows and will still work. So some older tools have “side-effects” that show up when you least expect it.

What does this have to do with Rhapsody? Well.. also Rhapsody is sometimes (indirectly) influenced by old Microsoft behavior. If you want to create a path while creating a new project you will notice that Rhapsody cannot create a directory for you directly in the root of your drive… The error message is cryptic ( “No rights to write” or something similar ) so it takes a while to figure that out. Is basically the problem with using the old (but still present) Windows API calls.

Other issues

Further, Rhapsody is mostly not the only tool involved in the development, (certainly not for Willert Customers, I will make sure they use code generation! ) mostly there are other tools. Often called via command line. And this is where the “Microsoft Moments” come up. (A Microsoft Moment: the moment you realize the world can be saved by destroying Redmond WA)
Because the command line has issues, depending on what version. We have searched and searched for inexplicable errors multiple times just to find out that on one machine Windows would not accept the “/” in a path or a space.
Let me not shout too much at Microsoft. The days of “If Microsoft ever makes something that doesn’t suck it will be a vacuum cleaner ” are behind us. Their hardware has actually always been good. And they improved a lot lately. This opposed to Apple who are definitely loosing it with every new OS version.

2019

The first weeks have been quite but 2019 already promises a lot of trips for your traveling modeler. I will be blogging! Happy modeling with Rhapsody!

Walter van der Heiden (wvdheiden@willert.de)

© 2025 Rhapsody TechBlog

Theme by Anders NorenUp ↑