个人工具

“UbuntuHelp:Netbeans”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第3行: 第3行:
 
Parent page: [[UbuntuHelp:Programming| Programming Applications]]
 
Parent page: [[UbuntuHelp:Programming| Programming Applications]]
 
The [http://www.netbeans.org/products/ide/ NetBeans IDE] is an open-source, fast and feature full tool for developing Java software. It is standards compliant and runs on any operating system where a Java Virtual Machine is available.
 
The [http://www.netbeans.org/products/ide/ NetBeans IDE] is an open-source, fast and feature full tool for developing Java software. It is standards compliant and runs on any operating system where a Java Virtual Machine is available.
 +
== Installing the Latest Version Directly from Binaries ==
 +
The version of NetBeans available from synaptic or apt-get is out-of-date as of 2008-03-20.  This section covers the installation of NetBeans 6.1 (beta) from binaries downloaded directly from the netbeans website.  The procedure for the 6.0 production version would be nearly identical --- just substitute the appropriate download urls and file names for the installer and paths.
 +
=== Download the Binaries ===
 +
You can get the binaries at [http://download.netbeans.org/netbeans/6.1/beta/ the NetBeans download page].  Download the appropriate version depending on what language(s) you want to develop in.  I chose Ruby.  Download the file and save it to your home directory, ''/home/yourusername''.
 +
Install netbeans:
 +
<pre><nowiki>
 +
cd /home/yourusername
 +
sudo ./netbeans-6.1beta-ruby-linux.sh
 +
</nowiki></pre>
 +
Create a script to run netbeans (skip this if you want to invoke it from Applications -> Programming -> NetBeans IDE 6.1 Beta in the Ubuntu menu bar):
 +
<pre><nowiki>
 +
cd /home/yourusername
 +
mkdir bin
 +
cd bin
 +
 +
# Create a file called netbeans in the current dir and make its contents exactly as
 +
# follows in the next two lines and then save it and then quit your editor:
 +
#!/bin/bash
 +
/usr/local/netbeans-6.1beta/bin/netbeans
 +
 +
# Make it executable
 +
chmod u+x netbeans
 +
 +
# Put this in your path for this shell session
 +
# (add this line to your .bashrc or .zshrc file in /home/yourusername
 +
#  to see the path in all future shells; be sure to exit the shell to see the changes though)
 +
export PATH=/home/yourusername/bin:$PATH
 +
 +
# Run NetBeans!
 +
netbeans
 +
</nowiki></pre>
 +
=== Missing Java ===
 +
If the installer fails or cannot find the Java JDK, try
 +
<pre><nowiki>
 +
which java
 +
which javac
 +
</nowiki></pre>
 +
If those both return values, perhaps the installer missed them and you can browse for them manually yourself in the installer.  If one of those does not return a value, you need to install Java:
 +
<pre><nowiki>
 +
sudo apt-get install sun-java6-bin sun-java6-jdk
 +
</nowiki></pre>
 +
=== The Installer or NetBeans Window is All White or Blank: Problems with Compiz ===
 +
NetBeans does not like Compiz.  I got around this by changing my ''netbeans'' shell file above to be:
 +
<pre><nowiki>
 +
#!/bin/bash
 +
AWT_TOOLKIT=MToolkit /usr/local/netbeans-6.1beta/bin/netbeans
 +
</nowiki></pre>
 +
This makes NetBeans run with the MToolKit windowing toolkit but leaves the rest of your desktop running in Compiz.  This worked for me on Ubuntu 7.10.
 +
== NetBeans 4.1 on AMD64 ==
 
For instructions on installing Netbeans 4.1 on AMD64, see [[UbuntuHelp:Netbeans4.1onAMD64|Netbeans4.1onAMD64]].
 
For instructions on installing Netbeans 4.1 on AMD64, see [[UbuntuHelp:Netbeans4.1onAMD64|Netbeans4.1onAMD64]].
== Installation ==
+
== Installation of NetBeans 5.5 from Ubuntu Packages ==
 +
To install Netbeans5.5 you can run Synaptic Packet Manager and install the package named netbeans5.5, or open a terminal and type
 +
<pre><nowiki>
 +
sudo apt-get install netbeans5.5
 +
</nowiki></pre>
 +
Java SDK will will be automatically installed as dependency if it's not installed.
 +
If you want the 6.0 version of NetBeans you must install it manually.
 +
== Installation From Binary ==
 
To install and run Netbeans, you will need to have an Java SDK. The default Java JRE provided with Breezy (GCJ) is not enough to install and run Netbeans. To install a Java SDK, see "Getting Java" on [[UbuntuHelp:RestrictedFormats|RestrictedFormats]].
 
To install and run Netbeans, you will need to have an Java SDK. The default Java JRE provided with Breezy (GCJ) is not enough to install and run Netbeans. To install a Java SDK, see "Getting Java" on [[UbuntuHelp:RestrictedFormats|RestrictedFormats]].
 
Download Netbeans from their [http://www.netbeans.info/downloads/index.php download page], choose the version that suits your needs.  
 
Download Netbeans from their [http://www.netbeans.info/downloads/index.php download page], choose the version that suits your needs.  

2008年4月23日 (三) 11:51的版本

Parent page: Programming Applications The NetBeans IDE is an open-source, fast and feature full tool for developing Java software. It is standards compliant and runs on any operating system where a Java Virtual Machine is available.

Installing the Latest Version Directly from Binaries

The version of NetBeans available from synaptic or apt-get is out-of-date as of 2008-03-20. This section covers the installation of NetBeans 6.1 (beta) from binaries downloaded directly from the netbeans website. The procedure for the 6.0 production version would be nearly identical --- just substitute the appropriate download urls and file names for the installer and paths.

Download the Binaries

You can get the binaries at the NetBeans download page. Download the appropriate version depending on what language(s) you want to develop in. I chose Ruby. Download the file and save it to your home directory, /home/yourusername. Install netbeans:

cd /home/yourusername
sudo ./netbeans-6.1beta-ruby-linux.sh

Create a script to run netbeans (skip this if you want to invoke it from Applications -> Programming -> NetBeans IDE 6.1 Beta in the Ubuntu menu bar):

cd /home/yourusername
mkdir bin
cd bin

# Create a file called netbeans in the current dir and make its contents exactly as
# follows in the next two lines and then save it and then quit your editor:
#!/bin/bash
/usr/local/netbeans-6.1beta/bin/netbeans

# Make it executable
chmod u+x netbeans

# Put this in your path for this shell session
# (add this line to your .bashrc or .zshrc file in /home/yourusername
#  to see the path in all future shells; be sure to exit the shell to see the changes though)
export PATH=/home/yourusername/bin:$PATH

# Run NetBeans!
netbeans

Missing Java

If the installer fails or cannot find the Java JDK, try

which java
which javac

If those both return values, perhaps the installer missed them and you can browse for them manually yourself in the installer. If one of those does not return a value, you need to install Java:

sudo apt-get install sun-java6-bin sun-java6-jdk

The Installer or NetBeans Window is All White or Blank: Problems with Compiz

NetBeans does not like Compiz. I got around this by changing my netbeans shell file above to be:

#!/bin/bash
AWT_TOOLKIT=MToolkit /usr/local/netbeans-6.1beta/bin/netbeans

This makes NetBeans run with the MToolKit windowing toolkit but leaves the rest of your desktop running in Compiz. This worked for me on Ubuntu 7.10.

NetBeans 4.1 on AMD64

For instructions on installing Netbeans 4.1 on AMD64, see Netbeans4.1onAMD64.

Installation of NetBeans 5.5 from Ubuntu Packages

To install Netbeans5.5 you can run Synaptic Packet Manager and install the package named netbeans5.5, or open a terminal and type

 sudo apt-get install netbeans5.5

Java SDK will will be automatically installed as dependency if it's not installed. If you want the 6.0 version of NetBeans you must install it manually.

Installation From Binary

To install and run Netbeans, you will need to have an Java SDK. The default Java JRE provided with Breezy (GCJ) is not enough to install and run Netbeans. To install a Java SDK, see "Getting Java" on RestrictedFormats. Download Netbeans from their download page, choose the version that suits your needs. Open a terminal and cd to the folder where you put the downloaded file and make this file executable.

 cd <your_download_dir>
 chmod +x <downloaded_file>

To install system-wide installation, run the file with sudo and follow the instruction.

 sudo ./<downloaded_file>

To install for your user, simply run the file and follow the instruction. When asked, choose an install directory and be sure your user has write access to it.

 ./<downloaded_file>

Note: If Netbeans is unable to find JDK try appending -is:javahome /usr/lib/jvm/java-* to the install command. To run Netbeans, use <netbeans_install_dir>/bin/netbeans.

Post-Installation Setup

If you install system-wide a Netbeans bundled with Sun's J2EE Application Server, you will not be able to use the default domain (domain1) from a non-privileged user account. The installed files are owned by the root account and some are read/write protected. An easy solution is to give all the files in the domain1 directory to your user.

 sudo chown -R <your_user>:<your_user> <SUNWappserver_install_dir>/domains/domain1

In Netbeans, in the "Runtime" right-click to the "Server" item to "Add Server...". In the wizard, use your SUNWappserver directory as "Platform Location" and choose yhe default domain in the drop-down box. After clicking "Next", enter the default admin user (admin) and password (adminadmin) and click "Finish". A more cleaner solution, is to make a copy of domain1 and then give files in this copy to your user. Because they contain path specific information, you will have to edit the following files: bin/starserv and bin/stopserv.

  sudo cp -R <SUNWappserver_install_dir>/domains/domain1 <copy_destination>
  sudo chown -R <your_user>:<your_user> <copy_destination>/domain1
  cd <copy_destination>/domain1
  gedit bin/startserv bin/stopserv

in each file, search the line that looks like

  INSTANCE_ROOT=<SUNWappserver_install_dir>/domains/domain1

and replace it with

  INSTANCE_ROOT=<copy_destination>/domain1

In Netbeans, in the "Runtime" right-click to the "Server" item to "Add Server...". In the wizard, use your SUNWappserver directory as "Platform Location", choose "Register Local Domain" and click "Next". Use your copy of domain1 as "Domain Folder" and, after clicking "Next", enter the default admin user (admin) and password (adminadmin) and click "Finish".