netbeans 7 - could not run a java project from another -


i have 2 projects-try.java , another.java. run another,java try.java

here code another.java

package another;  public class {      public static void main(string[] args)      {         system.out.println("another java project");     } } 

here mycode try.java

package pkgtry;  import java.io.bufferedreader; import java.io.inputstream; import java.io.inputstreamreader;  public class try  {     private static void printlines(string name, inputstream ins) throws exception {     string line = null;     bufferedreader in = new bufferedreader(new inputstreamreader(ins));     while ((line = in.readline()) != null)      {         system.out.println(name + " " + line);     } }  private static void runprocess(string command) throws exception  {     process pro = runtime.getruntime().exec(command);     printlines(command + " stdout:", pro.getinputstream());     printlines(command + " stderr:", pro.geterrorstream());     pro.waitfor();     system.out.println(command + " exitvalue() " + pro.exitvalue()); }  public static void main(string[] args)  {     try      {         runprocess("javac c:\\users\\owner\\documents\\netbeansprojects\\try\\src\\pkgtry\\another.java");   runprocess("java c:\\users\\owner\\documents\\netbeansprojects\\try\\src\\pkgtry\\another");     }     catch (exception e)      {         e.printstacktrace();     } } } 

after running try.java not printing anything. printing build successful in netbeans. class another.cass has been created

can me?

the java compiler trying find another.java file inside package pkgtry. if put both files in 1 package able achieve desired result.

public static void main(string[] args)  {    try     {      runprocess("javac another.java");      runprocess("java another");    }    catch (exception e)     {      e.printstacktrace();    } } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -