-   Programming (
-   -   java - package does not exist error (

epoo 06-04-2007 11:41 PM

java - package does not exist error
I'm trying to compile a program I'm writing using a file for one of the classes.

here's my file

public class menu
{ void storage()
  {  System.out.println("storage");

and here's the java file with the main method:


import menu.*;
public class test
{  menu menu1 = new menu();
  public static void main(String[] args)
  { System.out.println("test");

and I'm getting the error

Code: package menu does not exist
I've exported the classpath, "echo $CLASSPATH" shows ":/home/epoo/game/:./"

Any ideas?

paulsm4 06-05-2007 12:53 AM

Just comment out the "import menu.*", recompile - and Life should be Good

Here's a very good tutorial that explains the relationship between "package", "import statements" ... and how you need to put your class files in different subdirectories if you decide you need to use packages:

epoo 06-05-2007 01:21 AM

Ahh, I see. That worked, thanks.
I'm having a hard time understanding the difference between static and non-static methods and variables - got any good tutorials for that ?

All times are GMT -5. The time now is 11:09 PM.