Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
rakesh86shankar
Posts: 998
Registered: ‎05-22-2009
My Device: Not Specified

Ilegal Access Exception while accessing ClassforName in J2ME Unit library.

Hi,

 

I am trying to j2me unit test case with J2ME unit library,

 

If I  am extending the library application of J2ME Unit,in demo application it is working fine.

 

But if i use it in my application,I am getting Illegal access exception in place where

 

  TestCase testCase =
                    (TestCase)Class.forName(className).newInstance();
                testSuite.addTest(testCase.suite());


in  createTestSuite() of TestConsoleScreen of J2ME unit library.Is this related to package folder,I am not able to figure why it is creating issue in app which happens in device not in simulator.

 

I am trying to run this testcase in simulator via alternate entry point

 

if (args.length == 1 && args[0].equals("TRR")) {
        	// Unit tests
			MyApp myObj = new MyApp (); 
			if (ApplicationManager.getApplicationManager().inStartup()) {
				myObj .addSystemListener(mcrObj);
			} else {
				myObj .doStartupWorkLater();
			}
			myObj .enterEventDispatcher();
        }else{
        	TestRunner theApp =
                     new j2meunit.rimui.TestRunner(new String[] {
                 "com.verizon.mcr.mcrapp.DemoTest"               
             });
             theApp.enterEventDispatcher();
        }

 

 

Thanks

Rakesh

Please use plain text.