我安装了 Netbeans 7.0.1,并确保安装了我能找到的所有 JDK 和 JRE。安装时没有错误。我还看到了这个问题并确保我也遵循了那里的所有说明。
我从未收到任何错误消息。据我所知,安装正常。
但是,当我尝试运行 Netbeans 时,没有得到任何响应。如果我从命令行运行它,大约 30 秒后,提示符就会返回。没有任何错误消息让我知道出了什么问题。
$ /bin/sh "/home/dave/netbeans-7.0.1/bin/netbeans"
$
问题是什么?如何让 Netbeans 运行?
根据答案中提供的以下说明,产生了新的命令行输出:
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-6-sun/jre/bin/java to provide /usr/bin/java (java) in manual mode.
$ /bin/sh "/home/dave/netbeans-7.0.1/bin/netbeans"
$
答案1
好的,戴夫,既然您发布的搜索词是 ubuntu 11.10..我假设您正在运行 Ubuntu 11.10.. :D
我也运行着相同的版本,今天已完全更新,我运行的版本是 64 位,但这应该没有什么区别。
这是我在我的机器上安装 netbeans 7.0.1 的步骤:
1)从其网站下载 Netbeans:http://netbeans.org/downloads/index.html 自由选择您需要的版本。(不要尝试安装它)
2)从 repos 安装 openjdk 6: sudo apt-get install openjdk-6-jdk
3)运行先前下载的 Netbeans 安装程序:
$ sh /path_to_downloaded_file/netbeans-7.0.1-ml-linux.sh
或者,如果您想让它更容易被看到,可以使用“cd”到您保存下载的位置(通常是下载文件夹)并:
$ sh netbeans-7.0.1-ml-linux.sh
安装程序应该启动并检查 JDK,它也不应该说出有关 JDK 的任何信息(只有在找不到 JDK 时才会显示警告消息)。
现在您应该能够顺利地按照安装程序进行操作了。
我刚刚下载并安装了完整版本,按照以下步骤没有任何问题:
488 clear
489 cd Downloads/
490 ls
491 sh netbeans-7.0.1-ml-linux.sh
492 sudo apt-get install openjdk-6-jdk
493 sh netbeans-7.0.1-ml-linux.sh
494 history
your_user@host_name:~/Downloads$
我希望这对你有用...
这是我找到适合我的解决方案的参考:http://ubuntuforums.org/showthread.php?t=1873487&page=2
[编辑] 以防万一,请检查下载校验和
$ md5sum netbeans-7.0.1-ml-linux.sh
它应该返回 netbeans.org 下载页面上的内容,在我的情况下,这是 204mb 下载的输出:
$ md5sum netbeans-7.0.1-ml-linux.sh
3559ec7d1ce1d4bcafd7eea98cc9c648 netbeans-7.0.1-ml-linux.sh
答案2
这已经很旧了,但我刚刚在 Ubuntu 13.04 和 Netbeans 7.3.1 中遇到了同样的问题
原因是当 Netbeans 以 root 权限运行以安装所有插件时,它会以 root 权限创建 ~/.cache/netbeans/7.3.1/*,并且在退出时不会清除这些文件。当您以您的用户身份运行它时,它会被拒绝访问这些文件,因此 Netbeans 会在没有警告的情况下终止。
更改该文件夹的所有权可解决此问题:
sudo chown yourUser -R ~/.cache/netbeans/
sudo chgrp yourUser -R ~/.cache/netbeans/
答案3
openjdk-8-jdk-headless
我在安装软件包而不是安装包时遇到了这个问题openjdk-8-jdk
。脚本无法运行,它只是“加载”几秒钟,然后什么都没有。
在这种情况下,只需使用删除 headless 包apt-get
并安装另一个即可。headless 包适用于服务器;它已删除图形组件。
答案4
我为 NetBeans 编写了一个安装脚本,旨在供使用 VirtualBox 运行双系统的用户使用。运行此脚本后,您将能够从终端启动 NetBeans,然后如果您正在 VirtualBox 上将其作为客户系统运行,能够使用在 /usr/local/bin 目录中构建的脚本将其从主机挂载到客户系统:
#!/bin/bash
#Author: Yucca Nel http://thejarbar.org
#Will restart system
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
export PATH
#Modify these variables as needed...
tempWork=/tmp/work
defaultStartScript=/etc/init.d/rc.local
defaultNetBeansVer=7.1
locBin=/usr/local/bin
read -p "Please [Enter] full path name of your local startup script ($defaultStartScript is the default). Please
make sure on this before providing a value by consulting documentation for your system:" locStartScript
locStartScript=${locStartScript:-$defaultStartScript}
read -p "Please [Enter] NetBeans Version ($defaultNetBeansVer is default):" netbeansVersion
netbeansVersion=${netbeansVersion:-$defaultNetBeansVer}
if [ ! -f $locStartScript ]
then
echo "The file you provided could not be found. Remember to include the full path and try again. Exiting in 7 secs..."
sleep 7
exit 1
fi
mkdir -p /$tempWork;
cd /$tempWork;
wget http://dlc.sun.com.edgesuite.net/netbeans/${netbeansVersion}/final/bundles/netbeans-${netbeansVersion}-ml-javase-linux.sh
sh $tempWork/*sh;
#Add Netbeans launcher to your PATH. Doing so allows you to run 'netbeans' command from the terminal
#This line will need to be changed if you changed the default install location (IOW Netbeans is not in ~/)
sudo ln -f -s ~/netbeans-7.1/bin/netbeans /usr/bin/;
#If you use VirtualBox , you can share your projects between Host and guest. Name of shared
#folder must match 'NetBeansProjects'
mkdir -p $HOME/NetBeansProjects
if [ -f /sbin/mount.vboxsf ]
then
sudo /sbin/umount /home/$HOME/NetBeansProjects
sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects
fi
if mountpoint -q ~/NetBeansProjects
then
#Add it to the start script to automate process...
sudo sed -ie '$d' $locStartScript
if ! grep "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" /etc/init.d/rc.local
then
echo "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" | sudo tee -a $locStartScript
fi
echo "exit 0" | sudo tee -a $locStartScript
sudo chmod +x $locStartScript
#Create a mount and unmount script file...
rm -rf $tempWork/*
echo '#!/bin/bash' > $tempWork/netbeans-mount.sh
echo "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" >> $tempWork/netbeans-mount.sh
echo "mounted NetBeansProjects" >> $tempWork/netbeans-mount.sh
echo "exit 0" >> $tempWork/netbeans-mount.sh
echo '#!/bin/bash' > $tempWork/netbeans-umount.sh
echo "sudo umount $HOME/NetBeansProjects" >> $tempWork/netbeans-umount.
echo "unmounted NetBeansProjects" >> $tempWork/netbeans-mount.sh
echo 'exit 0' >> $tempWork/netbeans-umount.sh
#Script for mounting ALL VirtualBox shared solders....
#If there isn't one create one...
if [ ! -f $locBin/mount-all-from-host.sh ]
then
echo '#!/bin/bash' > $tempWork/mount-all-from-host.sh
echo "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" | sudo tee -a $tempWork/mount-all-from-host.sh
echo "exit 0" | sudo tee -a $tempWork/mount-all-from-host.sh
#Otherwise if there is one, but no mount, add one...
elif ! grep "sudo /sbin/mount.vboxsf NetBeansProjects" $locBin/mount-all-from-host.sh
then
sudo sed -ie '$d' $locBin/mount-all-from-host.sh
echo "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" | sudo tee -a $locBin/mount-all-from-host.sh
echo "exit 0" | sudo tee -a $locBin/mount-all-from-host.sh
fi
#Script for unmounting ALL VirtualBox shared folders...
#If there isn't one create one...
if [ ! -f $locBin/umount-all-from-host.sh ]
then
echo '#!/bin/bash' > $tempWork/umount-all-from-host.sh
echo "sudo umount -a -t vboxsf" | sudo tee -a $tempWork/umount-all-from-host.sh
echo "echo 'unmounted all VirtualBox shared folders'" | sudo tee -a $tempWork/umount-all-from-host.sh
echo "exit 0" | sudo tee -a $tempWork/umount-all-from-host.sh
fi
sudo chmod +x $tempWork/*
sudo mv -f $tempWork/*.sh $locBin/
rm -rf $tempWork
fi
sudo reboot
exit 0