Friday, May 16, 2008

Doing Java on NetBeansIDE & Command Line

NetBeansIDE compiler runs on Windows, Linux, Mac OS X and Solaris. NetBeans IDE is open-source & free (http://www.netbeans.org/index.html). Using the NetBeansIDE compiler for Java is way much easier than typing directories to get to your java folder. Perhaps you are wondering about doing things both ways; one compiling & running through the command line & the other through NetBeansIDE compiler. Well, you may want to do so just to see the difference between the two ways. I did it after a few tries & when I tried to run the HelloWorldApp from NetBeansIDE after compiling the exact same file on the command line Java, the results does not come out as its supposed too with warnings like “at java.lang.ClassLoader.defineClass1(Native Method)” & a few more lines instead of the simple “Hello World!”.

To fix it, you can add or take away the below few lines line from the source code on HelloWorldApp.java file:

/** Creates a new instance of HelloWorldApp */
public HelloWorldApp() {
}


Then build it again & run it! I reckon it’s because the command line Java that compiled it previously may have somehow altered how the NetBeansIDE sees the file. The codes are perfect but the proper result can’t be seen on the NetBeansIDE. It’s just for the heck of it, you know, because I wanted to see which way; NetBeansIDE or Command Line Java is better to use. Sun Microsystems recommend the NetBeansIDE compiler probably because it looks good for you. Lol. No, compiler is versatile & works with C/C++ & Ruby too! I would use NetBeansIDE for Java programming from now onwards but will resort to Java programming on the command line (DOS/CMD) when I want to see the results on; well, a real command line. I really have no idea whether any of my future application or programs made with Java language will be designed to yield results like “Hello World!” on Dos/CMD. *snigger*

2 comments:

Selerines said...

Hi friend... I am from India. Your blog looks pretty cool and nice. I am interested to share my link with you. Are you interested my friend? Please visit my blog frequently and keep in touch there!!!! I hope you will accept my request. If you are interested, then please comment in my blog. Thank you!!!!

a.i. editor said...

Hi, Selerines

How are you?

Thanks for stopping by my blog, Selerines from India. I am glad you like it. I took a look at your blog. I like it! Sure, we will do a link exchange. I placed a comment about it on your Selerines World blog.

My latest images for sale at Shutterstock:

My most popular images for sale at Shutterstock: