Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 553
  • Last Modified:

Import the Class Library

Hi all experts,

I downloaded a java FTP client library from enterprisedt.com. But I don't know how to import it to my j2sdk 1.4.1 library. The doc of this distributor show me that it can use the code likes :

package com.enterprisedt.net.ftp;

import com.enterprisedt.net.ftp.FTPClient;

But it, I may be have some mistake here, is not successful. Could anyone help me ?  

Thanks

Gary
0
garypingkei
Asked:
garypingkei
  • 3
  • 2
1 Solution
 
antons061400Commented:
You need to read some tutorial about Java.
0
 
garypingkeiAuthor Commented:
To antons,

Yes. You are right. I am a beginner. So I am reading a book call Teach yourself Java 2 in 21 days. I read to day 7 talking about applet.

But I really interest in writing a FTP client using java, may be you are also have this stage a long time before. It is something you want to do but you don't know much. I let, may be, it be a pressure to develop myself quickly.

Anyway, thank for your advice and would like to have more your comments on this issue, since I think it is just a easy questions in your knowledge.
0
 
antons061400Commented:
I'm sorry, that I was intolerable to you.

The question is easy, but answer is complicated. Hard to say where to start.

The recomendation for tutorial is OK I think. Something like http://java.sun.com/docs/books/tutorial


to your current code, you just post

package com.enterprisedt.net.ftp;
import com.enterprisedt.net.ftp.FTPClient;

can be compiled, if your class with this code is in the directory com/enterprisedt/net/ftp and the ftpclient.jar is the requested library you can start the compilation like
CLASSPATH=$CLASSPATH:ftpclient.jar
CLASSPATH=$CLASSPATH:.

javac com/enterprisedt/net/ftp/*.java

or on windows platform
set CLASSPATH=%CLASSPATH%;ftpclient.jar
set CLASSPATH=%CLASSPATH%;.

javac com\enterprisedt\net\ftp\*.java


0
 
garypingkeiAuthor Commented:
To : antons,

Hey..friend..You are not intolerable me...Nice to meet you here.

From your help..I understand now..Sound like something set path in DOS and I can compile my code properly. But I have another problems. As now, my class is inside c:\ftp-1.2.1\src\com\enterprise\net\ftp, so I run it like :

java -cp c:\ftp-1.2.1\src com.enterprise.net.ftp.myftp

**(myftp is my class name)

if I want to put my class into c:\myjava\ instead, how can I run then ?

0
 
antons061400Commented:
you simply copy the directory structure com\.... to the c:\myjava. so you will have something like c:\myjava\com\...

Note: The directory structure com/... reflescts statement package com.enterprise.net.ftp;

Note: In your classpath you mast have all libraries you want to use so something like

java -cp c:\myjava;c:\ftp-1.2.1\lib\ftp.jar com.enterprise.net.ftp.myftp

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now