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
Posts: 28
Registered: ‎07-16-2008
My Device: Curve 8320
Accepted Solution

System.out.println() + Eclipse + Simulator

I was expecting that System.out.println() would be output to the Blackberry Simulator Output Console but I'm not getting anything in that window.  Is there a trick to getting output there?

 

Thanks in advance,

 

 

Developer
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: System.out.println() + Eclipse + Simulator

Just to clarify: Where do you see this output window?  Do you get to it via (Simulator) Tools -> Show Event Log or is it displayed within Eclipse itself or in the Output tab of the JDWP?  Unless it's the Event Log you should see your sysouts.  Are you using the JDE Plugin for Eclipse or the regular Eclipse?
BlackBerry Development Advisor
Posts: 248
Registered: ‎07-14-2008
My Device: Not Specified

Re: System.out.println() + Eclipse + Simulator

[ Edited ]

You need to attach the simulator in debug mode. To do this simply right click on the project>Debug As>BlackBerry Simulator. This should attach the simulator to the Eclipse JDE plugin and println()s should now show up in Blackberry Simulator Output Console.

 

To connect a device in debug mode, right click on the project>Debug As>BlackBerry Device. This will attach the device to the Eclipse JDE plugin and as above, println()s should show up in Blackberry Simulator Output Console.

Message Edited by shaque on 07-18-2008 12:04 PM
Developer
Posts: 28
Registered: ‎07-16-2008
My Device: Curve 8320

Re: System.out.println() + Eclipse + Simulator

The console I'm looking at is at Window, ShowView, Console.  I have the JDE Plugin for Eclipse. 

 

G. 

Developer
Posts: 28
Registered: ‎07-16-2008
My Device: Curve 8320

Re: System.out.println() + Eclipse + Simulator

She is quite chatty now.  Thanks,

 

New Developer
Posts: 9
Registered: ‎12-02-2008
My Device: Not Specified

Re: System.out.println() + Eclipse + Simulator

Hi there, running the app through the 'Debug As > BlackBerry Simulator' does not seem to work for me.  I am not receiving any output in the BlackBerry Simulator Output Console despite including print statements like the following in my code:

 

System.out.println("This is a print statement");

 

It doesn't seem to matter which version of the component pack I use (4.5 or 4.6).

 

The BlackBerry Builder Console on the other hand is verbose.  The output from my Builder Console and the code is below.  I am able to set breakpoints and examine values in the variables perspective.  And I did find that print statements worked in the BlackBerry JDE, but I would prefer to use eclipse.

 

Does anyone have any ideas?  Thanks in advance!

 

Builder Console Output:

Building HelloWorld at Tue Dec 02 21:21:25 PST 2008.

Executing rapc for the project HelloWorld at Tue Dec 02 21:21:25 PST 2008.
C:\Program Files\eclipse\plugins\net.rim.eide.componentpack4.5.0_4.5.0.14\components\bin\launcher.exe C:\Program Files\eclipse\plugins\net.rim.eide.componentpack4.5.0_4.5.0.14\components\bin\rapc.exe  -quiet import="..\..\..\..\..\Program Files\eclipse\plugins\net.rim.eide.componentpack4.5.0_4.5.0.14\components\lib\net_rim_api.jar" codename=..\HelloWorld\HelloWorld ..\HelloWorld\HelloWorld.rapc warnkey=0x52424200;0x52435200;0x52525400 -sourceroot="C:\Documents and Settings\Owner\Code\BlackBerry\HelloWorld\src" "C:\Documents and Settings\Owner\Code\BlackBerry\HelloWorld\bin"
rapc executed for the project HelloWorld


 

 

Code:

 


import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;


public class HelloWorld extends UiApplication {
    public static void main(String[] args) {
        System.out.println("Entered main method");
        HelloWorld theApp = new HelloWorld();
        theApp.enterEventDispatcher();
    }
    public HelloWorld() {
        pushScreen(new HelloWorldScreen());
    }
    
}

final class HelloWorldScreen extends MainScreen {
    
    public HelloWorldScreen() {
        super();
        
        LabelField title = new LabelField("Helloworld Sample", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH);
        setTitle(title);
        add(new RichTextField("Hello, World!"));
        System.out.println("This is a print statement");
        
        
    }
    
    public boolean onClose() {
        Dialog.alert("Goodbye!");
        System.exit(0);
        return true;
    }
}

 

 

 

BlackBerry Development Advisor
Posts: 14,971
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: System.out.println() + Eclipse + Simulator

The builder output and debug output from the BlackBerry Simulator appear in the same console window.  You can switch between them by clicking on the Console window icon.

 

There is also an issue in the current beta release that prevents the BlackBerry Simulator debug output from appearing if you have changed the Installed Component setting in the BlackBerry Plug-in for Eclipse preferences.  The work around to this is to restart Eclipse.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 9
Registered: ‎12-02-2008
My Device: Not Specified

Re: System.out.println() + Eclipse + Simulator

Thank you.  Restarting Eclipse worked perfectly and I am now recieving output in the console.  I should have tried that.
Contributor
Posts: 25
Registered: ‎04-16-2010
My Device: Not Specified

Re: System.out.println() + Eclipse + Simulator

[ Edited ]

I have the same problem, and I'm starting to be crazy!

 

Projet is new, I just display  a text on ascreen (like the HelloWorldDemo app).

I'm using Eclipse 3.5, with the Blackberry Java Plug-in for Eclipse v1.1 (so not the beta), the projet has been created with Blackberry JDE 4.5.

 

I start the simulator "Debug As > Blackberry Simulator", the debugger is attached and then I see lots of things when the simulator starts. The application starts and my screen displays, but I never see my

System.out.println("test for the console output");

I restarted the simulator, eclipse, everything...

 

Still no trace in the console!

Please help me...

 

Contributor
Posts: 25
Registered: ‎04-16-2010
My Device: Not Specified

Re: System.out.println() + Eclipse + Simulator

Problem solved, it was working the next morning when I started in debug mode the application...