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

Thread: eclipse problem

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    29
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default eclipse problem

    I don't normally use eclipse, but I wanted to use it to debug my code. I have an existing program that runs fine from the commandline but when I try to run it from eclipse it all I get is errors about how it can't find the class. I tried different workspaces and different project folders but it just won't work. What I normally do from the commandline is to navigate to the 'projects' folder then type java stuff.collision.CollisionTest to run it. The CollisionTest.class file is in the 'collision' folder in the 'stuff' folder in the 'projects' folder and CollisionTest.java is in the 'stuff.collision' package. I tried setting to workspace to 'projects', the folder containing 'projects' and 'stuff' and creating a new project from 'projects', 'stuff' and 'collision' in various combinations. When I try to run it, I get a menu about run configuration, after slecting java application, I tried to put 'CollisionTest' and 'stuff.collision.CollisionTest' as the main class but neither worked. How can I get this to work?


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: eclipse problem

    You have a project in the Workspace? If not, create a new Java Project. Call it whatever you like. A naming standard is a 'backwards' URL, something like, 'org.apache.tomcat', (com.harryblargle.javapractice), but you decide.

    Inside the new project will be a source folder called 'src'. You can put default source code there, meaning source code that doesn't belong to a specific package. Or you can right click on the project and select, New, Package. To be consistent with your current naming, you may want to name the new package, 'stuff.collision'. Select 'Finish'.

    Right click your new package and select New, Class. Name your class CollisionTest. Select Finish.

    Copy your existing class, CollisionTest, into the new Class you just created, replacing everything. A package statement:

    package stuff.collision;

    should have come from your existing source. If not, add it.

    You should be able to compile and run the resulting class. If not, describe any errors you're getting and unable to solve.

    Oh, I forgot you asked about the "Run configurations." Select Java Application. Since my setup is slightly different, let me know if you see something else you don't know what to do with.

    You can also import existing code into a project, so you may want to play with that using File, Import.

  3. #3
    Junior Member
    Join Date
    Sep 2011
    Posts
    29
    Thanks
    2
    Thanked 2 Times in 2 Posts

    Default Re: eclipse problem

    Thanks, copying everthing into a new project worked. Not very practical but at least I can use the debugger now.

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: eclipse problem

    When (if) you get smarter at using Eclipse, you might find better ways to do the same thing.

Similar Threads

  1. [SOLVED] Problem with Eclipse
    By Yellowphone in forum Java IDEs
    Replies: 11
    Last Post: January 29th, 2014, 03:04 AM
  2. Problem with Eclipse
    By Yellowphone in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 26th, 2014, 08:54 PM
  3. problem..with eclipse 3.1
    By mint17 in forum Java IDEs
    Replies: 4
    Last Post: August 31st, 2012, 07:55 AM
  4. Replies: 3
    Last Post: January 5th, 2012, 01:44 AM
  5. Eclipse Problem
    By The_Mexican in forum Java IDEs
    Replies: 2
    Last Post: December 8th, 2010, 09:02 PM