开发者

System.out.println does not print on netbeans console

开发者 https://www.devze.com 2023-04-03 09:42 出处:网络
开发者_JAVA百科I have used Netbeans 7.0 for developing Blackberry application with LWUIT framework. And I\'m using Blackberry SDK 4.7. I print a string by using System.out.println(...); in my applicat
开发者_JAVA百科

I have used Netbeans 7.0 for developing Blackberry application with LWUIT framework. And I'm using Blackberry SDK 4.7. I print a string by using System.out.println(...); in my application in many places. But the string values aren't printed on the netbeans console.

What is the issue? How to resolve this issue?


I don't use Netbeans, but in Eclipse console printing only works if you start debugging your project (Debug as > Blackberry Simulator), and it doesn't work while running (Run as > Blackberry Simulator) your project. i.e. if the debugger is not attached with the simulator then System.out.println(...) doesn't work.


I have just used this in a Java Console App in netbeans 7.2

first the import statement:

  import static java.lang.System.out;

Later when you want to write some output use:

 out.println;


In NetBeans 7.2 Try "cleaning the project" (hammer/broom icon)


Netbeans is fine dont worry.. All you need to do is make sure you build your source code properly by clicking the build button! That will show you all your errors. At the top, make sure you add

package "your-project-name";


public class your-project-name {

public static void main(String[] args) {
    System.out.println("Hello World");
    }

}


You must go to File -> Run File, perhaps you have another main didn't you notice which is empty and with 'Run' you run that. Then 'Run File' you specify you want this main instead of another that is pregenerate and is empty.

Viktor


In netbeans I use.... Windows>Output>ADB Log and u can see log i set also Log.i("your custom tag","your custom message"); instead of System.out.println("your message")

Hope this helps

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号