Wednesday, June 4, 2008
Mysql : NetBeans 6.1 : OpenSolaris 2008.05
I am trying to install "glassfish - mysql bundled netbeans 6.1" on open solaris 05/08. During the installation , I got some Gtk warnings like :
Anyway , during the installation of netbeans I have selected all default locations. thus mysql and glassfish were installed in my home directory.
I have tried to start mysql server with the following configuration :

but , after clicking 'start' I received an error like :
Which means , Mysql server is not running at all. So , I tried to start it manually.
In terminal , I typed "mysqld_safe --user=mysql --log &" which results :
From the result , I think some permission related factor is creating problems. That's why I changed permission of the above said directories as a super user.
Now "bin/mysqld_safe --user=mysql --log &" results :
Thus MySql server is running and doing all desirable functions.
(:1464): Gtk-WARNING **: Attempting to add a widget with type GtkButton to a GtkComboBoxEntry (need an instance of GtkEntry or of a subclass)
(:1464): Gtk-CRITICAL **: file gtkwidget.c: line 3236: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(:1464): Gtk-CRITICAL **: file gtkstyle.c: line 5879: assertion `style->depth == gdk_drawable_get_depth (window)' failed
(:1464): Gtk-CRITICAL **: file gtkstyle.c: line 5879: assertion `style->depth == gdk_drawable_get_depth (window)' failed
Anyway , during the installation of netbeans I have selected all default locations. thus mysql and glassfish were installed in my home directory.
I have tried to start mysql server with the following configuration :
[Click on the image to get larger view]
but , after clicking 'start' I received an error like :
"ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)".
Which means , Mysql server is not running at all. So , I tried to start it manually.
In terminal , I typed "mysqld_safe --user=mysql --log &" which results :
ritwik@ritwik:~$ cd mysql
ritwik@ritwik:~/mysql$ bin/mysqld_safe --user=mysql --log &
[1] 764
ritwik@ritwik:~/mysql$ nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
bin/mysqld_safe[380]: /var/lib/mysql/ritwik.err: cannot create [Permission denied]
bin/mysqld_safe[388]: eval[1]: /var/lib/mysql/ritwik.err: cannot create [Permission denied]
STOPPING server from pid file /var/lib/mysql/ritwik.pid
tee: /var/lib/mysql/ritwik.err: Permission denied
080604 18:26:41 mysqld ended
tee: /var/lib/mysql/ritwik.err: Permission denied
[1]+ Exit 1 bin/mysqld_safe --user=mysql --log
From the result , I think some permission related factor is creating problems. That's why I changed permission of the above said directories as a super user.
Now "bin/mysqld_safe --user=mysql --log &" results :
ritwik@ritwik:~/mysql$ nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /export/home/ritwik/mysql/data
Thus MySql server is running and doing all desirable functions.
Tuesday, June 3, 2008
NetBeans 6.1 on OpenSolaris 2008.05
Open Solaris 05/2008 has an excellent feature of adding packages graphically and netbeans option is also there but I was trying to install it in the same I have done before. Because , NetBeans 6.0.1 will be installed if you execute "pkg install netbeans" or choose netbeans from package manager (IPS GUI) , but I want to install NetBeans 6.1.
During installation , I got some warnings / critical problems regarding Gtk. Those were like :
otherwise everything was fine. "MySql" server was bundled with sxde 9/07 but that's not true for open solaris 05/08. so I decided to download and install MySql server. I downloaded "mysql-5.1.24-rc-solaris10-i386.pkg" and tried to install it in my system. I have used "pkgadd" command as root for installation , but at last the following error results :
and , "/opt/mysql/mysql/bin/mysqld --skip-grant &" results :
I don't know what's the actual reason behind it.... may be the operating system is the reason.. as I was using an installer which is made for solaris 10 and I am using open solaris 05/08.
Anyway , under such circumstances I decided to install the Glassfish - Mysql bundled version of NetBeans IDE 6.1. I did it , got the same "Gtk" error during installation , otherwise everything was normal !!!!
Next : A minor problem while starting MySql server.
If you want to install Mysql in your open solaris 05/08 system , check out "web stack components" from "Open Solaris 05/2008 (part - IV)".
During installation , I got some warnings / critical problems regarding Gtk. Those were like :
(:1464): Gtk-WARNING **: Attempting to add a widget with type GtkButton to a GtkComboBoxEntry (need an instance of GtkEntry or of a subclass)
(:1464): Gtk-CRITICAL **: file gtkwidget.c: line 3236: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
(:1464): Gtk-CRITICAL **: file gtkstyle.c: line 5879: assertion `style->depth == gdk_drawable_get_depth (window)' failed
(:1464): Gtk-CRITICAL **: file gtkstyle.c: line 5879: assertion `style->depth == gdk_drawable_get_depth (window)' failed
otherwise everything was fine. "MySql" server was bundled with sxde 9/07 but that's not true for open solaris 05/08. so I decided to download and install MySql server. I downloaded "mysql-5.1.24-rc-solaris10-i386.pkg" and tried to install it in my system. I have used "pkgadd" command as root for installation , but at last the following error results :
## Executing postinstall script.
ERROR: 1004 Can't create file '/var/tmp/installCgaqqb/#sql2a8_1_0.frm' (errno: 13)
080603 23:51:00 [ERROR] Aborting
080603 23:51:00 [Note] /opt/mysql/mysql/bin/mysqld: Shutdown complete
Installation of system tables failed! Examine the logs in
/var/lib/mysql for more information.
and , "/opt/mysql/mysql/bin/mysqld --skip-grant &" results :
080604 0:05:33 [Warning] Can't create test file /opt/mysql/mysql/data/ritwik.lower-test
080604 0:05:33 [Warning] Can't create test file /opt/mysql/mysql/data/ritwik.lower-test
[1] 720
ritwik@ritwik:~$ 080604 0:05:33 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
[1]+ Exit 1 /opt/mysql/mysql/bin/mysqld --skip-grant
I don't know what's the actual reason behind it.... may be the operating system is the reason.. as I was using an installer which is made for solaris 10 and I am using open solaris 05/08.
Anyway , under such circumstances I decided to install the Glassfish - Mysql bundled version of NetBeans IDE 6.1. I did it , got the same "Gtk" error during installation , otherwise everything was normal !!!!
Next : A minor problem while starting MySql server.
If you want to install Mysql in your open solaris 05/08 system , check out "web stack components" from "Open Solaris 05/2008 (part - IV)".
Friday, May 30, 2008
NetBeans 6.1 : Visual Web JSF Application
Hmmmm , there's something new !! Anyway getting started by New Project --> web --> web application. Give project name and location --> choose server --> select framework : visual web java server faces --> Finish. Here "page1.jsp" is your welcome page , (check out a green triangle before it which means that ! ). edit design / jsp / java code as you need. Here a new feature is added in 6.1 i.e ON DEMAND BINDING. "NetBeans IDE 6.1 features on-demand binding. Where components require Java coding, you must now manually add the binding attribute to components in a Visual Web JSF application. To do so, right-click each component and choose Add Binding Attribute. For more information, see the On-demand Binding Attribute Wiki."
Check out the following docs from NetBeans.org:
Developing a Visual Web JSF Application
Navigating Pages in a Web Application
Using Page Fragments
Converting and Validating Data in Visual Web JSF Applications
Understanding Scope and Managed Beans
Getting Started with Visual Web JSF Application Development
Check out the following docs from NetBeans.org:
Developing a Visual Web JSF Application
Navigating Pages in a Web Application
Using Page Fragments
Converting and Validating Data in Visual Web JSF Applications
Understanding Scope and Managed Beans
Getting Started with Visual Web JSF Application Development
Tuesday, May 27, 2008
NetBeans IDE 6.1 : simple Web application
Now I have started developing web applications using NB 6.1 . Just click New project --> web --> web application. There's nothing new in setting up a new web project , I have followed the same as in 6.0.1 except an option for using a dedicated folder for storing libraries.
You can use a server of your choice : Apache Tomcat / GlassFish V2. Different frameworks are also available , select according to your need and start web programming.
As usual , "index.jsp" file will be created under Project name --> Web Pages --> WEB-INF --> index.jsp.This is your default welcome page of the program.you change the title , edit the body to write your own program. As html tags are used for designing a jsp program , netbeans provides a huge opportunity to write codes graphically. Just look at the Palette ([CTRL]+[SHIFT]+[8]) , you will find almost everything you need. If you put your mouse cursor on a button in the palette , html code will be appeared as tool tip text. simply drag and drop and design your html page."Html Forms" elements are used to take input from user and "HTML" elements are used for designing purpose.
Now write your first "Helloweb" program. Check out Docs and Support from netbeans.org : "Introduction to Developing Web Applications"
You can use a server of your choice : Apache Tomcat / GlassFish V2. Different frameworks are also available , select according to your need and start web programming.
As usual , "index.jsp" file will be created under Project name --> Web Pages --> WEB-INF --> index.jsp.This is your default welcome page of the program.you change the title , edit the body to write your own program. As html tags are used for designing a jsp program , netbeans provides a huge opportunity to write codes graphically. Just look at the Palette ([CTRL]+[SHIFT]+[8]) , you will find almost everything you need. If you put your mouse cursor on a button in the palette , html code will be appeared as tool tip text. simply drag and drop and design your html page."Html Forms" elements are used to take input from user and "HTML" elements are used for designing purpose.
Now write your first "Helloweb" program. Check out Docs and Support from netbeans.org : "Introduction to Developing Web Applications"
Playing more with "ejectDrive"
Now start playing with the same program by using the power of netbeans :
At first , click on the 'Runtime' of the following line
We will use this exec variable later to perform some another job.
When you executing the command "eject cdrom" in a terminal window , (I am using sxde 9/07) you will get something like :
Now if you want to print this line : 'cdrom /dev/dsk/c0t0d0s2 ejected' from your program you need to add the following lines in your code :
Now use netbeans code completion tool to write programs more easily.
Just write "Bu" and press [CTRL]+[SPACE] and you will get a drop down list of all which starts with 'Bu'. Use arrow cursors to find out BufferReader and press [RETURN].
In the same line when you are writing .....new InputStreamReader(exec.getInputStream()) , wait after writing 'exec.'..... and choose 'getInputStream' from the drop down box.
Now check out that 'BufferReader' and 'InputStreamReader' is underlined by red color which means there's an error in the code . you will also find a red bulb beside. Place your mouse cursor on it to get probable cause of the error and click on it to get possible solution. Just click on it and choose 'Add Import for java.io.BufferReader' etc.

