Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Quick project from .java file?(How to open Eclipse with a new project containing a single .java file?)
Quick project from .java file? [message #755538] Tue, 08 November 2011 18:11 Go to next message
Barry Burd is currently offline Barry BurdFriend
Messages: 20
Registered: July 2009
Junior Member
Here's the scenario: Someone sends me an email with a single Java file as an attachment. I'd like to open the file quickly so that it opens in Eclipse for running. I can set Eclipse as my default application for .java files, but then the file opens in Eclipse's editor **without** being in a project. Since the file isn't inside an Eclipse project, I can't run the file. Any suggestions?
Re: Quick project from .java file? [message #755542 is a reply to message #755538] Tue, 08 November 2011 18:30 Go to previous messageGo to next message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 11/8/2011 11:41 PM, Barry Burd wrote:
> Here's the scenario: Someone sends me an email with a single Java file
> as an attachment. I'd like to open the file quickly so that it opens in
> Eclipse for running. I can set Eclipse as my default application for
> .java files, but then the file opens in Eclipse's editor **without**
> being in a project. Since the file isn't inside an Eclipse project, I
> can't run the file. Any suggestions?

Copy file contents and paste in Package Explorer.
Re: Quick project from .java file? [message #755545 is a reply to message #755542] Tue, 08 November 2011 18:47 Go to previous messageGo to next message
Barry Burd is currently offline Barry BurdFriend
Messages: 20
Registered: July 2009
Junior Member
Deepak,
By "Copy file contents and paste in Package Explorer" do you mean "Use the wizards to create a new Java class with the same name as the public class that's been sent to me and then copy the text from the the file into the newly created class (which is inside a project that I already created)?" If so, then I'm looking for a quicker way. With some very primitive IDEs I can simply do

./runIDE -sourcefile MyFile.java

and have the IDE be up and running, ready to execute the code. Is this possible with Eclipse? The extra steps (creating a project if necessary, creating or importing a class) seems like a lot of overhead for running a one-file Java program.
Re: Quick project from .java file? [message #755614 is a reply to message #755545] Wed, 09 November 2011 01:32 Go to previous message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
On 11/9/2011 12:17 AM, Barry Burd wrote:
> Deepak,
> By "Copy file contents and paste in Package Explorer" do you mean "Use
> the wizards to create a new Java class with the same name as the public
> class that's been sent to me and then copy the text from the the file
> into the newly created class (which is inside a project that I already
> created)?"

No. I meant copy the file contents, and go to PE (click somewhere in it
so that the focus is in PE) and press Ctrl+V (paste)
Previous Topic:Running out of Heap Memory after building a large project
Next Topic:Spell checker for Java code
Goto Forum:
  


Current Time: Wed Apr 24 20:09:09 GMT 2024

Powered by FUDForum. Page generated in 0.02696 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top