`

Ubuntu问题知识汇总

阅读更多

在Ubuntu10.04中使用javac命令的时候报错: 

1.程序“javac”已包含在以下软件包中

      jftt@jftt-desktop:~$ javac 程序“javac”已包含在以下软件包中: 
      * openjdk-6-jdk 
      * ecj 
      * gcj-4.4-jdk 
      * gcj-4.3 
      * jikes-classpath 
      * jikes-kaffe 
      * kaffe 
      * sun-java6-jdk 
      请尝试:sudo apt-get install <选定的软件包> 
      javac: command not found

       然后我添加sudo apt-get install sun-java6-jdk之后再次敲这个命令还是不行。

       呵呵,终于知道了,原来我的JAVA_HOME路径有错误哦。只要在上一部添加sudo apt-get install openjdk-6-jdk就可以了。之后要输入密码。运行就算安装成功了。

        2.ubuntu删除磁盘垃圾,释放磁盘空间

        由于原来安装Ubuntu到虚拟机磁盘空间太小,安装Ubuntu花了2~3G,update还有install一些软件之后磁盘紧张了。所以想删除磁盘中的垃圾文件。

        使用ubuntu 的命令清理不用的软件包:

        sudo apt-get autoclean 此命令清除已删除软件的备份包 
        sudo apt-get clean 此命令清除已安装软件的备份包 
        sudo apt-get autoremove 

         无奈这样也没有清理出多少磁盘空间

         

        3.虚拟机下的Ubuntu磁盘不足问题

        1.通过虚拟机添加一个硬盘然后挂载,硬盘类型,可以选择IDE,或是SCSI

        2.启用root账号,在终端输入fdisk -l,可以看到

        Disk /dev/sda: 10.7 GB, 10737418240 bytes 
        255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes 
        Disk identifier: 0x000af383 
        Device Boot Start End Blocks Id System /dev/sda1 * 1 1244 9992398+ 83 Linux 
        
        Disk /dev/sdb: 5368 MB, 5368709120 bytes 
        255 heads, 63 sectors/track, 652 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes 
        Disk identifier: 0x00000000 

        这里可以看到/dev/sdb 就是新添加的硬盘,需要给新的硬盘分区。

        在终端输入:fdisk /dev/sdb,之后

        键入:m,可以看到帮助信息

        键入:n,添加新分区

        键入:p,选择添加主分区

        键入:l,选择主分区编号为1,这样创建后的主分区为sdb1

        之后,fdisk会让你选择该分区的开始值和结束值,直接回车

        最后键入:w,保存所有并退出,完成新硬盘的分区。

        3.格式化磁盘

        在终端输入:mkfs -t ext3 /dev/sdb1

        用ext3格式对/dev/sdb1 进行格式化

        4.挂载该分区:

        手动挂载:

        在终端输入:mkdir /media/wrap ,创建新的硬盘的挂载点

        在终端键入:mount /dev/sdb1 /media/wrap

        如果想开机自动挂载

        修改/etc/fstab文件,添加如下行:

        /dev/sdb1       /media/wrap      ext3    defaults,        0       1

         

        4.可能有用的命令

        sudo apt-get install git-core curl
        curl http://android.git.kernel.org/repo >~/bin/repo
        chmod a+x ~/bin/repo
        
        sudo gedit /etc/profile
        export PATH=$PTAH:~/bin/
        
        repo init –u git://android.git.kernel.org/platform/manifest.git
        repo sync
        
        如果我们想拿某个分支版本的代码,而不是主线代码,需要使用-b参数指定branch的名字,比如:
        repo init –u git://android.git.kernel.org/platform/manifest.git –b cupcake
        
        如果我们只是想获取某一个project的代码,比如kernel/common,就不需要repo脚本了,直接使用Git工具即可,如果仔细研究repo脚本会发现,repo脚本其实就是组织Git工具去获取各个Project并把它们组织到同一个项目Android内。
        git clone git://android.git.kernel.org/kernel/common.git
        
        我们上面使用repo脚本获取了各个项目,那么接下来就需要把整个Android代码树同步到本地,如下:
        repo sync project1 project2 …
        
        在源码目录下执行
        $ . build/envsetup.sh (. 后面有空格)
        就多出一些命令:
        - croot:   Changes directory to the top of the tree.
        - m:       Makes from the top of the tree.
        - mm:      Builds all of the modules in the current directory.
        - mmm:     Builds all of the modules in the supplied directories.
        - cgrep:   Greps on all local C/C++ files.
        - jgrep:   Greps on all local Java files.
        - resgrep: Greps on all local res/*.xml files.
        - godir:   Go to the directory containing a file.
        可以加—help查看用法
        我们可以使用mmm来编译指定目录的模块,如编译联系人:
        $ mmm packages/apps/Contacts/
        编完之后生成两个文件:
        out/target/product/generic/data/app/ContactsTests.apk
        out/target/product/generic/system/app/Contacts.apk
        可以使用
        $ make snod
        重新生成system.img,再运行模拟器

        分享到:
        评论

        相关推荐

        Global site tag (gtag.js) - Google Analytics