title: Creating eclipse project from main method
body: <p>Is there anyway to create temporary eclipse project and workspace from simple Java main method? I have the following code for now:</p>
  
  <pre><code>public static void main(String[] args)
  {
      try
      {
          IProgressMonitor progress = new NullProgressMonitor();
          IWorkspace workspace = ResourcesPlugin.getWorkspace();
          IWorkspaceRoot root = workspace.getRoot();
  
          IProject project = root.getProject();
  
          IProjectDescription desc = workspace.newProjectDescription(project.getName());
          IPath path = new Path("./project/");
          desc.setLocation(path);
  
          project.create(desc, progress);
          project.open(progress);
      }
      catch (Exception e)
      {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>But this fails to exception "Workspace is closed". I know there must be some kind of initialization of the workspace using org.eclipse.equinox.launcher.Main but how is this done programatically? Tried to find solutions but after an hour of googling I couldn't find any. </p>
  
  <p>Thanks!</p>