Annotation of wikisrc/tutorials/how_to_run_netbeans_ide_on_netbsd.mdwn, revision 1.3

1.2       schmonz     1: **Contents**
                      2: 
                      3: [[!toc levels=2]]
                      4: 
                      5: #  Introduction
                      6: 
                      7: Netbeans, along with Eclipse, is one of the most widely used Java IDE (Integrated Development Environment), also capable of Ruby and C/C++ development. The purpose of this document is to describe the steps needed to run Netbeans 6.0 on a NetBSD system, using Linux Java Virtual Machine and Linux compatibility mode. 
                      8: 
                      9: #  Downloading Netbeans
                     10: 
                     11: The latest version of Netbeans may be downloaded from [here](http://www.netbeans.info/downloads/index.php). We will be using version 6. After having downloaded file _netbeans-6.0.zip_, we compare the SHA256 sums to ensure data integrity: 
                     12:     
                     13: 
                     14: $ digest sha256 netbeans-6.0.zip                                                                                   
                     15:     SHA256 (netbeans-6.0.zip) = fc80d6fd507c5bcc647db564fc99518542b9122d7ea6fcf90abb08156a26d549
                     16:     
                     17: 
                     18: **XXX: This is from the NetBeans DVD, check if the downloadable version is the same.**
                     19: 
                     20: which is equal to the one mentioned in the download page. 
                     21: 
                     22: Next we extract the compressed archive: 
                     23:     
                     24:     $ unzip netbeans-6.0.zip
                     25:     inflating (...)
                     26:     $ ls -ld netbeans
                     27:     drwxr-xr-x  11 user  users  1024 Dec 23 16:55 netbeans/
                     28:     
                     29: 
                     30: #  Verifying Linux compatibility mode
                     31: 
                     32: ##  Kernel support
                     33: 
                     34: Since we are going to install a Linux binary JVM, we must also enable Linux compatibility mode in our system. If you are using a [GENERIC kernel](http://netbsd.org/Documentation/kernel/#generic_kernel), you are already done since the Linux compatibility layer is enabled by default. If not, you will need to compile your kernel with the following options: 
                     35:     
                     36: options         COMPAT_LINUX
                     37:     
                     38: 
                     39: In case you are unfamiliar with the process of building a custom kernel, please refer to [NetBSD Documentation](http://www.netbsd.org/guide/en/chap-kernel.html). 
                     40: 
                     41: A quick way to check whether you are ok as far as kernel support is concerned, is to invoke the following command: 
                     42:     
                     43:     $ config -x | grep COMPAT_LINUX
                     44:     options         COMPAT_LINUX    # binary compatibility with Linux
                     45:     
                     46: 
                     47: (Configuration data will be available if the given kernel was compiled with either INCLUDE_CONFIG_FILE or INCLUDE_JUST_CONFIG options.) 
                     48: 
                     49: Alternatively you can search across the [Sysctl](http://en.wikipedia.org/wiki/Sysctl) tree: 
                     50: 
                     51: $ sysctl -a | grep emul
                     52:     emul.linux.kern.ostype = Linux
                     53:     emul.linux.kern.osrelease = 2.4.18
                     54:     emul.linux.kern.osversion = #0 Wed Feb 20 20:00:02 CET 2002
                     55:     
                     56: 
                     57: Note that the NetBSD documentation covers extensively this [topic](http://www.netbsd.org/guide/en/chap-linux.html), so if you run into trouble, please consult the respective pages. 
                     58: 
                     59: ##  Linux shared libraries
                     60: 
                     61: Most of the times, applications are linked against shared libraries, and for Linux applications, Linux shared libraries are needed. You could get the shared libraries from any Linux distribution theoretically, as long as they are not too outdated, but the suggested method is to use the pkgsrc system. 
                     62: 
                     63: This package supports running [ELF binaries](http://en.wikipedia.org/wiki/Executable_and_Linkable_Format) linked with glibc2 which don't require X11 shared libraries. 
                     64:     
                     65: # cd /usr/pkgsrc/emulators/suse100_base/
                     66:     # make install clean
                     67:     
                     68: 
                     69: This package contains some old shared libraries required for backwards compatibility. 
                     70:     
                     71:     # cd /usr/pkgsrc/emulators/suse100_compat/
                     72:     # make install clean
                     73:     
                     74: 
                     75: This package supports running ELF binaries linked with glibc2 which require X11 shared libraries. 
                     76:     
                     77:     # cd /usr/pkgsrc/emulators/suse100_x11/
                     78:     # make install clean
                     79:     
                     80: 
                     81: #  Installing Sun's JDK
                     82: 
                     83: NetBeans IDE 6.0 requires a Java SE JDK, version 5 or 6. lang/jdk6 unfrotunately fails to run NetBeans with segmentation fault errors, so we will use lang/jdk15. 
                     84: 
                     85: Next we modify the make configuration file `/etc/mk.conf` and add `ACCEPTABLE_LICENSES+=jdk13-license`, to accept the jdk license. You can do that with the following command: 
                     86:     
                     87:     # echo "ACCEPTABLE_LICENSES+=jdk13-license" >> /etc/mk.conf
                     88:     
                     89: 
                     90: We will manually download the Linux self-extracting jdk file `jdk-1_5_0_12-linux-i586.bin` from [here](http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=jdk-1.5.0_12-oth-JPR&SiteId=JSC&TransactionId=noreg), and put it in `/usr/pkgsrc/distfiles`. But since jdk15 depends on jre15, we have to download the Linux self-extracting jre file `jre-1_5_0_11-linux-i586.bin` from [here](http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=22&PartDetailId=jre-1.5.0_12-oth-JPR&SiteId=JSC&TransactionId=noreg) and put it in `/usr/pkgsrc/distfiles` aswell. 
                     91:     
                     92: $ ls -l *.bin
                     93:     -rwxr-xr-x  1 user  wheel  49622107 Dec 23 15:44 jdk-1_5_0_12-linux-i586.bin*
                     94:     -rwxr-xr-x  1 user  wheel  17138633 Dec 23 15:18 jre-1_5_0_12-linux-i586.bin*
                     95:     
                     96: 
                     97: Now we are ready to install jdk: 
                     98:     
                     99:     # cd /usr/pkgsrc/lang/sun-jdk15/
                    100:     # make install clean
                    101:     
                    102: 
                    103: ##  /proc filesystem
                    104: 
                    105: Some Linux programs like Netbeans rely on a Linux-like /proc filesystem. The NetBSD procfs filesystem can emulate a /proc filesystem that contains Linux-specific pseudo-files. We now manually mount the proc file system. 
                    106:     
                    107:     # mount_procfs -o linux procfs /usr/pkg/emul/linux/proc
                    108:     
                    109: 
                    110: and verify it with: 
                    111:     
                    112:     # mount
                    113:     /dev/wd0g on / type lfs (local)
                    114:     ptyfs on /dev/pts type ptyfs (local)
                    115:     tmpfs on /tmp type tmpfs (local)
                    116:     procfs on /usr/pkg/emul/linux/proc type procfs (local)
                    117:     
                    118: 
                    119: You may have NetBSD mounted it automatically during the booting process, by modifying the /etc/fstab file by adding the following line: 
                    120:     
                    121:     procfs /usr/pkg/emul/linux/proc procfs rw,linux
                    122:     
                    123: 
                    124: Please be careful with your `/etc/fstab`. Wrong entries may lead to an unbootable system. 
                    125: 
                    126: ##  Data segment size
                    127: 
                    128: In `usr/pkgsrc/lang/sun-jdk15/MESSAGE.NetBSD` it is stated that "The maximum data segment size assigned to your user must be at least 262144". It is known, that this value isn't enough. Thus enter: 
                    129:     
                    130:     $ ulimit -d 400000
                    131:     
                    132: 
                    133: You may want to put this into your `.profile`
                    134: 
                    135: In case you encounter runtime errors of the following form: 
                    136:     
                    137:     [stathis@netbsd ~] ./netbeans/bin/netbeans --jdkhome /usr/pkg/java/sun-1.5
                    138:     Error occurred during initialization of VM
                    139:     Could not reserve enough space for object heap
                    140:     Could not create the Java virtual machine.
                    141:     [stathis@netbsd ~]
                    142:     
                    143: 
                    144: try increasing the data segment size. 
                    145: 
                    146: #  Running Netbeans
                    147: 
                    148: You may now run Netbeans, by typing: 
                    149:     
                    150:     [stathis@netbsd ~] ./netbeans/bin/netbeans --jdkhome /usr/pkg/java/sun-1.5
                    151:     
                    152: 
                    153: Note that you can edit `netbeans/etc/netbeans.conf` and add the following line: 
                    154:     
                    155:     netbeans_jdkhome="/usr/pkg/java/sun-1.5"
                    156:     
                    157: 
                    158: so you won't have to explicitly set the location of J2SE JDK everytime you run Netbeans. 
                    159: 

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb