3: [[!toc levels=2]]
5: # Introduction
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.
9: # Downloading Netbeans
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:
14: $ digest sha256 netbeans-6.0.zip
15: SHA256 (netbeans-6.0.zip) = fc80d6fd507c5bcc647db564fc99518542b9122d7ea6fcf90abb08156a26d549
18: **XXX: This is from the NetBeans DVD, check if the downloadable version is the same.**
20: which is equal to the one mentioned in the download page.
22: Next we extract the compressed archive:
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/
30: # Verifying Linux compatibility mode
32: ## Kernel support
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:
36: options COMPAT_LINUX
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).
41: A quick way to check whether you are ok as far as kernel support is concerned, is to invoke the following command:
43: $ config -x | grep COMPAT_LINUX
44: options COMPAT_LINUX # binary compatibility with Linux
47: (Configuration data will be available if the given kernel was compiled with either INCLUDE_CONFIG_FILE or INCLUDE_JUST_CONFIG options.)
49: Alternatively you can search across the [Sysctl](http://en.wikipedia.org/wiki/Sysctl) tree:
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
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.
59: ## Linux shared libraries
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.
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.
65: # cd /usr/pkgsrc/emulators/suse100_base/
66: # make install clean
69: This package contains some old shared libraries required for backwards compatibility.
71: # cd /usr/pkgsrc/emulators/suse100_compat/
72: # make install clean
75: This package supports running ELF binaries linked with glibc2 which require X11 shared libraries.
77: # cd /usr/pkgsrc/emulators/suse100_x11/
78: # make install clean
81: # Installing Sun's JDK
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.
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:
87: # echo "ACCEPTABLE_LICENSES+=jdk13-license" >> /etc/mk.conf
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.
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*
97: Now we are ready to install jdk:
99: # cd /usr/pkgsrc/lang/sun-jdk15/
100: # make install clean
103: ## /proc filesystem
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.
107: # mount_procfs -o linux procfs /usr/pkg/emul/linux/proc
110: and verify it with:
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)
119: You may have NetBSD mounted it automatically during the booting process, by modifying the /etc/fstab file by adding the following line:
121: procfs /usr/pkg/emul/linux/proc procfs rw,linux
124: Please be careful with your `/etc/fstab`. Wrong entries may lead to an unbootable system.
126: ## Data segment size
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:
130: $ ulimit -d 400000
133: You may want to put this into your `.profile`
135: In case you encounter runtime errors of the following form:
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 ~]
144: try increasing the data segment size.
146: # Running Netbeans
148: You may now run Netbeans, by typing:
150: [stathis@netbsd ~] ./netbeans/bin/netbeans --jdkhome /usr/pkg/java/sun-1.5
153: Note that you can edit `netbeans/etc/netbeans.conf` and add the following line:
158: so you won't have to explicitly set the location of J2SE JDK everytime you run Netbeans.
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb