转载

java开发常见问题与知识点(1)

eclipse快速复制一行

按住Ctrl+Alt+Down,即可以在下面快速复制一行 ,按住Ctrl+Alt+Up,即可以在上面快速复制一行

java list 实例化

List<ProductListData> listData=new ArrayList<ProductListData>();

java arraylist 赋值

//Method 1 ArrayList<String> lists1 = new ArrayList<String>(); lists1.add("test1"); lists1.add("test2"); //Method 2 , (double brace initialization) ArrayList<String> lists2 = new ArrayList<String>(){{ add("test1"); add("test2"); }};

eclipse刷新快捷键F5

Dynamic Web Module 3.1 requires Java 1.7 or newer

把三个jdk设置 的地方,改jdk版本到最新的。

查端口占用。

netstat -ano #查找所有的端口,定位pid,再定位进程 ,结束

确认tomcat服务器还是项目问题

eclipse 集成tomcat以后,可以先不加任何项目,直接启动,如果成功。说明是tomcat服务器没问题,

再具体 附加到要启动的项目,如果有问题,则问题出会项目中。 要从项目中寻找 。

eclipse启动页面

web.xml中打到如下的代码。

<welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> </welcome-file-list>

测试下载的maven依赖是否正常

右击项目-run as -maven test

手动更改的jdk版本在update maven以后还是会变回1.5

在pom.xml中增加如下配置

<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build>

maven repositories的配置

先下载,然后建立环境变量。在安装目录的conf下找到setting.xml。

localRepository:指定本地硬盘存放的位置

mirrors:建立镜像下载站点。因为默认是国外站点。下载慢。

<localRepository>E:/SVNWorks/maven-Repository</localRepository> <mirrors> <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors>

然后在eclipse中配置一下

路径:Maven-user setting-user setting

原文  http://www.hechunbo.com/index.php/archives/241.html
正文到此结束
Loading...