2011年10月15日星期六

Ubuntu下eclipse快捷方式找不到JVM的问题 (转载:http://blog.csdn.net/seafit/article/details/5673629)

昨日通过vmware装上最新的Ubuntu系统,电脑配置比较高,所以跑起来速度还是很不错。接着装了TOMCAT,ANDROID,等等必须的开发软件。 不过期间eclipse的一个问题确实花了不少时间,记录一下解决方案。

1,下载JDK和ECLIPSE。
       下载就不用说了,去eclipse官网下一个伽利略的版本即可,JDK相信下载过WINDOWSjava的人都知道。  最好用1.5.0版的,网上说JDK1.6编译android会出问题,我没试过,为了少走弯路,吸取了前人经验。

        安装JDK方面也不用多说,网上资料太多了。这里记录几个细节问题。

        JDK路径: 基本上JDK装在任何地方都是可以的,把JAVA_HOME,classpath, path指对路径就可以了,我的安装如下。

         export JAVA_HOME=/usr/java/jdk1.5.0_22
         export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
         export PATH=$PATH:$JAVA_HOME/bin

          由于我是初学linux,对于linux的环境变量不知道如何设置,从网上的结果来看,我在/etc/bash.bashrc    和  /etc/environment里都加了以上三行。


2,安装eclipse.
          从网上来看,eclipse也是可以安装在任何地方的,我的安装在/opt/eclipse里。安装完成后,会在Applications->program里有一个快捷方式。这下问题就来了,点击这个快捷方式会报下面的错误。

A Java Runtime Environment (JRE) or Java Development Kit (JDK)
must be available in order to run Eclipse. No Java virtual machine
was found after searching the following locations:
/opt/eclipse/jre/bin/java
java in your current PATH

这个就本篇博客要记录的内容,因为这个简单的问题花了我很多时间。
从最后的解决办法来看,是因为桌面启动没有加载之前提到的三行环境变量。但是在控制台是可以通过命令行启动的。




解决办法是在终端进入你的eclipse目录,然后输入:

mkdir jre
cd jre
ln -s 你的JDK目录/bin bin




 

最后的解决办法如下:

在创建文件 /usr/bin/eclipse  内容如下
#!/bin/sh
export MOZILLA_FIVE_HOME=/usr/lib/mozilla/
export ECLIPSE_HOME=/opt/eclipse

export JAVA_HOME=/usr/java/jdk1.5.0_22
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

$ECLIPSE_HOME/eclipse $*

然后编辑ECLIPSE的快捷方式
将command 变为 eclipse.

也可以自己写一个bash脚本,我放在了/userrun/eclipse.sh.   内容如下

#!/bin/sh
export GDK_NATIVE_WINDOWS=1
export ECLIPSE_HOME=/opt/eclipse
export JAVA_HOME=/usr/java/jdk1.5.0_22
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

$ECLIPSE_HOME/eclipse $*

然后把快捷方式的command变为  /userrun/eclipse.sh  也可以实现快捷方式启动eclipase.


网上搜了很多资料,都是零碎的,每个人说几点,但都没有说全,很费解。 回头看看还是很简单的,环境变量设置对了就一切搞掂

ubuntu10 Realtek ID 270 无声

Step 1

If you are using Ubuntu 11.04 (Natty), then execute this command and reboot:
sudo add-apt-repository ppa:ubuntu-audio-dev/ppa; sudo apt-get update;sudo apt-get dist-upgrade; sudo apt-get install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r) libasound2; sudo apt-get -y --reinstall install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r)  libasound2; killall pulseaudio; rm -r ~/.pulse*
If you are using Ubuntu 10.10 (Maverick), then execute this command and reboot:
sudo add-apt-repository ppa:ubuntu-audio-dev/ppa; sudo add-apt-repository ppa:ricotz/unstable;  sudo apt-get update;sudo apt-get dist-upgrade; sudo apt-get install  linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r) libasound2; sudo apt-get --reinstall install  linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop  linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r) libasound2; killall pulseaudio; rm -r ~/.pulse*
If you are using Ubuntu 10.04 (Lucid), then execute this command and reboot:
sudo add-apt-repository ppa:ubuntu-audio-dev/ppa; sudo add-apt-repository ppa:team-iquik/alsa; sudo apt-get update; sudo apt-get dist-upgrade; sudo apt-get install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r) libasound2; sudo apt-get --reinstall install linux-sound-base alsa-base alsa-utils gdm ubuntu-desktop linux-image-`uname -r` linux-alsa-driver-modules-$(uname -r)  libasound2; killall pulseaudio; rm -r ~/.pulse*
If you are using Ubuntu 9.10 (Karmic), then you should upgrade to Ubuntu 10.04.2 LTS or newer versions. End of life date for Ubuntu 9.10 was April 2011.
If you upgraded ALSA using the command above and still do not have working sound after rebooting your PC again, then execute this command, reboot and retest sound using headphones and speakers:
cd; sudo apt-get update; sudo apt-get -y install build-essential ncurses-dev gettext xmlto libasound2-dev linux-headers-`uname -r` libncursesw5-dev; wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.24.tar.bz2; tar jxvf ./alsa-driver-1.0.24.tar.bz2; rm ./alsa-driver-1.0.24.tar.bz2; cd ./alsa-driver-1.0.24; sudo ./configure; sudo make; sudo make install; killall pulseaudio; cd; rm -r ~/.pulse*; rm ./alsa-driver-1.0.24

