Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


camcd

Member Since 17 Jul 2012
Offline Last Active Jul 19 2012 02:03 PM

Posts I've Made

In Topic: Java package problem

17 July 2012 - 01:45 AM

Alright, sorry to bother you guys. I got it working. My classpath wasn't set correctly and I didn't write the package statement properly. Thanks.

In Topic: Java package problem

17 July 2012 - 01:25 AM

I thought I was (though I did ramble about random things, just a little excited Posted Image ), sorry. I'm having trouble importing and using other packages besides those in java.* or javax.* .

When I create my own package, I get an error saying : "package "x" doesn't exist" when I try to compile. The class can even be in the same directory as main.

The current organization (or lack of) of my program is as follows

MyGame Folder:
class x, class x1, class x2, ... class xn .

So when I do javac *.java it looks in the current directory (MyGame) that contains my main class and finds all the other classes.

I want to add a folder containing classes related to one thing and all the classes in that folder would be in the same package , so it would be:

MyGame Folder:
MyPackage 1:
class p, class p1 ... class pn

class x

Where I could import one of the "p" classes from class x (which would contain main) with a statement like:

import MyGame.MyPackage1.class p;

and can still compile with javac . I want to avoid the use of an IDE before I know how to do it myself.

PARTNERS