MicroStation/J MDL, JMDL, & Java FAQ

Support

<< Return to Index
Subject: MicroStation/J MDL, JMDL, & Java FAQ
Product: MicroStation/J
Operating System: Windows® 95, Windows 98, Windows NT® 4.0
Document Number: 6170

Index:

  1. Will applications need to be recompiled for MicroStation/J?
  2. How do I compile MDL Applications?
  3. What tools are required for compiling MDL applications?
  4. What do I need to compile DLMs and external programs?
  5. What do I need to set to compile applications?
  6. If I want to use my own environment what do I need to set?
  7. What is required to compile MDL applications for MicroStation GeoGraphics, MicroStation TriForma, and MicroStation Modeler?
  8. Does an application need to be modified before it is recompiled?
  9. Can I run applications compiled in MicroStation/J in older versions of MicroStation?
  10. What happened to BMAKEWIN?
  11. How do I compile JMDL Applications?
  12. How do I compile Java applications?
  13. How do I execute JMDL and Java applications?
  14. How do I use the JMDL command line debugger under MicroStation/J?

Question 1: Will applications need to be recompiled for MicroStation/J?

Answer: You should not have to recompile MDL-only applications. However you should recompile any application that requires a DLM or external program that uses "native code".

Question 2: How do I compile MDL Applications?

Answer: Using the MicroStation Development Shell, go to the directory that contains the source code for the application and type BMAKE and the name of the file that ends with the extension .MKE.

Back to Index

Question 3: What tools are required for compiling MDL applications?

Answer: All the required tools for compiling MDL applications are provided with MicroStation/J. During installation, simply select the Programming and Tools option to deliver MDL and JMDL developer tools, documentation, and examples.

Question 4: What do I need to compile DLMs and external programs?

Answer: MicroStation/J uses Microsoft Visual C/C++ 5.0 with service pack 3.

Back to Index

Question 5: What do I need to set to compile applications?

Answer: Although custom environments may vary, if you selected the Programming and Tools option during the MicroStation/J installation, a Command Shell is automatically built to set the minimum environment variables necessary for successful compilation. This Command Shell (mstndevvars.bat) can be selected from the Windows Start Menu. Note that if you do not have the Visual C/C++ compiler installed, you will get a warning message indicating this and to also set the environment for Visual C/C++. If you don't plan on compiling "native code", you can bypass this message.

Question 6: If I want to use my own environment what do I need to set?

Answer: The environment variables needed are:

MS set to the root of MicroStation. (with a trailing backslash)
BMAKE_OPT set to -I%MS%mdl\include (the MicroStation mdl include directory)
MLINK_STDLIB set to %MS%mdl\library\builtin.dlo

Back to Index  

Question 7: What is required to compile MDL applications for MicroStation GeoGraphics, MicroStation TriForma, and MicroStation Modeler?

Answer: Modifications to mstndevvars.bat are required (in the directory \Bentley\Program\MicroStation\jmdl\bin\). You can use Windows Notepad to edit this file.

MicroStation GeoGraphics
No modifications necessary

MicroStation TriForma
Add this line: set TFHOME = %MS%\..\TriForma\
Append the following to the line beginning "set BMAKE_OPT=": -I%TFHOME%mdl\include\

MicroStation Modeler
Add this line: set MSMODELER = %MS%\..\Modeler\
Append the following to the line beginning "set BMAKE_OPT=": -I%MSMODELER%mdl\include\

Question 8: Does an application need to be modified before it is recompiled?

Answer: Yes, the macro for running the MLINK tool has been changed to MlinkCmd from linkCmd and the macro for the resource librarian has been changed to RlibCmd from rscLibCmd. mdllib, rdbmslib, and consutil have been converted from a statically linked library (.ml) to a dynamically linked MDL shared library (.msl). Applications that used to link with mdllib.ml, rdbmslib.ml, or consutil.ml will now have to link with mdllib.dlo, rdbmslib.dlo, or consutil.dlo respectively when they recompile. No impact is introduced for existing applications as they already have the static library included. This will save some disk space and makes it easy when updates to mdllib, rdbmslib, or consutil are made available as the MDL application does not have to be re-compiled. These changes need to be made in the make (.mke) file.

Also, in the change to MicroStation/J, library files have been changed from static to dynamically linked. The following macro definition shows how to implement a portable solution of compiling MDL applications in MicroStation/J and all previous versions.

    %if defined (MLINK_STDLIB)
      # Create a macro for portable library extensions.
      libraryExt = dlo
    %else
      libraryExt = ml
    %endif
  
    Objs = \
      $(o)$(appName).mo \
      $(mdlLibs)mdllib.$(libraryExt)
  

Back to Index

Question 9: Can I run applications compiled in MicroStation/J in older versions of MicroStation?

Answer: MDL applications that are compiled in MicroStation/J will only run in current or subsequent editions. Such applications are not backward compatible with previous major engineering numbered products (for example, MicroStation SE, MicroStation 95, etc.). MicroStation will display a version error message if you do this.

Question 10: What happened to BMAKEWIN?

Answer: This is now BMAKE and is consistent on all platforms.

Back to Index

Question 11: How do I compile JMDL Applications?