Step 2

In gnome-terminal, make sure that unlimited scrolling is enabled:
  • click on Edit > Profiles > "Default" profile > Scrolling. Choose "Unlimited" as scrolling option. Click Close and Close again.
If you are using the Gnome interface, open the Terminal console via "Applications->Accessories->Terminal"
If you are using the Unity interface, the easiest way to open the Terminal is to use the 'search' function on the dash. Or you can click on the 'More Apps' button, click on the 'See more results' by the installed section, and find it in that list of applications. A third way, available after you click on the 'More Apps' button, is to go to the search bar, and see that the far right end of it says 'All Applications'. You then click on that, and you'll see the full list. Then you can go to Accessories > Terminal after that.
So the methods in Unity are:
Dash > Search for Terminal
Dash > More Apps > 'See More Results' > Terminal
Dash > More Apps > Accessories > Terminal

Step 3

Reboot your computer. Then run the following 2 diagnostic commands.
Tip: If you have a wheel mouse or 3-button mouse, you do not need to type the commands into the Terminal. Instead, copy the commands from this web page and paste them into the terminal. To do this, move your mouse cursor over the start of the command written on the Web page. Then press the left mouse button and drag the mouse till the end of the command to highlight the whole command; then release the mouse button. Then press the middle mouse button or mouse wheel anywhere inside the Terminal. The command should now be printed in the Terminal without errors. Now press <Enter> to execute the command.
wget -O alsa-info.sh http://www.alsa-project.org/alsa-info.sh; chmod +x ./alsa-info.sh; ./alsa-info.sh
Post the full Terminal output after the script has actually run by creating a new question in launchpad then copy&paste the terminal output into your newly created question. Carefully inspect the Terminal output of the ALSA Information script that was generated by the previous diagnostic command
bash alsa-info.sh --stdout
After upgrading ALSA and rebooting the computer make sure that the ALSA driver version, library version and utilities version are all exactly the same version number.
The Terminal output after running the ALSA information script should contain something like this:
# ALSA Version
# Driver version: 1.0.24
# Library version: 1.0.24.1
# Utilities version: 1.0.24.2
If the Driver, Library and Utilities version numbers are not equal, this probably due to one of the following issues:
1. One of the ALSA components was not successfully upgraded during step 1 in this procedure
2. ALSA was correctly installed or upgraded, but a wrong / old kernel was booted instead of the most recent kernel version. In that case, boot the newest kernel version (that is available in the standard/default Ubuntu repositories) and then retest sound.
For example: if you installed or upgraded to Ubuntu 10.10 (Maverick Meerkat edition), make sure the running kernel version is 2.6.35-22-generic or higher. Or else sound will not work!
For example: if you installed or upgraded to Ubuntu 10.04 (Lucid Lynx edition), make sure the running kernel version is 2.6.32-21-generic or higher. Or else sound will not work!

Step 4

