JSch jsch = null;
Session session = null;
Channel channel = null;
ChannelSftp c = null;
try{
System.out.println("Checking for Projects Directory");
jsch = new JSch();
session = jsch.getSession(puser, pserver, pport);
session.setPassword(ppassword);
java.util.Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();
channel = session.openChannel("sftp");
channel.connect();
c = (ChannelSftp) channel;
c.mkdir("/home/" + puser + "/Projects/");
}
catch (Exception ex){
System.out.println("Error locating Projects Folder: " + ex.getStackTrace() + ex.getMessage());
System.out.println("Could not make project on server. Please restart the program.");
}