Tutorials

Sections

j3d.org

Making SUN's JDK work with MS Visual J++

By Syrus Mesdahgi

This document provides instruction on making MS J++ to work with Sun's JDK and other extensions such as J3D. Originally it was posted on the java3d-interest list. Permission was gained to reproduce it here.

     Note
    There are a few extra steps that are not necessary but reduce the chances of running into additional difficulties when using J++. The idea is very simple; we want to disable Microsoft's VM and replace it with Sun's jar files. Before I explain the process I should warn you that disabling MS VM could effect other Microsoft applications such as Internet Explorer. I should add that even though I have disabled MS VM on several PC's, I have NOT had any difficulty running Internet Explorer, but the "applets" wont run unless you enable MS VM. Enabling Ms VM is fairly easy, so you can do so when needed (Netscape's VM will still work properly, so these should not concern Netscape users).

 

The Process

1. Search you local Hard Drives for *.tmp and delete them ALL. Note that these are temporary files that your applications generate when needed; therefore, deleting them will NOT cause any harm. (J++ parses new class files into tmp files so that it can use them when generating popup helper menus).

Click on Start Button in your desktop, then go to Run and type RegEdit, and then press Enter. Next, we want to make few changes to your registry.

     Note
    If this sounds too risky to you, you can make a backup of your registry before changing any thing. To do so, when Registry Editor comes up, highlight My Computer. Then click on Registry on the menu bar and then Export Registry File. You can now save a copy anywhere you want.

2. In the left side of registry editor go to:

HKey_Local_Machine
|
+- Software
  |
  +- Microsoft
    |
    +- ClassPath
      |
      + Classes
You now want to delete ALL the keys on the right widow (if there are any), other than the first one that is named (Default). Note that the keys that you are deleting map to the tmp files that we deleted in step 1.

3. now, go to:

HKey_Local_Machine
|
+- Software
  |
  +- Microsoft
    |
    +- Code Store Database
      |
      +- Global Namespace
You want to Rename the folder called "Java Packages" to something like "REM_Java Packages". Note that when you want to re-enable MS VM, you have to Rename this folder back to Java Packages. When you come to rename it back, you will notice that "Java Packages" folder has been automatically generated . You will have to delete it, and then rename "REM_Java Packages" to "Java Packages". When you have a folder selected, you can press F2 to rename it.

4. The last step is to make Sun's classes available to J++. Go to:

HKey_Local_Machine
|
+- Software
  |
  +- Microsoft
    |
    +- Java VM
In the right window, double click on the key named ClassPath. remove everything and replace it by the following setting (note that this should all be one long line so remove the "\"s before use):

C:\jdk1.3\jre\lib\i18n.jar;C:\jdk1.3\jre\lib\jaws.jar;\ C:\jdk1.3\jre\lib\rt.jar;C:\jdk1.3\jre\lib\sunrsasign.jar;\ C:\jdk1.3\jre\lib\ext\j3daudio.jar;C:\jdk1.3\jre\lib\ext\j3dcore.jar;\ C:\jdk1.3\jre\lib\ext\j3dutils.jar;C:\jdk1.3\jre\lib\ext\vecmath.jar;\ C:\jdk1.3\lib\dt.jar;C:\jdk1.3\lib\tools.jar

or

C:\jdk1.2.2\jre\lib\i18n.jar;C:\jdk1.2.2\jre\lib\jaws.jar;\ C:\jdk1.2.2\jre\lib\rt.jar;C:\jdk1.2.2\jre\lib\sunrsasign.jar;\ C:\jdk1.2.2\jre\lib\ext\j3daudio.jar;C:\jdk1.2.2\jre\lib\ext\j3dcore.jar;\ C:\jdk1.2.2\jre\lib\ext\j3dutils.jar;C:\jdk1.2.2\jre\lib\ext\vecmath.jar;\ C:\jdk1.2.2\lib\dt.jar;C:\jdk1.2.2\lib\tools.jar

These are all the JDK 1.3 and J3D jar files. If the version you are running is different, you can search your JDK folder for jar files and put their paths as you see above in the field for classpath. note that JDK 1.1.X, 1.2.X, 1.3.X and J3d 1.1.X, 1.2.X will work with the path above; you only have to change c:\jdk1.3 to the corresponding folder on your pc. If you are using any other extensions of JDK, simply include the path to its jar files in this line.

5. Finally, go to your autoexec.bat and remove the ENTIRE line regarding classpatth. or make it identical to what you put in the registry. you can also search your HDD for instances of java.exe and only keep the one in your MAIN jdk folder. you can rename the rest of them (unless they are in a folder that corresponds to another IDE such as Visual Café). When you go in j++ it should parse all the jar files and then your good to go. To run the app using the "!" button go to Project Properties and select custom on the Launch tab. in the first line only type Java and in the second line only your class file that has Main()