The program should open firefox with the url : http://www.gmail.com and it should automatically populate the user id and password and should log in. We can provide the user id and password in a text file.
--display=DISPLAY X display to use
--sync Make X calls synchronous
--no-xshm Don't use X shared memory extension
--g-fatal-warnings Make all warnings fatal
-height <value> Set height of startup window to <value>.
-h or -help Print this message.
-width <value> Set width of startup window to <value>.
-v or -version Print Firefox version.
-P <profile> Start with <profile>.
-ProfileManager Start with ProfileManager.
-no-remote Open new instance, not a new window in running instance.
-UILocale <locale> Start with <locale> resources as UI Locale.
-safe-mode Disables extensions and themes for this session.
-jsconsole Open the Error console.
If the site you are trying to open supports parameters via HTML GET, you can build the URL with them (eg. http://www.gmail.com?user=somename&password=somepassword). However, I don't thing that GMail supports such a thing (especially sending the password in the URL). But the user can switch on a "remember me" option in GMail so that whenever the site is opened, the user logged in automatically. This is done by Firefox and cookies, so no effort on Java side (but the user will have to log in manually for the first time and enable the "remember me" function).
You might consider looking into using Selenium. Selenium is made for this kind of thing (web testing), and has a Java API (along with a number of other languages). It is also widely used. You can check it out here.