Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 06-04-2007, 10:41 PM   #1
Registered: Aug 2003
Distribution: slackware 11, ubuntu 7.04
Posts: 165

Rep: Reputation: 30
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?
Old 06-04-2007, 11:53 PM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
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:

Last edited by paulsm4; 06-04-2007 at 11:55 PM.
Old 06-05-2007, 12:21 AM   #3
Registered: Aug 2003
Distribution: slackware 11, ubuntu 7.04
Posts: 165

Original Poster
Rep: Reputation: 30
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 ?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Yum Error: Transaction Check Error package x(which is newer than package y)... godsk Linux - Newbie 0 06-05-2006 07:13 AM
Tomcat: package javax.servlet does not exist xpucto Linux - Software 0 03-21-2006 06:45 AM
Synaptic Package Manager shows 'java-common' and 'java-gcj-compat' as Installed. swiadek Ubuntu 3 02-12-2006 11:54 AM
How to install MPlayer? Doesn't exist package? Mathsniper Debian 1 06-29-2005 05:19 AM
Java can't find package, but PATH set correctly (j2se1.4.0, java.util.regex package) Ethan Programming 5 02-06-2004 09:55 PM

All times are GMT -5. The time now is 07:38 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration