Skip to main content

Classpath for interactive tests

2 replies [Last post]
Joined: 2009-02-26

Hi everyone,

I extract here a post from previous thread.

My question is the following, how to specify where JTHarness could find "serverpart" for interactive test when it's not indicate in the classpath ?

When I do not include it in the classpath, JTHarness does not show the interactive windows on the server side (it says, when I start it, that server side class are missing).

This does not occured before, when I used a different interview (today I use J2meDistributedTestSuite but before I used a TestMeInterview (sources are missing...) and it works well as you say under).

I think it links with the .jtt file here is my jtt :

name=JSR Conformity
classpath=$testSuiteRootDir$/classes lib/tck_jt.jar lib/j2mefw_jt.jar lib/server_tests.jar

Something wrong with it ?


PS : Vladimir, this question does not require a rapid response ( ;-) ). I do not want to abuse of your time !


Original Post ( :


> I use two kind of scripts usually to launch harness :
> - from a shell :
> java -cp "./lib/*" com.sun.javatest.tool.Main -testsuite ./ -workDirectory -create -overwrite ./WorkDirectory

It is highly recommended to _not_ include everything in the classpath,
but only a javatest.jar.

So, in your case it would look like:

java -jar lib/javatest.jar -testsuite ./ .....


The reason for such recommendations is that JTHarnes uses its own
classloader to load the testsuite and testsuite related classes
(interview, custom test suite, etc). When the extra classes are in the
system classpath, this might lead to a *very* tricky and subtle bugs
(like some classes loaded by the system classloader and some others by
the JTHarness one), which are not immediately obvious, but still confusing.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-11-16

Hi Brice,

> My question is the following, how to specify where JTHarness could find "serverpart" for interactive test when it's not indicate in the classpath ?

By default, the ME Framework looks into the following configuration entry: "remote.networkAgent".

What's the value in your case (View->Configuration->Show Test Environment, look for remote.networkAgent there)?

Most probably, you have the default one:
-host $passiveHost -port $passivePort -classpath $j2meFwLibDir$/j2mefw_jt.jar$:$testSuiteRootDir$/classes

Which means that ME Framework would look into the main ME FW JAR file: j2mefw_jt.jar, and the classes dir which resides an the top of the test suite root.

So, if you place your server classes into "classes" dir, the will be found. This is the simplest way.

Alternatively, if you'd like to package the server files into JAR files, for example, then you need to override the default "remote.networkAgent" value and provide your own, for example this one:

-host localhost -port $passivePort -classpath $testSuiteRootDir$/lib$/server_tests.jar$:$testSuiteRootDir$/lib$/j2mefw_jt.jar

In this case, the ME Framework won't look into classes dir, but only in server_tests.jar and j2mefw_jt.jar

In order to use this custom value, you need to export that from your interview, and if you don't have your interview (yet), that won't be as easy as the first approach.

But if you do have your own custom interview, just insert something like this into export() method for any question.

(from AdvancedTestSuite sample,

private NullQuestion qBasicParams = new NullQuestion(this, "parameters") {
public Question getNext() {
return getEnvSuccessorQuestion();

public void export(Map map) {
map.put("product", "Advanced Test Suite");
"-host localhost -port $passivePort -classpath"
+ " $testSuiteRootDir$/lib$/server_tests.jar$:$testSuiteRootDir$/lib$/j2mefw_jt.jar");


-- Formatting
Message was edited by: vsizikov

Joined: 2009-02-26

Thank you Vladimir.
That's ok now.