Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run java applications in DOS 6.22?

Tags:

java

c++

c

dos

This question arises from a problem we have here, and we're looking for a way to solve it. We have a really old machine (running DOS 6.22) which needs to communicate with a serial application written in Java. But we have neither found a C/C++ event based rs232 library to implement the program for the DOS machine (yet), nor an already compiled program to do this job. But since we already have a working Java event based rs232 program, we were wondering if it's possible to compile it and make an .exe out of it to install it in the old machine.

That would be an easy way out of the problem if possible, but if it isn't, are there any rs232 libraries to build the program for our old machine? Thanks in advance.

like image 717
Jose Ramirez Avatar asked Nov 14 '12 20:11

Jose Ramirez


1 Answers

Linux gcj is capable of compiling java programs into executable code that runs without a VM. So you can use gcj on a linux machine to crosscompile and create a .EXE for DOS. See http://gcc.gnu.org/java. And for the list of platforms it supports see http://gcc.gnu.org/install/specific.html, DOS would be the 7th item in the list.

That said, I don't think you're java based rs232 library is going to work, even if the rest of the program does work, and you'll have all sorts of other limitations Java will not easily live with, like the famous 640K memory limit, which you'll find in practice closer to 440K on actual systems.

Another complication you'll find with event-based programming is that DOS is single threaded. So you cannot easily use any form of event based programming except cooperative multitasking. This is not hard, but be aware of it.

In DOS you'll essentially be writing a serial device driver to communicate with the serial port, like an operating system driver, setting the registers and initiating data transfers the way a char driver would do it in linux. There is a wikibook on the subject which is quite informative at http://en.wikibooks.org/wiki/Serial_Programming/DOS_Programming.

like image 130
christopher Avatar answered Nov 14 '22 22:11

christopher