jbuild怎么配置debug环境,急,在线等 象jbuilder之类的东西,你没运行就会提示没有包了。在工程的属性里导入你所需要的包。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Tools-->Configure Libraries--->点New...-->(New Library Wizard)Name:(你自己命名),Location:默认-->点Add(选择你的jar)-->点OK-->点OK或者project->project properties->required libiaries->add package pm.util;import java.sql.*;import java.util.Vector;import java.util.Date;import pm.db.DBConnection;import pm.util.Tools;import pm.initialize.Dept;public class Remind { /** * 数据库连接对象 */ private DBConnection con; /** * 数据结果集对象 */ private ResultSet result; /** * 记录提醒转向的URL */ private Vector url ; /** * 记录提醒信息 */ private Vector remindMsg ; /** * 获得提醒转向的URL */ public Vector getUrl(){ return url; } /** * 获得提醒信息 */ public Vector getRemindMsg(){ return remindMsg; } /** * 记录报错信息 */ private String errMsg = ""; /** * 获得报错信息 */ public String getErrmsg(){ return errMsg; } /** *获得库存中超额和差额的备件种类 * @return 返回预警的备件种类信息 */ private Vector getSpare(){ Vector vc = new Vector(); String sql = "select sp_sparetype from pm_spare where sp_stock > sp_max or sp_stock < sp_min order by sp_id"; try{ con = new DBConnection(); result = con.executeQuery(sql); while (result.next()){ vc.add(result.getString(1)); } result.close(); }catch (SQLException e){ errMsg = e.toString(); vc = null; }catch (Exception e){ errMsg = e.toString(); vc = null; }finally{ con.destroy(); return vc; } } /** * 获得有请购信息的管理处 * @return 管理处信息 */ private Vector getBuy(){ Vector vc = new Vector(); String sql = "select ba_subcorp from pm_buyapply where ba_state =0 "; try{ con = new DBConnection(); result = con.executeQuery(sql); while (result.next()){ vc.add(result.getString(1)); } result.close(); }catch(SQLException e){ errMsg = e.toString(); vc = null; }catch(Exception e){ errMsg = e.toString(); vc = null; }finally{ con.destroy(); return vc; } } /** * 获得到期提醒的房间租赁信息 * @param building 楼栋序号 * @return */ private Vector getTenancy (){ Vector vc = new Vector(); Vector tmp = new Vector(); StringBuffer sql = new StringBuffer(); try{ con = new DBConnection(); //获得房间的租赁信息 sql = new StringBuffer(); sql.append("select d.ro_building,a.te_room,a.te_begindate,a.te_enddate,"). append(" from pm_tenancy a,pm_client b,pm_feegettype c,pm_room d"). append(" where a.te_room=d.ro_code and a.te_client=b.cl_code and a.te_calcfee=c.ft_id "). append(" and d.ro_hirestate=2 and a.te_quit=0"). append(" order by a.te_room,a.te_id desc"); result = con.executeQuery(sql.toString()); while(result.next()){ tmp.add(Tools.formatRoomno(result.getString(1))); tmp.add(result.getString(2)); tmp.add(Tools.formatDate(result.getDate(3))); tmp.add(result.getDate(4)); } result.close(); java.util.Date enddate; java.util.Date now = Tools.formatString(Tools.getNowString()); int days = 0; for(int i=0;i<tmp.size();i=i+4){ enddate = (java.util.Date)tmp.get(i+3); days = Tools.getDay(enddate,now); if(enddate.compareTo(now) < 1 || days <= 7){ vc.add(tmp.get(i)); vc.add(tmp.get(i+1)); vc.add(tmp.get(i+2)); vc.add(Tools.formatDate((java.util.Date)tmp.get(i+3))); if(enddate.compareTo(now) < 1 || days <= 3){ vc.add("1"); }else{ vc.add("0"); } vc.add(tmp.get(i+4)); } enddate = null; days = 0; } }catch(SQLException e){ errMsg = e.toString(); vc = null; }catch(Exception e){ errMsg = e.toString(); vc = null; }finally{ con.destroy(); return vc; } } /** * 获得有报修提醒的房间 * @return 有报修房间的信息 */ private Vector getRepair(){ Vector vc = new Vector(); String sql = "select sm_room from pm_servicemission where sm_state =0"; try{ con = new DBConnection(); result = con.executeQuery(sql); while(result.next()){ vc.add(result.getString(1)); } result.close(); }catch(SQLException e){ errMsg = e.toString(); vc = null; }catch(Exception e){ errMsg = e.toString(); vc = null; }finally{ con.destroy(); return vc; } } /** * 获得提醒信息和转向URL * @return 返回true有提醒信息,返回false没有任何提醒信息 */ public boolean isRemind (String user){ Vector tmpvc = new Vector(); String tmpUrl = ""; String tmpRemindMsg = ""; boolean tempstate1 = false; boolean tempstate2 = false; boolean state = false; Dept dept = new Dept(); String dpt = ""; String sql = "select us_dept from pm_user where us_login ='"+ user +"'"; try{ result = con.executeQuery(sql); while(result.next()){ dpt = result.getString(1); result.close(); } if(dept.getDept(dpt)){ dpt = dept.getName(); } //根据不同的部门检查不同的提示信息 if(dpt.equals("工程部")){ tmpvc = getSpare(); if(tmpvc.size() != 0){ tmpUrl = "/pm_equipment/index.jsp?module1=4&module2=7&id=" + tmpvc.get(1).toString()+"& kind = null"; tmpRemindMsg = "库存备件预警"; this.remindMsg.add(tmpRemindMsg); this.url.add(tmpUrl); tempstate1 = true; } else{ tempstate1 = false; } tmpvc = getBuy(); if(tmpvc.size() != 0){ tmpUrl = "/pm_equipment/index.jsp?module1=4&module2=14&subcorp=" + tmpvc.get(1).toString(); tmpRemindMsg = "有新的请购"; this.remindMsg.add(tmpRemindMsg); this.url.add(tmpUrl); tempstate2 = true; } else{ tempstate2 = false; } if(tempstate1||tempstate2){ state = true; }else{ state = false; } }else if(dpt.equals("租售部")){ tmpvc = getTenancy(); if(tmpvc.size() != 0){ tmpUrl = "/pm_tenancy/index.jsp?module1=2&module2=5&building=" + tmpvc.get(1).toString(); tmpRemindMsg = "有租约到期的房间"; this.remindMsg.add(tmpRemindMsg); this.url.add(tmpUrl); state = true; } else{ state = false; } }else if(dpt.equals("服务部")){ tmpvc = getRepair(); if(tmpvc.size() != 0){ tmpUrl = "/pm_service/index.jsp?module1=2&module2=4&room=" + tmpvc.get(1).toString(); tmpRemindMsg = "有新的报修单"; this.remindMsg.add(tmpRemindMsg); this.url.add(tmpUrl); state = true; } else{ state = false; } } }catch(SQLException e){ errMsg = e.toString(); state = false; }catch(Exception e){ errMsg = e.toString(); state = false; }finally{ con.destroy(); return state; } } public static void main(String[] args){ Remind remind = new Remind(); String usr = "ww"; if(remind.isRemind(usr)){ System.out.println("ok"); } }}执行到String sql = "select us_dept from pm_user where us_login ='"+ user +"'"; try{ result = con.executeQuery(sql);就出现了java.lang.NullPointerExcetion大虾估计是什么原因那? new String转码问题 struts2 标签 select hibernate与displaytag 的整合问题 XMLDOM XMLHTTP的问题? 上传照片的按钮怎么编写,需要什么控件吗 小问题 多字段查询合适的方法或类 初学者 resin 中文问题 hibernate 报错!!!!!!!!! 如何判断某个日期是不是合法日期?还有怎么知道某年某月某日是星期几? 关于表单提交的问题 请问,我在数据库里建了个表。其中有个money类型的字段,在java 中应该用什么方法显示?get?()
或者
project->project properties->required libiaries->add
import java.util.Vector;
import java.util.Date;
import pm.db.DBConnection;
import pm.util.Tools;
import pm.initialize.Dept;public class Remind {
/**
* 数据库连接对象
*/
private DBConnection con; /**
* 数据结果集对象
*/
private ResultSet result;
/**
* 记录提醒转向的URL
*/
private Vector url ; /**
* 记录提醒信息
*/
private Vector remindMsg ; /**
* 获得提醒转向的URL
*/
public Vector getUrl(){
return url;
} /**
* 获得提醒信息
*/
public Vector getRemindMsg(){
return remindMsg;
}
/**
* 记录报错信息
*/
private String errMsg = ""; /**
* 获得报错信息
*/
public String getErrmsg(){
return errMsg;
} /**
*获得库存中超额和差额的备件种类
* @return 返回预警的备件种类信息
*/
private Vector getSpare(){
Vector vc = new Vector();
String sql = "select sp_sparetype from pm_spare where sp_stock > sp_max or sp_stock < sp_min order by sp_id";
try{
con = new DBConnection();
result = con.executeQuery(sql);
while (result.next()){
vc.add(result.getString(1));
}
result.close();
}catch (SQLException e){
errMsg = e.toString();
vc = null;
}catch (Exception e){
errMsg = e.toString();
vc = null;
}finally{
con.destroy();
return vc;
}
} /**
* 获得有请购信息的管理处
* @return 管理处信息
*/
private Vector getBuy(){
Vector vc = new Vector();
String sql = "select ba_subcorp from pm_buyapply where ba_state =0 ";
try{
con = new DBConnection();
result = con.executeQuery(sql);
while (result.next()){
vc.add(result.getString(1));
}
result.close();
}catch(SQLException e){
errMsg = e.toString();
vc = null;
}catch(Exception e){
errMsg = e.toString();
vc = null;
}finally{
con.destroy();
return vc;
}
} /**
* 获得到期提醒的房间租赁信息
* @param building 楼栋序号
* @return
*/
private Vector getTenancy (){
Vector vc = new Vector();
Vector tmp = new Vector();
StringBuffer sql = new StringBuffer();
try{
con = new DBConnection(); //获得房间的租赁信息
sql = new StringBuffer();
sql.append("select d.ro_building,a.te_room,a.te_begindate,a.te_enddate,").
append(" from pm_tenancy a,pm_client b,pm_feegettype c,pm_room d").
append(" where a.te_room=d.ro_code and a.te_client=b.cl_code and a.te_calcfee=c.ft_id ").
append(" and d.ro_hirestate=2 and a.te_quit=0").
append(" order by a.te_room,a.te_id desc");
result = con.executeQuery(sql.toString());
while(result.next()){
tmp.add(Tools.formatRoomno(result.getString(1)));
tmp.add(result.getString(2));
tmp.add(Tools.formatDate(result.getDate(3)));
tmp.add(result.getDate(4)); }
result.close(); java.util.Date enddate;
java.util.Date now = Tools.formatString(Tools.getNowString());
int days = 0;
for(int i=0;i<tmp.size();i=i+4){
enddate = (java.util.Date)tmp.get(i+3);
days = Tools.getDay(enddate,now);
if(enddate.compareTo(now) < 1 || days <= 7){
vc.add(tmp.get(i));
vc.add(tmp.get(i+1));
vc.add(tmp.get(i+2));
vc.add(Tools.formatDate((java.util.Date)tmp.get(i+3))); if(enddate.compareTo(now) < 1 || days <= 3){
vc.add("1");
}else{
vc.add("0");
}
vc.add(tmp.get(i+4));
}
enddate = null;
days = 0;
}
}catch(SQLException e){
errMsg = e.toString();
vc = null;
}catch(Exception e){
errMsg = e.toString();
vc = null;
}finally{
con.destroy();
return vc;
}
} /**
* 获得有报修提醒的房间
* @return 有报修房间的信息
*/
private Vector getRepair(){
Vector vc = new Vector();
String sql = "select sm_room from pm_servicemission where sm_state =0";
try{
con = new DBConnection();
result = con.executeQuery(sql);
while(result.next()){
vc.add(result.getString(1));
}
result.close();
}catch(SQLException e){
errMsg = e.toString();
vc = null;
}catch(Exception e){
errMsg = e.toString();
vc = null;
}finally{
con.destroy();
return vc;
}
} /**
* 获得提醒信息和转向URL
* @return 返回true有提醒信息,返回false没有任何提醒信息
*/
public boolean isRemind (String user){
Vector tmpvc = new Vector();
String tmpUrl = "";
String tmpRemindMsg = "";
boolean tempstate1 = false;
boolean tempstate2 = false;
boolean state = false; Dept dept = new Dept();
String dpt = "";
String sql = "select us_dept from pm_user where us_login ='"+ user +"'";
try{
result = con.executeQuery(sql);
while(result.next()){
dpt = result.getString(1);
result.close();
}
if(dept.getDept(dpt)){
dpt = dept.getName();
} //根据不同的部门检查不同的提示信息 if(dpt.equals("工程部")){
tmpvc = getSpare();
if(tmpvc.size() != 0){
tmpUrl = "/pm_equipment/index.jsp?module1=4&module2=7&id=" + tmpvc.get(1).toString()+"& kind = null";
tmpRemindMsg = "库存备件预警";
this.remindMsg.add(tmpRemindMsg);
this.url.add(tmpUrl);
tempstate1 = true;
} else{
tempstate1 = false;
}
tmpvc = getBuy();
if(tmpvc.size() != 0){
tmpUrl = "/pm_equipment/index.jsp?module1=4&module2=14&subcorp=" + tmpvc.get(1).toString();
tmpRemindMsg = "有新的请购";
this.remindMsg.add(tmpRemindMsg);
this.url.add(tmpUrl);
tempstate2 = true;
} else{
tempstate2 = false;
}
if(tempstate1||tempstate2){
state = true;
}else{
state = false;
} }else if(dpt.equals("租售部")){ tmpvc = getTenancy();
if(tmpvc.size() != 0){
tmpUrl = "/pm_tenancy/index.jsp?module1=2&module2=5&building=" + tmpvc.get(1).toString();
tmpRemindMsg = "有租约到期的房间";
this.remindMsg.add(tmpRemindMsg);
this.url.add(tmpUrl);
state = true;
} else{
state = false;
}
}else if(dpt.equals("服务部")){
tmpvc = getRepair();
if(tmpvc.size() != 0){
tmpUrl = "/pm_service/index.jsp?module1=2&module2=4&room=" + tmpvc.get(1).toString();
tmpRemindMsg = "有新的报修单";
this.remindMsg.add(tmpRemindMsg);
this.url.add(tmpUrl);
state = true;
} else{
state = false;
}
}
}catch(SQLException e){
errMsg = e.toString();
state = false;
}catch(Exception e){
errMsg = e.toString();
state = false;
}finally{
con.destroy();
return state;
}
}
public static void main(String[] args){
Remind remind = new Remind();
String usr = "ww";
if(remind.isRemind(usr)){
System.out.println("ok");
}
}
}执行到String sql = "select us_dept from pm_user where us_login ='"+ user +"'";
try{
result = con.executeQuery(sql);
就出现了java.lang.NullPointerExcetion
大虾估计是什么原因那?