JAR files and Compuware DevPartner products



My application is packaged in a .jar archive and I can't work out how I can run it through your tools.


The short answer is to use the nmjava.exe utility provided with TrueTime.  (It's in the PCShared directory of our installation).  If you normally run your program with:

java -cp C:\builds\orion.jar orion.Main

Instead start it with

"C:\Program Files


mjava" -cp C:\builds\orion.jar orion.Main

(nmjava will search your path for the proper java.exe to run, so make sure your path environment variable is properly set up.  In particular, if you have Java 1.3 installed, take note that the setup will install the JRE 1.3 java.exe in your WINNT\System32 directory.  Our tools will not integrate with the 1.3 JRE at all, you need to use the 1.3 JDK java.exe and specify the -classic command line option to disable the hotspot JIT)

If you want to do this through the TrueTime IDE, please read on:

A .jar file should be treated, in terms of your classpath, as just another directory.  For this to work, you need to add the jar file itself into the classpath control.

It will not work if you select the directory that the .jar file is contained in, however, this may be necessary (depending upon the precise product and version you are using) in order to simply get another entry into the UI.  Once that is done, however, you will be able to manually type in the name of the jar file.

It is also possible that you are trying to open a new TrueTime project by selecting a .jar file the same way you would select a .class file.  Unfortunately, this cannot be done in TrueTime 1.22.  There are two workarounds for this:

1. Extract the main class of your .jar to a file and use it to kick off the project.  Once you've started the project file (.nmp), there isn't any need to keep that .class, you can even edit the .nmp to point to the .jar file, if you want.

2. Create a .nmp file from scratch (or copy one from a different project), and modify the settings in order to start the other project.

The key point to remember is that a .nmp project file is just a text file containing the settings for a project.  It looks like a normal .ini file, actually.  When you create a 'project', all you're doing is creating one of these files.  It turns out that the only reason the extension or format of the file matters is for determining the default settings.  That is, for a .htm file, it knows to specify appletviewer.  For a .class file, it knows to specify java.exe (or jview.exe, depending upon your default).  Prior to release 2 of TrueTime, we did not have logic to automatically select a JVM if you attempted to create a project file based on a .jar.

Please email tech support (Nashua.Support@Compuware.com) if you continue having trouble.

Old KB# 12040
Comment List
Related Discussions