分类 离线计算生态 下的文章

File--->open --->选择项目

IntelliJ IDEA 添加项目后编译显示包不存在的解决方案

导入项目后编译,显示如图的信息,之前都是用 maven 来管理 jar 包,本次项目的 jar 包都是在 lib 目录下存放,碰到这种情况的处理方式:

File–>Project Structure–>左侧 Libraries,中间新建一个 lib 的project Library,选择 Java,然后在选择项目中的 jar 所在的文件夹,我的是 WebContent–>WEB-INF–>lib,最后点击 OK,重新编译即可。

IDEA经常遇到的jar包引入错误问题

出现lib中jar包没有导入,但是jar都在项目中:
右键lib----->ADD As Library---->新建一个lib 即可;

在IntelliJ IDEA中打开要添加jar包的Project

方法一: 
先是进入:File –> Project Structure
再找到Modules->Dependencies 
点击最右侧的绿色+号 

第二种方式
也就是在你需要导入的Jar包上,点击右键,选择Add as Library…

如果还是报缺少jar包那么就需要新建一个pom文件,通过maven来导入,本人亲测有效

总是报The import org.apache cannot be resolved
org.apache,不是标准的java中的库。所以eclipse中,无法自动识别。
org.apache下包括了一堆相关的库,此处用到的的是org.apache.http,所以:
需要找到对应的org.apache.http相关的jar包,然后加到当前的项目中。

  <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

http://blog.csdn.net/qq_26525215/article/details/53239123

[root@localhost sh]# service httpd start
Starting httpd: httpd: Could not reliably determine the server‘s fully qualified domain name, using localhost.localdomain for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
  1. 查询到 80 端口被 nginx 占用:

    [root@localhost sh]# netstat -tulnp | grep ":80"
    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1327/nginx

  2. 找到 nginx 的进程号:

    [root@localhost sh]# ps -ef | grep nginx
    root 1327 1 0 11:35 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    www 1329 1327 0 11:35 ? 00:00:00 nginx: worker process
    root 3902 1789 0 14:41 pts/0 00:00:00 grep --color=auto nginx

  3. 杀掉进程:

    [root@localhost sh]# kill -9 1327
    [root@localhost sh]# kill -9 1329

  4. 重新开启 Apache:

    [root@localhost sh]# service httpd start
    Starting httpd: httpd: Could not reliably determine the server‘s fully qualified domain name, using localhost.localdomain for ServerName

                                                           [  OK  ]
    

一、编写shell脚本文件

 在shell中,$@和"$*"都表示命令行所有参数(不包含$0),但是"$*"将命令行的所有参数看成一个整体,而$@则区分各个参数 eg:

for i in "$@"
do
   echo $i   #会经历$#次循环
done

for i in "$*"
do
   echo $i  #只会进行一次循环,如果$*没有加双引号则会进行$#次循环
done

二、在命令行中输入 sh hello.sh 1 2 3 4 5 6 7

这时候的运行结果是
1
2
3
4
5
6
7
1 2 3 4 5 6 7