Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: how to compile java and import it as package

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to compile java and import it as package

    hi:

    I am new to Java and meet a problem when compiling the codes. The codes are as following:

     
    import com.testing.simpletest.*;
     
    ....

    the main problem is I don't know how to include the files in directory and how to combine them into
    one package, and how to name the package. Is there any difference between them and .h files in C.
    If I use eclipse as IDE, and create my own project, how to import these packages.
    Thanks.


  2. #2
    Junior Member
    Join Date
    Jul 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: how to compile java and import it as package

    Create a jar file for the java files that you have(com.testing.simpletest.*.class). Then add the jar file to your eclipse project. Then execute the project.It may work.

  3. #3
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    472
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: how to compile java and import it as package

    Java doesn't use header (.h) files, so there is no similarity at all with C in that respect.

    If you want to learn about packages, see What Is a Package? and for full details: Creating and Using Packages.

Similar Threads

  1. First line of Java Programming- package help
    By iNoshift in forum Java Theory & Questions
    Replies: 4
    Last Post: June 3rd, 2013, 09:38 PM
  2. how to import my own class in my .java file
    By amr in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 17th, 2010, 09:31 PM
  3. Is it possible to package Java
    By UnderWater2 in forum Java Theory & Questions
    Replies: 1
    Last Post: November 2nd, 2010, 01:31 AM
  4. Pb import Eclipse Java Yaps Petstore
    By azerty@123450 in forum Java IDEs
    Replies: 1
    Last Post: May 4th, 2010, 09:16 PM
  5. [SOLVED] help in java i cant compile this
    By timeline in forum What's Wrong With My Code?
    Replies: 5
    Last Post: April 15th, 2010, 02:11 PM