The Artima Developer Community
Sponsored Link

Java Answers Forum
How can I do next step of entering user name and password?

3 replies on 1 page. Most recent reply: Sep 17, 2002 11:33 AM by Sid Northfield

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Sid Northfield

Posts: 20
Nickname: northfield
Registered: Aug, 2002

How can I do next step of entering user name and password? Posted: Sep 16, 2002 2:34 AM
Reply to this message Reply
Advertisement
I want to send ftp or telnet commands on the Unix command box. I want to connect to say ftp enter user name and password and then run "ls" command

Here is what I have written so far, code to ftp.
But when I run the program I do not know what has happened? How can I do the next stage like enter "user name" "password" and finally run "ls" command for unix?????????
import java.lang.*;
import java.io.*;

public class RuntimeFTP{

public static void main(String[] arg){
Runtime rt = Runtime.getRuntime();
String[] callAndArgs = { "ftp.exe", "jaguar.wmin.ac.uk" };

try
{
Process child = rt.exec(callAndArgs);
child.waitFor();
System.out.println("Process exit code is: " + child.exitValue() );
}
catch(IOException e)
{
System.err.println("IOException starting process!");
}
catch(InterruptedException e)
{
System.out.println("Interrupted waiting for process!");
}
}
}


Sid Northfield

Posts: 20
Nickname: northfield
Registered: Aug, 2002

Re: How can I do next step of entering user name and password? Posted: Sep 16, 2002 5:39 PM
Reply to this message Reply
I have decided to study ftp or telnet program so thus I will be able to use in my own program. I have done search on the web and books but I think I am not a good searcher on the search engine.

Perhaps on of the Java Gurus may know of such links. I would be greatful for any links on ftp or telnet java program with source code, preferably one with easy to understand code.

Thanks in advance.

Don Hill

Posts: 70
Nickname: ssswdon
Registered: Jul, 2002

Re: How can I do next step of entering user name and password? Posted: Sep 17, 2002 6:54 AM
Reply to this message Reply
try this

http://www.afu.com/jdownload.html

Sid Northfield

Posts: 20
Nickname: northfield
Registered: Aug, 2002

Re: How can I do next step of entering user name and password? Posted: Sep 17, 2002 11:33 AM
Reply to this message Reply
Don,

Thank you very much for the url link

I want to integrate an ftp program into a program I am working on. Thanks to Don I am able reuse code by using "t or Linlyn ftp program" which claims to be easily integrateable into larger applications.


The problem is did does not seem to work and gives me errors. I would be grateful if someone could tell me why I am getting the error, here is the error:

C:\My_DL_Dap\ftp in java>appletviewer t.java
Warning: <applet> tag requires width attribute.
java.security.AccessControlException: access denied (java.net.SocketPermission j
aguar.wmin.ac.uk resolve)
at java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:2 70)
at java.security.AccessController.checkPermission(AccessController.java:
401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)
at java.net.InetAddress.getAllByName0(InetAddress.java:909)
at java.net.InetAddress.getAllByName0(InetAddress.java:890)
at java.net.InetAddress.getAllByName(InetAddress.java:884)
at java.net.InetAddress.getByName(InetAddress.java:814)
at java.net.InetSocketAddress.<init>(InetSocketAddress.java:109)
at java.net.Socket.<init>(Socket.java:118)
at Linlyn.ftpConnect(t.java:326)
at Linlyn.<init>(t.java:236)
at t.init(t.java:83)
at sun.applet.AppletPanel.run(AppletPanel.java:341)
at java.lang.Thread.run(Thread.java:536)


I would also be grateful if someone could try out the propgram and tell me if it works for them, then I could determine if it is because ftp clients are being blocked by my server. The ftp program is very small, here is the url link again:

http://www.afu.com/jdownload.html

1) compile the code
2) fill in everywhere it requests "your-server" "username" and "password"
3) to run appletviewer t.java

Flat View: This topic has 3 replies on 1 page
Topic: '{' expected .. error. Need Help With This Code. Previous Topic   Next Topic Topic: Resize frame

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use