Stuart (29 Sep, 2006 21:27):
Call me naive, but isn't Java supposed to be portable? In other words, write the thing on your Windows machine, make sure it is compatible with earlier versions (1.1.8 for Warp 3) and then release it to run on the OS/2 JVM.
Stuart
Belt06,
Stuart is on the right track! This and the suggestions from Fahrvenugen, Martin and Blonde Guy should encourage you give your plan a try. I was curious myself and decided to run some tests. My setup sounds similar to yours, except I run WinXP and OS/2 Warp 4.5.2 on separate machines on a LAN. Here is my testbed:
*Laptop with Win XP and Java 1.4.2
*Desktop with OS/2 Warp 4.52 and Java 1.1.8, 1.3.1, 1.4.1
*PropertiesTest.java (attached) from "Java How to Program", Third Edition. This program displays a Swing-type screen with buttons, plus it reads and writes to a sequential data file (props.dat).
For Test 1, I compiled on WinXP and copied the .class files and data file to OS/2. Note: I'm using FTP for the transfer. Documentation for Virtual PC 2004 says you can create a shared folder to copy files between the Virtual PCs. Otherwise, you can zip the compiled classes to a diskette for the transfer.
Results: The program ran fine with Java 1.3.1. I could read the props.dat file, add properties and write the file. With Java 1.1.8, it worked until I hit the Store button to save the file. I got this error:
"Can't find class PropertiesTest or something it requires" and noticed that it deleted all the lines in my props.dat file. Keep a copy.
For Test 2, I compiled on WinXP with this parameter "-target 1.1". This will ensure the generated files are compatible with 1.1 VMs. See http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/javac.html
Results: The program ran fine under Java 1.3.1. With Java 1.1.8, the program failed again when I hit the Store button, but this time I got a traceback showing where the code failed. Good thing I kept a copy of props.dat.
Researched the error and found that the "store" method in the Properties class did not exist in Java 1.1.8. The Java 1.1.8 equivalent is "save", but that was deprecated in favor of the store method as of Java 1.2.
For Test 3, I changed table.store to table.save in line 103, compiled again on Win XP, this time adding these parameters: -target 1.1 -deprecation
Results: The Win XP Java 1.4.2 compiler now shows a message -
PropertiesTest.java:103: warning: save(java.io.OutputStream,
java.util.Properties has been deprecated
table.save( output, "Sample Properties" );
However, the compiler produced executable code and I was able to run it successfully on OS/2 with Java 1.1.8, 1.3.1 and 1.4.1.
Hopefully, you are encouraged by this to proceed with your plan. Remember to format your Virtual C: drive as HPFS when you install Warp 3 with FixPak 32, so you can use long file names. Attached is the source, data file and screen print. Let us know how it works.
Good Luck,
Roger