?
Solved

Java Packages

Posted on 2003-03-26
5
Medium Priority
?
215 Views
Last Modified: 2010-03-31
So I have a folder called "Sandra" and in that folder I have three .java files.
All begin with package sandra; and one of them wants to use some of the stuff in another, so I say import sandra.other;
However this is generating a compile error saying that it can't resolve the symbol, pointing to the name of the class I am trying to import.
Have I just configured my ide incorrectly? I am just using Textpad since the work I am doing is supposedly really simple...
0
Comment
Question by:Redbirdofthesouth
  • 3
5 Comments
 
LVL 92

Accepted Solution

by:
objects earned 300 total points
ID: 8215334
1. you do not need to import classes in the same package.

2. the parent folder of sandra should be included in your classpath
0
 

Expert Comment

by:evimal
ID: 8215398
Hi

 for ex,
  one.java,two.java,three.java all belongs to same package called "package sundar;".

 If u want to call a function in "two" from "Three", then try to declare that all these classes are public. and u can call without any import command.


the code should be lie this

package sundar;

public class one{}
----------
package sundar;

public class two
{
static void print()
{
  system.out.println("Works fine");
}
}
-----------
package sundar;

public class three{

p.s.v.m (String s[])
{
   two.print();
}
}

----------------
0
 
LVL 92

Expert Comment

by:objects
ID: 8215410
:-)
0
 

Author Comment

by:Redbirdofthesouth
ID: 8215576
I barely scraped through my file io class.
I have downloaded Marty Hall's ProtectedPage files from Core Servlets and JSP, and am attempting to run them.
I've added the appropriate files to my web.xml file.
I am getting a null pointer exception from Tomcat:
java.lang.NullPointerException
     at java.io.File.(File.java:180)
     at java.io.FileInputStream.(FileInputStream.java:66)
I did make the file output point to an appropriate location on MY computer.
It seems to me that I would need to run the  password builder file first but when I did I just get a thread exception...
0
 
LVL 92

Expert Comment

by:objects
ID: 8215697
looks like u are passing a null filname.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Don’ts and Dos are two important end products of software testing basics that a tester needs to regard. This article attempts to explain the principles of both.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question