0

I'm trying to run the jhipster import-jdl command from a java program as show below.

public boolean generate(String foldername, String filename) {

        Runtime rt = Runtime.getRuntime();

        try {
            IPath root = ResourcesPlugin.getWorkspace().getRoot().getLocation();
            Process proc = rt.exec(new String[] { "cmd", "/K",
                    "cd " + root + "\\" + foldername + " && jhipster import-jdl " + filename });

        }
        catch (IOException e) {
            e.printStackTrace();
        } 

        return true;

    }

But the entity files are not getting created.

But if I open the command prompt in the folder specified in the code and run the same command as shown below manually, the entity files are generated.

cd C:\GitClone\work && jhipster import-jdl swaggertest.jh

I'm new to these things and have no idea on where am I going wrong. Please help me with the same.

Rakshitha
  • 1
  • 1
  • Is there any error? Did you wait for the `Process` to complete? One way to do that is https://docs.oracle.com/javase/8/docs/api/java/lang/Process.html#waitFor-- – Jon Ruddell Oct 31 '19 at 16:54
  • I checked the log for errors but there are none! And I'm making sure that the Process is getting completed. – Rakshitha Nov 01 '19 at 20:19

0 Answers0