Search:  
Gentoo Wiki

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.

Note: According to http://bugs.gentoo.org/show_bug.cgi?id=201098 the NetBeans 6 ebuilds are being groomed for inclusion in the official Portage tree, but there is no telling how long that will actually take.

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)

Warning: As the name suggests, this is an experimental overlay, so if strange things happen while installing packages from it, consider yourself warned!

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

Note: The following instructions are mostly written for Tomcat 6 and Netbeans 6, but the configuration procedure for Tomcat 5.5 and Netbeans 5.5 should be much the same. Replace version numbers as appropriate.

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:

 su
 gpasswd -a username tomcat
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>
Note: There is a checkbox labeled "Create user if it does not exist" but that may or may not work; it's probably better to just create the user yourself ahead of time as described above.
Retrieved from "http://www.gentoo-wiki.info/NetBeans"

Last modified: Fri, 05 Sep 2008 22:36:00 +0000 Hits: 9,271