Jump to content

Problem in compiling package

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
thatsme

thatsme

    Programmer

  • Members
  • PipPipPipPip
  • 176 posts
Hi, i have a Main.java file:

import Football.StadiumWorker;
import Football.FootballMatch;
import Football.Menu;
import java.util.LinkedList;

public class Main
{
...
}

Then in the same place where is Main.java file i have folder Football with four files in it:

FootballStadium.java:

package Football;

import java.util.LinkedList;

class FootballStadium
{
...
}

StadiumWorker.java:

public package Football;

import java.util.LinkedList;


public class StadiumWorker
{
...
}

FootballMatch.java:

package Football;

import java.util.Random;

public class FootballMatch
{
...
}

Menu.java:

package Football;

import java.util.LinkedList;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.lang.NumberFormatException;

public class Menu
{
...
}

I try to compile that on linux using command javac Main.java, but get sucg erros:

./Football/StadiumWorker.java:1: class, interface, or enum expected
public package Football;
^
Main.java:1: cannot access Football.StadiumWorker
bad class file: ./Football/StadiumWorker.java
file does not contain class Football.StadiumWorker
Please remove or make sure it appears in the correct subdirectory of the classpath.
import Football.StadiumWorker;

By the way when i work on windows xp in eclipse IDE, it compiles my program well. Any help?

Edited by ZekeDragon, 05 October 2010 - 05:16 PM.
Please use [code] tags when posting code.


#2
Generic

Generic

    Newbie

  • Members
  • PipPip
  • 26 posts
change
StadiumWorker.java:

public package Football;

import java.util.LinkedList;


public class StadiumWorker
{
...
}
to
StadiumWorker.java:

package Football;

import java.util.LinkedList;


public class StadiumWorker
{
...
}