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: Opening a single .java file in Eclipse

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Opening a single .java file in Eclipse

    Hello everyone, I'm sorry to have to ask such a simple question but I have downloaded a single .java file from my university and I don't know how to open it correctly in Eclipse. I have tried creating a new project first and simply dragging the file into eclipse. The program shows correctly but doesn't run. I have tried importing the file but there is no browser option which identifies the file. I have also tried copying the file into the 'src' directory, creating a new project with identical name as the .java but it still won't run. Its says it can't find the 'main' but the main is in the file, ie. the "...main String[] args..."

    Please can someone explain how to simply import (or simply have run) a single .java file. Im sure its got something to do with incorrect path locations or what not.

    Cheers.


  2. #2
    Junior Member psabbate's Avatar
    Join Date
    Aug 2012
    Posts
    20
    My Mood
    Amused
    Thanks
    0
    Thanked 5 Times in 4 Posts

    Default Re: Opening a single .java file in Eclipse

    If you want to just open the file go to file -> open file ...
    If you want to run java file, create a simple java project, then copy your java file to the src package and right click (over your java file) -> run as java application.

    This should work.
    Everyone wants to go to heaven ... but nobody wants to die

    Nissi Group, Servicios IT,
    Diseņo Web, Desarrollo de Software, SEO,
    LinkedIn

  3. The Following User Says Thank You to psabbate For This Useful Post:

    Dreamer999 (August 24th, 2012)

  4. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Opening a single .java file in Eclipse

    lol thankyou! I'm an idiot.

  5. #4
    Junior Member psabbate's Avatar
    Join Date
    Aug 2012
    Posts
    20
    My Mood
    Amused
    Thanks
    0
    Thanked 5 Times in 4 Posts

    Default Re: Opening a single .java file in Eclipse

    Quote Originally Posted by Dreamer999 View Post
    lol thankyou! I'm an idiot.
    Jaja no problem !!
    Everyone wants to go to heaven ... but nobody wants to die

    Nissi Group, Servicios IT,
    Diseņo Web, Desarrollo de Software, SEO,
    LinkedIn

Similar Threads

  1. Input file Not Opening =/
    By dannybrgc in forum What's Wrong With My Code?
    Replies: 10
    Last Post: April 11th, 2012, 05:21 PM
  2. Windows 7 - jar file not opening a window
    By Yaten13 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 10th, 2011, 05:53 PM
  3. Error when opening eclipse
    By BlackJavaCoder in forum Java IDEs
    Replies: 4
    Last Post: September 3rd, 2011, 07:57 AM
  4. Opening a file with a java program
    By hafunui in forum Java Theory & Questions
    Replies: 4
    Last Post: March 1st, 2011, 04:52 PM
  5. Opening a File for User
    By aussiemcgr in forum Java Theory & Questions
    Replies: 3
    Last Post: July 29th, 2010, 03:00 AM