java
共 28 篇文章
使用Spring @Scheduled注解执行定时任务
配置我们的dispatcherContext-servlet.xml xmlns 多加下面的内容 xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation多加下面的内容 http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd task任务扫描注解 <task:annotation-driven/> <context:annotation-confi…
2015-07-30 01:45 · java
maven 添加 本地 jar
先在pom.xml中添加一个资源: <repositories> <repository> <id>project.repo</id> <name>Local dependencies for project</name> <!-- <url>file://${project.basedir}/lib</url> --> <url>file:${project.basedir}/repo</url> </repository> </repositories> 再在添加一个依赖: <dependency> <groupId>com.sina</groupId> <artifactId>sae-…
2013-09-10 23:31 · java
maven scope含义的说明
依赖范围控制哪些依赖在哪些classpath 中可用,哪些依赖包含在一个应用中。让我们详细看一下每一种范围: compile (编译范围) compile是默认的范围;如果没有提供一个范围,那该依赖的范围就是编译范围。编译范围依赖在所有的classpath 中可用,同时它们也会被打包。 provided (已提供范围) provided 依赖只有在当JDK 或者一个容器已提供该依赖之后才使用。例如, 如果你开发了一个web 应用,你可能在编译 classpath 中需要可用的Servlet API 来编译一个servlet,但是你不会想要在打包好的WAR 中包含这个Servlet API;这…
2013-09-09 13:27 · java
JPA Criteria API
//hibernate 3.5.1 // //Simple Query Query query = entityManager.createQuery("from SimpleBean s"); List<SimpleBean> list = query.getResultList(); CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder(); CriteriaQuery<Object> criteriaQuery = criteriaBuilder.createQuery(); Root<SimpleBean…
2013-01-27 22:19 · java
Google Code personal maven repository
Getting your jar of a library or something to other people can be expensive in terms of time. So you probably have already had a look at the maven central repository guide ... and that is too expensive to set up unless you are a big company. I did the same and I left the argument for a couple of da…
URLConnection 读写url
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String urlss = "http://127.0.0.1:8080/test/ShopServlet"; StringBuilder responseBuilder = null; BufferedReader reader = null; OutputStreamWriter wr = null; URL url; try { url = new U…
2012-12-12 22:16 · java
Spring MVC 笔记 1
1.新建maven 工程 mvn archetype:generate -DinteractiveMode=false -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-jee5 -Dversion=0.0.1-SNAPSHOT -DgroupId=com.kxmgc -DartifactId=springmvc 2.修改pom.xml,增加spring mvc 3.0.5的依赖包及jetty plugin <dependency> <groupId>org.springframework…
2012-10-18 12:35 · java
java持久化jpa笔记
@Entity//标识这个pojo是一个jpa实体 @Table(name = "users") //指定表名为users public class Users implements Serializable { @Id//设置主键 private String userId; //设置字段类型通过@Column注解设置,包含的设置如下 //name:字段名 //unique:是否唯一 //nullable:是否可以为空 //inserttable:是否可以插入 //updateable:是否可以更新 //columnDefinition: 定义建表时创建此列的DDL //secondary…
Java泛型接口
package me.cjx.example; interface Demo<T> { public void print(T param); } // 实现泛型接口一 class Imple1<T> implements Demo<T> { public void print(T param) { System.out.println("param = " + param); } } // 实现泛型接口二 class Imple2 implements Demo<Imple2> { public void print(Imple2 param) { System.out.println("…
2012-09-16 17:40 · java
Windows中Java连接Access数据库
1、直接在Java代码内部Access数据库 package me.cjx.example; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.Statement; import java.util.Properties; public class ReadMDB { public static void main(String[] args) { try { Strin…
maven使用时发生tools.jar错误
在Maven使用时会发生tools.jar这个包错误,查看Build Path发指指向的不是jdk1.6的,而是指向了1.5的。 12-7-26 下午05时01分20秒: Build errors for show; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project show: Could not resolve dependencies for project com.test:show:war:0.0.1-SNAPSHOT: Could not find ar…
2012-07-26 22:59 · java
maven最基本的建项目和运行
建一个空的普通app项目 mvn archetype:create -B -DgroupId=net.jwsz.snap -DartifactId=snap /* //Create Maven Applaction Project mvn archetype:create -B -DgroupId=net.jwsz.snap -artifactId=snap //Run Maven Application mvn clean compile exec:java -Dexec.mainClass="net.jwsz.snap.App" // mvn exec:java -Dexec.mainC…
2012-06-04 08:19 · java
Java获得客户端真实IP
获得客户端真实IP地址的方法一: public String getRemortIP(HttpservletRequest request) { if (request.getHeader("x-forwarded-for") == null) { return request.getRemoteAddr(); } return request.getHeader("x-forwarded-for"); } 获得客户端真实IP地址的方法二: public String getIpAddr(HttpservletRequest request) { String ip = request.ge…
2012-05-28 19:57 · java
APK反编译
反编译apk 一、更改apk文件的后缀名,如:citymap.apk改成citymap.zip 二、用zip解压缩citymap.zip文件 三、从解压缩的文件夹中取出classes.dex文件,放到dex2jar.bat所在目录 四、用命令"dex2jar.bat classes.dex"即可生成classes.dex.dex2jar.jar文件 五、用JD-GUI工具打开classes.dex.dex2jar.jar文件,即可看到源码 六、将AndroidManifest.xml文件放到AXMLPrinter2.jar所在目录,运行cmd命令,进入AXMLPrinter2.jar所在目录…
2010-10-14 14:35 · java
GIS
============================Linux============================================================================================================================== GDAL 地理空间数据抽象库 http://www.gdal.org/ Proj 重投影地理数据组件库 http://trac.osgeo.org/proj/ Geos 开源几何引擎 GeometryEngineOpenSource,GEOS http://www.jump-p…
2010-05-18 17:11 · java
HP大中华区总裁孙振耀职场九大感言
如果这篇文章没有分享给你,那是我的错。 如果这篇文章分享给你了,你却没有读,继续走弯路的你不要怪我。 如果你看了这篇文章,只读了一半你就说没时间了,说明你已经是个“茫”人了。 如果你看完了,你觉得这篇文章只是讲讲大道理,说明你的人生阅历还不够,需要你把这篇文章珍藏,走出去碰几年壁,头破血流后再回来,再读,你就会感叹自己的年少无知。 如果你看完了,觉得很有道理,然后束之高阁,继续走进拥挤的地铁,依然用着自己昨日的观念来思考自己的未来,你的人生也将继续重复着昨日的状况。 如果你看完了,觉得那是一个过来人,对你的人生忠告,并你也愿意用他告诉你的思想去指导自己今后的生活,对你来讲成功不是很难,难的是…
2010-03-21 22:05 · java
nexus服务搭建
1. 下载Nexus 2.解压即可 配置文件($nexus_path/conf/plexus.properties): application-port=8081 application-host=0.0.0.0 runtime=${basedir}/runtime apps=${runtime}/apps nexus-work=${basedir}/../sonatype-work/nexus webapp=${runtime}/apps/nexus/webapp webapp-context-path=/nexus security-xml-file=${nexus-work}/conf…
2010-02-22 01:18 · java
Maven DOS
安装Maven,跟装ant一样,官方网站http://maven.apache.org 建立项目骨架,开一个console命令行窗口,输入以下命令: mvn archetype:create -DgroupId=com.javaeye.xml.webapp -DartifactId=cjxweb -DarchetypeArtifactId=maven-archetype-webapp 简单解释一下: archetype 是一个内建插件,他的create任务将建立项目骨架 archetypeArtifactId 项目骨架的类型 可用项目骨架有: * maven-archetype-archet…
2010-02-21 15:58 · java
开发工具信息备份
/ ===================================================== Name :Project Author :ChenJianxiang Version :1.0 Copyright :zkx.me Description :开发环境所需工具URL地址,最后更新2012年7月18日 ====================================================== / ** Java Platform : Java Platform (JDK) ========Eclipse plugins===============…
2010-01-30 05:42 · java
HttpComponents
HttpComponents 概述 超文本传输协议(HTTP)可能是当今Internet上使用的最重要的协议。除了用户驱动的web浏览器外,Web服务、使用网络的设备、网络计算的增长扩展了HTTP协议的角色,然而不断增加的应用也需要HTTP支持。 在为基本的HTTP协议提供强有力的的支持时,提供设计上的扩展,任何创建基于HTTP协议的客户和服务程序(web浏览器、web爬虫、HTTP代理、WEB服务传输库、补充或者扩展HTTP协议的分布式传输系统)的用户,可能会对HttpComponents产生兴趣。 Commons HttpClient Jakarta HttpComponents项目承担…
2009-12-10 12:58 · java