Answer: MicroStation/J now includes the MicroStation Development Shell from which you can compile your MDL and JMDL programs. To run the MicroStation Development Shell you first need to make sure that you have properly installed the MDL Development environment when you installed MicroStation/J. To verify if you have installed the MDL Development environment, or to open the MicroStation Development Shell for compiling, click on the Windows Start button > Programs > MicroStation_J > MicroStation Development Shell.

If you now see a DOS window with the title "MicroStation Development Shell" change directories to the location of the source code and compile similar to the following:

C:\Bentley\Program\MicroStation\mdl\examples\myapp>bmake -a myapp.mke

When compiling the JMDL examples, source code filenames must end with an .mjava extension. Type BMAKE -a and the name of the file that ends with the extension .mke. For example, bmake -a yourapp.mke

Below is an example .mke file for JMDL applications:

%include java.mki appName = Jmain sourcePath = $(_MakeFilePath) outPath = $(MSJ)jmdl/ #----------------------------------------------------------------------------------- # Note: When using packages in a .mclass file the package extension # is appended to $(outPath) definition. # # i.e. # - [.mjava source] package examples.dgn # - the class file is output to ../jmdl/examples/dgn # - To run the program in MS keyin: java examples.dgn.[appName] # #----------------------------------------------------------------------------------- #----------------------------------------------------------------------------------- # Compile JMDL programs #----------------------------------------------------------------------------------- $(outPath)$(appName).mclass :$(sourcePath)$(appName).mjava

A compiled JMDL file with an .mclass extension will be generated if the operation is performed successfully. For an alternate method of compiling JMDL applications using the JMDL compiler delivered with MicroStation/J refer to ..\Bentley\Program\MicroStation\jmdl\docs\index.html.

Question 12: How do I compile Java applications?

Answer: Using the MicroStation Development Shell, change directories to the location of the source code. The Java source code must be contained in files whose filenames end with a .java extension. Type BMAKE -a and the name of the file that ends with the extension .mke. For example, bmake -a yourapp.mke

Below is an example .mke file for Java applications:

#---------------------------------------------------------------------------------------- # # $RCSfile: javaexamples.mke,v $ # $Revision: 1.2 $ # $Date: 1998/08/11 16:59:00 $ # # Copyright (c) 1997; Bentley Systems, Inc., 690 Pennsylvania Drive, # Exton PA, 19341-1136, USA. All Rights Reserved. # # Limited permission is hereby granted to reproduce and modify this copyrighted material # provided that the resulting code is used only in conjunction with Bentley Systems # products under the terms of the license agreement provided therein, and that this # notice is retained in its entirety in any such reproduction or modification. # #---------------------------------------------------------------------------------------- %include java.mki appName = HelloWorld outPath = $(_MakeFilePath)../../ sourcePath = $(_MakeFilePath) destPath = $(_MakeFilePath) #---------------------------------------------------------------------------------------- # Compile Java examples #---------------------------------------------------------------------------------------- $(destPath)$(appName).class : $(sourcePath)$(appName).java

A compiled Java file when compiled successfully will produce a file with a .class extension. For alternate methods of compiling Java applications using the JMDL and Java compiler delivered with MicroStation/J refer to ..\Bentley\Program\MicroStation\jmdl\docs\index.html.

Back to Index

Question 13:  How do I execute JMDL and Java applications?

Answer: Applications may be executed from a DOS shell or via the MicroStation/J Key-in Browser. Note: As with any C or Java application, case-sensitivity is an issue. For example,

java examples.dgn.HelloWorld jmdl examples.dgn.HelloWorld

Note: There are some restrictions when executing JMDL applications from a DOS shell. For example, a JMDL application may require that you be in a design file - this application could not be executed from a DOS prompt.

Question 14: How do I use the JMDL command line debugger under MicroStation/J?

Answer: To use the JMDL command line debugger under MicroStation/J, please follow these steps:

Start the MicroStation Developement Shell.

Type SET MSJ_JIT=none

Type SET MS_USECONSOLEROUTINES=1

  1. Compile the class. For example, change to the directory ..\MicroStation\jmdl\examples\dgn package, then type:
  2.   jmdl -g ScanTest.mjava
    

  3. Start MicroStation from the MicroStation Development Shell.
  4. In MicroStation key in:

      java -debug examples.dgn.ScanTest
    

    This will bring up the MicroStation JMDL debugger window.

  5. You may see the message shown below:

      (not compiled for debug)
    

    This means the ScanTest class has not been loaded yet. Use the debugger command LOAD to load the class:

      load examples.dgn.ScanTest
    

  6. At this point you can set a breakpoint and step into code. Try:

      break main
      0
      st
      go
      quit
    

     

If you need to access the JMDL debugger often you could modify mstndevvars.bat located in the ..\MicroStation\jmdl\bin\ directory which is the batch file used to run the MicroStation Development Shell. Add the two lines from steps 2 and 3. For more JMDL debugger command help, please refer to MicroStation/J JMDL Documentation--"JMDL Command Line Debugger."

Back to Index

How useful was this page?
less   more
Suggest new content or let us know how we can improve this content (optional):

<< E-mail this page