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 5 of 5

Thread: Java Packages creat and run in Eclipse

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Packages creat and run in Eclipse

    Hi ,

    Please help me understanding i am able to create package in java but could not able to access and run in eclipse cam you please help me out in this.

    Regards,
    Nilesh


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,387
    My Mood
    Hungover
    Thanks
    144
    Thanked 628 Times in 538 Posts

    Default Re: Java Packages creat and run in Eclipse

    This is why I recommend novices use a basic text editor to write their code and the command line to compile and run it.

    You need a class that contains a main() method in order to run a program.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Member
    Join Date
    Oct 2013
    Location
    United Kingdom
    Posts
    62
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default Re: Java Packages creat and run in Eclipse

    Can you let us know the project structure and the package name you have created. Also have you created a class inside the package and run that?
    Thanks and regards,
    Sambit Swain

  4. #4
    Junior Member
    Join Date
    Jan 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Packages creat and run in Eclipse

    Hi Sambit,

    I have created a simple package name's mypackage in which i am having only one method show(), and i am having main class within javapackage1 class where i want to access mypackage.

    yeah sambit i have created class within package and tried to run but it is giving error when i am trying to run that code.

    Kindly suggest.

    Regards,
    Nilesh

  5. #5
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,295
    My Mood
    Mellow
    Thanks
    193
    Thanked 669 Times in 656 Posts

    Default Re: Java Packages creat and run in Eclipse

    Java class names begin with capital letters.

    All methods should reside in classes, so you should have 2 classes. It sounds like you're asking how to access one class from another, both in the same package, but your question isn't clear. If you do have 2 classes, post both of them.

    Show your code and post your error, the text of the error copied and pasted directly into a post, no pictures or attachments. To see how to post code correctly and gather other info useful for newcomers, please read this topic.

Similar Threads

  1. Replies: 24
    Last Post: August 4th, 2014, 12:49 PM
  2. [SOLVED] Java 1.4.2 and eclipse code will not compile or run need it to run for school!
    By ClarmonkGaming in forum What's Wrong With My Code?
    Replies: 12
    Last Post: January 23rd, 2014, 08:41 PM
  3. Replies: 4
    Last Post: October 3rd, 2013, 05:25 PM
  4. Replies: 1
    Last Post: October 20th, 2012, 12:21 PM