Copy & paste the following diagnostic command into the Linux Terminal, then press <Enter>. The command starts with the command cat and ends with the word sound. (Do not copy & paste this diagnostic command from an email message into the Terminal, as that will only copy part of the command.) When asked for your password, type your normal user password (no stars are given as you type); then press <Enter> again.
Tip: If you have a wheel mouse or 3-button mouse, you do not need to type the commands into the Terminal. Instead, copy the commands from this web page and paste them into the terminal. To do this, move your mouse cursor over the start of the command written on the Web page. Then press the left mouse button and drag the mouse till the end of the command to highlight the whole command; then release the mouse button. Then press the middle mouse button or mouse wheel anywhere inside the Terminal. The command should now be printed in the Terminal without errors. Now press <Enter> to execute the command.
cat /proc/asound/{version,cards,devices,hwdep,pcm,seq/clients}; sudo rm /etc/asound.conf; sudo rm -r ~/.pulse ~/.asound* ;sudo rm ~/.pulse-cookie; sudo apt-get update; sudo apt-get install aptitude; sudo aptitude install paman gnome-alsamixer libasound2-plugins padevchooser libsdl1.2debian-pulseaudio; sudo lshw -short;ls -lart /dev/snd;  cat /dev/sndstat; lspci -nn;  sudo which alsactl; sudo fuser -v /dev/dsp /dev/snd/* ; dpkg -S bin/slmodemd; dmesg | egrep 'EMU|probe|emu|ALSA|alsa|ac97|udi|snd|ound|irmware'; sudo /etc/init.d/sl-modem-daemon status; sudo grep model /etc/modprobe.d/* ; sudo dmidecode|egrep 'anufact|roduct|erial|elease'; lsmod | egrep 'snd|usb|midi|udio'; aplay -l; sudo lshw -C sound

 

Your ALSA output shows several issues:
Step A)
WARNING: All config files need .conf: /etc/modprobe.d/alsa-base, it will be ignored in a future release.
WARNING: All config files need .conf: /etc/modprobe.d/options, it will be ignored in a future release.
 Please run the following commands to delete those invalid ALSA configuration files:
sudo rm /etc/modprobe.d/alsa-base
sudo rm /etc/modprobe.d/options
Only the following configuration file is the right one to use in Ubuntu 10.04 and should NOT be deleted:
/etc/modprobe.d/alsa-base.conf
Step B)
!!ALSA Version
!!------------
Driver version: 1.0.21
Library version: 1.0.22
Utilities version: 1.0.22
Your ALSA driver, library and utilities versions are not equal and not fully up-to-date.
Please execute the following procedure to upgrade ALSA to version 1.0.23:
http://monespaceperso.org/blog-en/2010/05/02/upgrade-alsa-1-0-23-on-ubuntu-lucid-lynx-10-04/
Step C)
!!Modprobe options (Sound related)
!!--------------------------------
snd-pcsp: index=-2
snd-hda-intel: model=m51va
!!HDA-Intel Codec information
!!---------------------------
--startcollapse--
Codec: Realtek ID 270
The model option you selected to use in /etc/modprobe.d/alsa-base.conf does not correspond with the Codec version that the ALSA driver detected. Codec: Realtek ID 270 means that your ALSA driver is unable to identify precisely which Codec and mixer type is linked to your soundcard. This is another reason to upgrade ALSA to a newer version. Hopefully, the newer ALSA driver can correctly identify the Codec.
So there is no good reason YET to set a model option in the /etc/modprobe.d/alsa-base.conf file.
Run the following command:
gksudo gedit /etc/modprobe.d/alsa-base.conf
In the /etc/modprobe.d/alsa-base.conf file, REMOVE the following line, if it exists:
options snd-hda-intel model=m51va
Then save the change to the file.
After executing steps A, B and C, please reboot and retest sound.

 

 

 

ubuntu 开机自动运行 命令

cd /etc
sudo gedit rc.local
在其中加入命令 最后要以 exit 0 结束

2011年10月14日星期五

安装Ubuntu Fcitx (转载)

安装Ubuntu Fcitx
  1. sudo apt-get install im-switch fcitx   
  2. sudo im-switch -s fcitx -z default  
  3. im-switch -s fcitx -z default #修改当前用户的默认输入法, 具体看man im-switch 
Ubuntu Fcitx完成设置最好重启一下X,输入法就生效了.如果发现软件界面字体是方块,gedit ~/.fcitx/config或gksu gedit /usr/share/fcitx/data/tables.conf打开配置文件修改一下字体就OK.可以使用fc-list来查看已安装的字体。如果 配置文件出现乱码,使用gedit --encoding gbk XXX #打开配置文件。
Ubuntu Fcitx 字体列表: xlsfonts或 fc-list (取=前面)
某些情况下可能,在安装了fcitx输入法以后可能会出现和SCIM并存的问题,只要用im-switch把默认输入法改成fcitx就可以了:
  1. sudo im-switch -a fcitx  
  2. im-switch -a fcitx 




Ubuntu Linux 10.04自带的输入法不是很好用,linux下的输入法和windows下的比起来还是有很大差距的,相对来说比较好的输入法我看还是fcitx还不 错,不过在Ubuntu下通过“sudo apt-get install fcitx”命令安装之后会出现方块的乱码。那是因为fcitx安装后默认的中文显示字体设置错误。
fcitx的配置文件 是~/.fcitx/config
但是直接用 gedit ~/.fcitx/config 打开配置文件显示的也都是乱码,解决办法就是指定编码方式打开“sudo gedit --encoding gbk ~/.fcitx/config” Ubuntu默认的编码方式是UTF-8格式,因此需要通过gbk方式来打开该文件。
[程序]
显示字体(中)=*
显示字体(中)=*
显示字体 (英)=Courier New
显示字体(英)=Courier New
显 示字体大小=12
主窗口字体大小=9
字体区域=zh_CN.UTF-8
使用AA字体=1
使用粗体=1
使用托盘图 标=1
需要将第一行配置改成
“显示字体(中)=AR PL ShanHeiSun Uni”
注销之后,fcitx正常工作。

ubuntu compaq wireless driver network unclaimed---from others

network UNCLAIMED in wireless on ubuntu 9.10

Can anyone tell me how to find wireless network drivers for ubuntu 9.10 on Compaq 510 notebook.
Here is the output of "lshw -C network"

*-network UNCLAIMED
description: Network controller
product: Realtek Semiconductor Co., Ltd.
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:10:00.0
version: 10
width: 32 bits
clock: 33MHz
capabilities: bus_master cap_list
configuration: latency=0
resources: ioport:6000(size=256) memory:e8000000-e8003fff
*-network
description: Ethernet interface
product: Marvell Technology Group Ltd.
vendor: Marvell Technology Group Ltd.
physical id: 0
bus info: pci@0000:30:00.0
logical name: eth0
version: 10
serial: 18:a9:05:d2:e5:0c
width: 64 bits
clock: 33MHz
capabilities: bus_master cap_list ethernet physical
configuration: broadcast=yes driver=sky2 driverversion=1.23 firmware=N/A ip=192.168.1.2 latency=0 multicast=yes
resources: irq:29 memory:e0000000-e0003fff ioport:2000(size=256)
 
 
 
lspci -nn 
 
 
 
00:00.0 Host bridge [0600]: Intel Corporation Mobile GME965/GLE960 Memory Controller Hub [8086:2a10] (rev 0c)
00:02.0 VGA compatible controller [0300]: Intel Corporation Mobile GME965/GLE960 Integrated Graphics Controller [8086:2a12] (rev 0c)
00:02.1 Display controller [0380]: Intel Corporation Mobile GME965/GLE960 Integrated Graphics Controller [8086:2a13] (rev 0c)
00:1a.0 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 [8086:2834] (rev 03)
00:1a.7 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 [8086:283a] (rev 03)
00:1b.0 Audio device [0403]: Intel Corporation 82801H (ICH8 Family) HD Audio Controller [8086:284b] (rev 03)
00:1c.0 PCI bridge [0604]: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 [8086:283f] (rev 03)
00:1c.1 PCI bridge [0604]: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 [8086:2841] (rev 03)
00:1c.4 PCI bridge [0604]: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 [8086:2847] (rev 03)
00:1c.5 PCI bridge [0604]: Intel Corporation 82801H (ICH8 Family) PCI Express Port 6 [8086:2849] (rev 03)
00:1d.0 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 [8086:2830] (rev 03)
00:1d.1 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 [8086:2831] (rev 03)
00:1d.2 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 [8086:2832] (rev 03)
00:1d.7 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 [8086:2836] (rev 03)
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 Mobile PCI Bridge [8086:2448] (rev f3)
00:1f.0 ISA bridge [0601]: Intel Corporation 82801HEM (ICH8M) LPC Interface Controller [8086:2815] (rev 03)
00:1f.1 IDE interface [0101]: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller [8086:2850] (rev 03)
00:1f.2 SATA controller [0106]: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller [8086:2829] (rev 03)
10:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. Device [10ec:8171] (rev 10)
30:00.0 Ethernet controller [0200]: Marvell Technology Group Ltd. Device [11ab:4357] (rev 10)



Your Realtek uses the driver r8192se_pci. You will need to get an ethernet connection and get some files from the internet:
Code:
sudo apt-get install linux-headers-generic build-essential
Then go here: http://ubuntuforums.org/showpost.php...55&postcount=5

You can follow each step carefully and even copy and paste his commands into a terminal. There is one correction, however, his two commands that start with 'sed' should be run as sudo; that is, sudo sed ...etc.

You should then disconnect the wire and click the Network Manager icon and connect wirelessly.
 
 
 
 
 
 
 
rtl8192se - Wireless Problems on 1201N
I found a solution to get wireless networking to work without NDISWrapper! I went to the following link to figure it out:

https://bugs.launchpad.net/ubuntu/+s...6?comments=all



I used the rtl8192se_linux_2.6.0010.1211.2009.tar.gz file which was referenced in post #134 and is available here:

http://launchpadlibrarian.net/366886...11.2009.tar.gz


I did the following to get it to work after downloading the file:
Code:
tar xzf rtl8192se_linux_2.6.0010.1211.2009.tar.gz
cd rtl8192se_linux_2.6.0010.1211.2009
sudo make
Then you need to edit two files to work with Ubuntu using the following commands (This works on Ubuntu 9.10):
Code:
sed -i 's/install: modules/install:/g' ./ieee80211/Makefile
sed -i 's/install: modules/install:/g' ./HAL/rtl8192/Makefile
Then you install with the following command:
Code:
sudo make install
sudo echo "r8192se_pci" > /etc/modules
sudo modprobe r8192se_pci
 
ravindika is offline Report Post   Reply With Quote

linux关闭手写板 ----转载

打字的时候,如果不小心碰到触摸板,鼠标一下子不知道飞哪去了,真的是让人挺烦恼的一件事情。
解决方法如下

1.终端输入如下命令:
sudo modprobe -r psmouse
如果打开触摸板就是:
sudo modprobe psmouse

注:此方法重启系统后触摸板又会自动激活。%>_<%


2.最近我又重新安装了一次Ubuntu9.10,发现在鼠标设置那有个“打字时禁用触摸板”,点上以后打字的时候即使碰到触摸板,光标也不会丢了。O(∩_∩)O~

要是想永久禁用触摸板可以参考一下方法:

安装gsynaptics软件包,系统菜单中会出现“触摸板”的选项。
命令:sudo apt-get install gsynaptics

然后在 “系统-->首选项-->触摸板-->一般-->启用触摸板”,去选该项就可以一劳永逸地禁用恼人的触摸板了。方法是网上找的.本人测试此方法不行,关闭后一段时间触摸板会自动启动,权限的问题



3.最好的方式还是通过脚本实现吧。方法如下:(此方法自己想的,不可行啦,无法完成自启动,有待改进!)
创建脚本文件:
命令:vi closeTouchpad.sh
(如果不想让脚本文件显示,可以在文件名前加“.”即可)
内容:
#!/bin/sh
if xinput list-props "SynPS/2 Synaptics TouchPad" | grep "Device Enabled" |     grep 1
then
modprobe -r psmouse
else
modprobe psmouse
fi

给脚本文件加上可执行权限:chmod +x closeTouchpad.sh
将脚本文件拷贝到任意路径(我的是放到了/usr目录下):sudo cp closeTouchpad.sh /usr
在/etc/init.d/目录下建立软连接实现自启动:sudo ln -s /usr/closeTouchpad.sh closeTouchpad
这里注意:脚本文件必须是root权限來执行才能生效,所以在/etc/init.d/下建立软链接,当然也可以直接把脚本文件copy到/etc/init.d/里面。
下次启动Ubuntu的时候,脚本就会自动执行关闭触摸板了。注意出门别忘带鼠标,如果忘记只能在终端执行
sudo modprobe psmouse 來启用触摸板了,怎么键盘启动终端,自己想想办法吧。