Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java Packages

Options
  • 18-08-2007 8:41pm
    #1
    Registered Users Posts: 5,238 ✭✭✭


    To cut a long story short I've some java source code I'd like to compile. It's in the form of com.packagename.particularclass and the folder structure is ..\com\packagename\directoriesandfiles.

    Say I want to compile \com\packagename\somefile.java that requires other classes/files from the package how would I go about it? I've never really used eclipse or netbeans before, just a code editor and javac, but if it's the easiest way I'd give it a shot.

    Any help would be greatly appreciated.


Comments

  • Moderators, Science, Health & Environment Moderators Posts: 10,079 Mod ✭✭✭✭marco_polo


    humbert wrote:
    To cut a long story short I've some java source code I'd like to compile. It's in the form of com.packagename.particularclass and the folder structure is ..\com\packagename\directoriesandfiles.

    Say I want to compile \com\packagename\somefile.java that requires other classes/files from the package how would I go about it? I've never really used eclipse or netbeans before, just a code editor and javac, but if it's the easiest way I'd give it a shot.

    Any help would be greatly appreciated.

    javac -cp "<parent dir of the com dir>" com.packagename.somefile.java


  • Registered Users Posts: 11,980 ✭✭✭✭Giblet


    import com.package.file;


  • Registered Users Posts: 5,238 ✭✭✭humbert


    Thanks, that's what I was trying and why I was so frustrated. I was compiling another file with an enum in it and it was giving silly "; expected" errors.

    So after some googling I found that it might be because I'd two compilers(or at least two versions) installed and when I checked I had downloaded "J2SE v 1.4.2_15 SDK" and "Java(TM) SE Development Kit 6" so I uninstalled both and reinstalled the latter and the problem vanished. Very odd.


Advertisement