No error is given. Did you check the Java Console?
In order for an applet to perform these operations, it must be a "signed
applet".
Youssef Aoun wrote:
Hello,
I am developing a Java SSH forwarding. I am launching it from a
command line where it works and from an Applet where IT'S NOT WORKING
here is the code:
I am imagining that due to JVM security, my applet is not working.
- Output
Connected
8888:schwaz.lan.aleks.com:22
Forward 0 : 8888:schwaz:22
Forward 1 : 9999:schwaz:80
- NO ERROR MESSAGES ARE GIVEN
===================================================
package vpn;
import java.applet.*;
import java.awt.*;
import com.jcraft.jsch.*;
public class VPN implements UserInfo {
int lport = 8888;
String rhost = "schwaz";
int rport = 22;
public VPN() {
try{
JSch jsch=new JSch();
Session session=jsch.getSession("aoun",
"schwarz.lan.aleks.com", 22);
session.setUserInfo(this);
session.connect();
if(session.isConnected()){
System.out.println("Connected");
System.out.print(this.lport+":"+this.rhost+":"+this.rport+"\n");
session.setPortForwardingL("0.0.0.0",
this.lport, this.rhost, this.rport);
session.setPortForwardingL("0.0.0.0",
9999, this.rhost, 80);
String[] tab =
session.getPortForwardingL();
for(int i=0;i<tab.length;i++){
System.out.println("Forward
"+i+" : "+tab[i]);
}
}
else {
System.out.println("Connection failed");
}
}
catch(Exception e){
System.out.println(e);
}
}
public void paint( Graphics g ) {
}
public String getPassword(){ return "mypassword"; }
public boolean promptYesNo(String str){ return true;}
public void showMessage(String message){
System.out.println(message);};
public boolean promptPassphrase(String message){ return false; }
public boolean promptPassword(String message){ return true;}
public String getPassphrase(){ return null; }
}
===========================================================
package vpn;
import java.awt.*;
public class VPNCmd {
public static void main(String[] args){
VPN vpn = new VPN();
}
}
=============================================================
package vpn;
import java.applet.*;
import java.awt.*;
public class VPNApplet extends Applet {
public void init() {
VPN vpn = new VPN();
}
public void paint( Graphics g ) {
}
}
------------------------------------------------------------------------
Want to do more with Windows Live? Learn “10 hidden secrets” from
Jamie. Learn Now
<http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns%21550F681DAD532637%215295.entry?ocid=TXT_TAGLM_WL_domore_092008>
------------------------------------------------------------------------
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
------------------------------------------------------------------------
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users