Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Can I use JDT to parse Java project strictly using command-line?
Can I use JDT to parse Java project strictly using command-line? [message #1780931] Tue, 30 January 2018 07:29
Maruhan Park is currently offline Maruhan ParkFriend
Messages: 6
Registered: January 2018
Junior Member

Typically, when you are parsing Java code with JDT, you make it as a plugin and do something like this where

1. You first make a project:
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(projectName);
IProjectDescription description = project.getDescription();
description.setNatureIds(new String[] { JavaCore.NATURE_ID });
project.setDescription(description, null);
IJavaProject javaProject = JavaCore.create(project); 

2 then set the project to your ASTParser:
ASTParser parser = ASTParser.newParser(AST.JLS9);

Is there a way I can achieve what the above is doing without having to open Eclipse and run as a plugin? There has to be a way to create the same data structures programmatically by recreating the same environment to be as if it is running on the Eclipse IDE. Particularly, I feel like the easiest would be creating a "IJavaProject" object somehow.

What are some ways to do this?

I know making it a headless RCP application is a possibility, but I want to know if I can make it as a standalone Java application by using the appropriate jars or even modifying the jars and creating my own.

Previous Topic:How to add menuListener
Next Topic:Can I use JDT to parse Java project strictly using command-line?
Goto Forum:

Current Time: Mon Oct 22 19:03:24 GMT 2018

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

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

Back to the top