NetBeans
About
NetBeans is a useful tool for programming applications which use Tomcat (e.g. JSP based web projects). The maintaining of a NetBeans ebuild seems to get better and better and it's not longer important to install NetBeans from the official bin-file.
Install
If you already have Apache and Tomcat 5.0 or 5.5 installed, then you can just run
emerge netbeans
and jump right ahead to Configuration.
Otherwise, you will need to install Tomcat (and Apache) by following the instructions in Howto Apache2 and Tomcat5. Tomcat 6 is currently the default in the Portage tree, but it is not supported by NetBeans 5.5, so you will need to run something like
emerge '<www-servers/tomcat-6'
to get the proper version. Tomcat (like NetBeans) is a slotted package so you can have both version 5.5 and version 6 installed at the same time. If you are going to use Tomcat 5.5 and NetBeans 5.5, after installing and configuring Tomcat 5.5 you can just run
emerge netbeans
and skip to Configuration.
You may instead want to install NetBeans 6 and Tomcat 6. NetBeans 6 is available in the java-experimental overlay.
Assuming you have Subversion installed: add to make.conf
| File: /etc/make.conf |
PORTDIR_OVERLAY="/usr/portage/local/misc/java-experimental $PORTDIR_OVERLAY" |
and then run
svn co http://overlays.gentoo.org/svn/proj/java/java-experimental/ /usr/portage/local/misc/java-experimental/ emerge --regen
(replacing /usr/portage/local/misc in both instances with whatever path you like, but it's probably best to make it a newly created directory with nothing else in it)
Regenerating the Portage cache will probably take quite a while. After it's done, you will need to unmask your desired version of Netbeans and a bunch of required packages, for example to install Netbeans 6.0:
| File: /etc/portage/package.keywords |
=dev-util/netbeans-6.0 ~* =dev-java/freemarker-2.3.10-r1 ~* dev-java/asm ~* dev-java/hamcrest-core ~* dev-java/httpunit ~* dev-java/junit ~* dev-java/jython ~* dev-java/kxml ~* dev-java/proguard ~* dev-java/sun-jdbc-rowset-bin ~* |
Then you can run
emerge netbeans
Configure
When Tomcat is installed from the ebuild, the standard directory structure gets split up into different places on the Gentoo filesystem. [1] For purposes of configuring Netbeans, two locations are important, with default values as follows:
CATALINA_HOME = /usr/share/tomcat-6 CATALINA_BASE = /var/lib/tomcat-6
The $CATALINA_BASE/conf/server.xml file needs to exist for Netbeans to recognize the server. The ebuild installs Tomcat such that /var/lib/tomcat-6/conf is a symlink to /etc/tomcat-6, where the server.xml file resides. Netbeans should not have a problem following the symlink, but in case it refuses to recognize the server.xml file for unknown reasons, you can try removing the symlink and copying the directory in its place:
rm -i /var/lib/tomcat-6/conf cp -r /etc/tomcat-6 /var/lib/tomcat-6/conf
and if that allows for a successful configuration:
rm -fdr /etc/tomcat-6 ln -s /var/lib/tomcat-6/conf /etc/tomcat-6
To begin configuring Netbeans to work with Tomcat:
- As root, add your username to the tomcat group:
su gpasswd -a username tomcat
- Log out from your regular user account (the one you just added to the tomcat group) and log back in so that the change will take effect.
- Make sure Tomcat is not running, just in case.
- Edit $CATALINA_BASE/conf/tomcat-users.xml to create two users, one for netbeans and one for yourself to act as administrator (the latter is recommended but optional).
| File: tomcat-users.xml |
<tomcat-users> <role rolename="manager"/> <role rolename="admin"/> <user username="netbeans" password="whatever" roles="manager"/> <user username="you" password="yourpassword" roles="manager,admin"/> </tomcat-users> |
- Open up Netbeans, on the "Tools" menu click "Servers" to open the server manager. Alternatively, on the left side of the main view, select the "Runtime" tab (Netbeans 5.5) or the "Services" tab (Netbeans 6), then right-click on "Servers" and select "Add Server".
- Click the "Add Server" button at the bottom left.
- In the list of server types choose "Tomcat 6.0"
- Enter the value of $CATALINA_HOME (probably /usr/share/tomcat-6) in the top text box, then check the checkbox labeled "Use private configuration folder (Catalina Base)" and enter the value of $CATALINA_BASE (probably /var/lib/tomcat-6) in the text box below. Enter the username and password of the Tomcat user you defined for Netbeans (from line 3 of the tomcat-users.xml file fragment above) in the appropriate places.
- Click the "Finish" button; now you can start writing and testing web applications.
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and list their apartments, townhouses and units.
