如题所述
第1个回答 推荐于2016-09-02
你首先要知道上传的文件放在那个目录下(假设 /usr/myhome/upload)。
然后
cd /usr/myhome
ls -l
看 upload目录的权限是否是 rwxrwxr-x
如果前3个字母没有w,就没有操作权限, 可以使用chmod 755 upload 或者chmod 775 增加写权限。来自:求助得到的回答本回答被提问者采纳
然后
cd /usr/myhome
ls -l
看 upload目录的权限是否是 rwxrwxr-x
如果前3个字母没有w,就没有操作权限, 可以使用chmod 755 upload 或者chmod 775 增加写权限。来自:求助得到的回答本回答被提问者采纳
第1个回答 推荐于2016-09-02
Java Exception 用法:下面的实例是一个loadUser方法,我们将抛出自定义的UserNotFoundException异常。
public class UserManager {
public User loadUser(String username) throws UserNotFoundException {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_USER);
pstmt.setString(1, username);
ResultSet rs = pstmt.executeQuery();
if (!rs.next()) {
throw new UserNotFoundException();
}
…
}
…
}
}
public class UserNotFoundException extends Exception {
private Throwable nestedThrowable = null;
public UserNotFoundException() {
super();
}
public UserNotFoundException(String msg) {
super(msg);
}
…
}
public class test {
…
public void testloadUser(String userName,String password,
String name,String email){
…
try {
loadUser(username);
}
catch (UserNotFoundException unfe) {
…
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(INSERT_USER);
pstmt.setString(1, username);
pstmt.setString(2, password);
…
pstmt.execute();
}
catch (Exception e)
…
}
这个貌似是手机JAVA信息吧
public class UserManager {
public User loadUser(String username) throws UserNotFoundException {
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_USER);
pstmt.setString(1, username);
ResultSet rs = pstmt.executeQuery();
if (!rs.next()) {
throw new UserNotFoundException();
}
…
}
…
}
}
public class UserNotFoundException extends Exception {
private Throwable nestedThrowable = null;
public UserNotFoundException() {
super();
}
public UserNotFoundException(String msg) {
super(msg);
}
…
}
public class test {
…
public void testloadUser(String userName,String password,
String name,String email){
…
try {
loadUser(username);
}
catch (UserNotFoundException unfe) {
…
Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(INSERT_USER);
pstmt.setString(1, username);
pstmt.setString(2, password);
…
pstmt.execute();
}
catch (Exception e)
…
}
这个貌似是手机JAVA信息吧
第2个回答 2010-12-15
好像是你无权限操作啊,是不是你操作的文件没有权限啊,你的代码贴出看看呢本回答被网友采纳