So now everything is complete , indent / format using [CTRL]+[ALT]+[F] and save [CTRL]+[S].
Now 'Main.java' should look like :
Run your program to get desirable output.
At first , click on the 'Runtime' of the following line
'Runtime.getRuntime().exec("eject cdrom");'Now , you will get a yellow bulb in the left of the editor , same line position. click on it and it will tell you to "Assign Return Value to Variable". click on this line and
'Runtime.getRuntime().exec("eject cdrom");'will be converted to
'Process exec = Runtime.getRuntime().exec("eject cdrom");'
We will use this exec variable later to perform some another job.
When you executing the command "eject cdrom" in a terminal window , (I am using sxde 9/07) you will get something like :
bash-3.2$ eject cdrom
cdrom /dev/dsk/c0t0d0s2 ejected
Now if you want to print this line : 'cdrom /dev/dsk/c0t0d0s2 ejected' from your program you need to add the following lines in your code :
BufferedReader in = new BufferedReader(new InputStreamReader(exec.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.print(line + "\n");
}
Now use netbeans code completion tool to write programs more easily.
Just write "Bu" and press [CTRL]+[SPACE] and you will get a drop down list of all which starts with 'Bu'. Use arrow cursors to find out BufferReader and press [RETURN].
In the same line when you are writing .....new InputStreamReader(exec.getInputStream()) , wait after writing 'exec.'..... and choose 'getInputStream' from the drop down box.
Now check out that 'BufferReader' and 'InputStreamReader' is underlined by red color which means there's an error in the code . you will also find a red bulb beside. Place your mouse cursor on it to get probable cause of the error and click on it to get possible solution. Just click on it and choose 'Add Import for java.io.BufferReader' etc.
So now everything is complete , indent / format using [CTRL]+[ALT]+[F] and save [CTRL]+[S].
Now 'Main.java' should look like :
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejectdrive;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
*
* @author ritwik
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try {
Process exec = Runtime.getRuntime().exec("eject cdrom");
BufferedReader in = new BufferedReader(new InputStreamReader(exec.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.print(line + "\n");
}
} catch (Exception e) {
System.out.print(e);
}
}
}
Run your program to get desirable output.
Monday, May 26, 2008
NetBeans IDE 6.1 : simple java application
Don't worry , I won't start with "HelloWorld".. rather say "EjectDrive"..yes, my first program in this IDE was to eject my cd/dvd drive.
It's quite simple by using a terminal window. Just execute a command "eject cdrom" , and your drive will be ejected. Now we will simply try to execute the command from a java program :
1. setup a new project. File -> new project -> java -> java application -> next
2. give a project name , say ejectDrive.
here I have noticed that NB 6.1 provides an opportunity to use a dedicated folder for storing libraries . I will discuss later how it's beneficial to make tasks more simple.

