wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Packages" Watch "Packages" New topic
Author

Packages

Pauldon
Greenhorn

Joined: Apr 11, 2006
Posts: 19
I have downloaded source code from the internet and i have the .java files and the jar files. Im using Blue J and when i try copying the .java files into Blue J and compiling it says im trying to change the package statement to a package that does not exist in this project. Where do i find the package, is it inside the jar files and what do i do with the package. Thanks.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Moving to the beginner forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38075
    
  22
The simplest answer is not to use BlueJ.
It is not at all good at using packages.

Try
  • Copying the files to BlueJ with the package statements (always at the beginning of the file) left out.
  • Copying and pasting the class files to a proper IDE (eg NetBeans, Eclipse), but you will have to set up packages with the same names as your package statements.
  • Using a text editor or JCreator, with the package statements left in.

  • You may need to compile the classes individually, using
    javac -d . MyClass.java
    then to run them use
    java packagename.ClassName
    for the class with the main method in.
    See whether any of those is helpful
    CR
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Packages
     
    Similar Threads
    compiling package in Unix
    Applet's Security Using plug-in. HELP!!!!!
    is this about class path?
    specifying additional jars at runtime
    Development Chapter