File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes how to Import a program from another folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to Import a program from another folder " Watch "how to Import a program from another folder " New topic

how to Import a program from another folder

saravanan rajendran
Ranch Hand

Joined: Jun 13, 2008
Posts: 75
i have 2 program in different folder exists in below folder

/usr/local/apache-tomcat/webapps/Asianet/WEB-INF/classes/com/example/servlets/program1 exists in below folder



package com.example.servlets does not exist
import com.example.servlets.*;
i getting above error i cannot find what error guide me

[edit]Add code tags. CR[/edit]
[ August 19, 2008: Message edited by: Campbell Ritchie ]
Rob Spoor

Joined: Oct 27, 2005
Posts: 19538

Set the classpath to include the folder where your "com" folder is located. That would be /usr/local/apache-tomcat/webapps/Asianet/WEB-INF/classes in your case.

How To Ask Questions How To Answer Questions
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 36453
As Rob says, you need to include the folder in the classpath, probably best done with the -cp option on javac and java. Go to this documentation page and click on "javac" and "java" for more details.

And please find the Code Tags; I have added them to your post so you can see how much easier it is to read.
I agree. Here's the link:
subject: how to Import a program from another folder
Similar Threads
import problems (package does not exist)
compiling package program error
pass servlet value into java program it is in different application
how to compile
what classpath export to compile asterisk java code