'create main class' & 'set as main project' will be checked automatically , just click 'finish'.
3. Main.java will be opened in the editor window. Here just add the following code under the main method :
Now , your Main.java should look like this :
4. Right click -> format or [ALT]+[SHIFT]+[F] to maintain proper indentation.
5. save. [CTRL]+[S]
6. Run. [F6]
and your cddrive will be ejected.
Next : Playing more with "eject drive"
It's quite simple by using a terminal window. Just execute a command "eject cdrom" , and your drive will be ejected. Now we will simply try to execute the command from a java program :
1. setup a new project. File -> new project -> java -> java application -> next
2. give a project name , say ejectDrive.
here I have noticed that NB 6.1 provides an opportunity to use a dedicated folder for storing libraries . I will discuss later how it's beneficial to make tasks more simple.
'create main class' & 'set as main project' will be checked automatically , just click 'finish'.
3. Main.java will be opened in the editor window. Here just add the following code under the main method :
try {
Runtime.getRuntime().exec("eject cdrom");
} catch (Exception e) {
System.out.print(e);
}
Now , your Main.java should look like this :
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejectdrive;
/**
*
* @author ritwik
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try {
Runtime.getRuntime().exec("eject cdrom");
} catch (Exception e) {
System.out.print(e);
}
}
}
4. Right click -> format or [ALT]+[SHIFT]+[F] to maintain proper indentation.
5. save. [CTRL]+[S]
6. Run. [F6]
and your cddrive will be ejected.
Next : Playing more with "eject drive"
NetBeans IDE 6.1
Netbeans IDE 6.1 has been released. For the past few months netbeans has been developed quite rapidly.. I was using version 6.0.1 before using the latest 6.1 version.
There's nothing new in installation process , except it's quite faster in comparison with previous releases. I have installed it in my solaris (solaris express developer edition 9/07) and linux (fedora 7) system.
Click here to check out downloading and installation instructions.
Are you trying to install NB 6.1 in open solaris 05/08 ??? check out my experience.
Anyway , few things I have noticed just after the installation process :
* startup services : This IDE evolves a quick indexing of all necessary files from jdk installation directory , directories created under user's home etc. , performs a scanning task and compiles all source files from the open projects.
** Adds nb projects : All projects from "NetBeansProject" folder will be automatically added in this IDE as well as other NetBeans projects which resides in the same directory where netbeans is installed. If you have older versions installed in your system , nb settings can be imported in the latest version (just like previous releases).
*** Update notification : A popup message at the right hand corner will show you how many updates are currently available , apply them to make it up to date.

Click here to check out the features of Netbeans 6.1.
Next : Check out what's new in NetBeans 6.1..
Java application
Web application
There's nothing new in installation process , except it's quite faster in comparison with previous releases. I have installed it in my solaris (solaris express developer edition 9/07) and linux (fedora 7) system.
Are you trying to install NB 6.1 in open solaris 05/08 ??? check out my experience.
Anyway , few things I have noticed just after the installation process :
* startup services : This IDE evolves a quick indexing of all necessary files from jdk installation directory , directories created under user's home etc. , performs a scanning task and compiles all source files from the open projects.
*** Update notification : A popup message at the right hand corner will show you how many updates are currently available , apply them to make it up to date.
Click here to check out the features of Netbeans 6.1.
Next : Check out what's new in NetBeans 6.1..
Java application
Web application
Subscribe to:
Posts (Atom)
