YUI를 사용하여 CSS 파일을 압축하는 자바 프로그램을 만들고 싶습니다. 자바에서 새로운 학습자입니다.자바 프로그램에서 jar 파일을 실행합니다.
내 코드는 다음과 같습니다
import java.io.BufferedInputStream;
import java.io.IOException;
public class Run extends Object
{
public static void main(String args[]) throws IOException, InterruptedException
{
System.out.println("Calling jar");
Process p = Runtime.getRuntime().exec("java -Xmx32m -jar yui.jar in.css");
BufferedInputStream bis = new BufferedInputStream(p.getInputStream());
synchronized(p)
{
p.waitFor();
}
System.out.println(p.exitValue());
int b = 0;
while((b = bis.read()) > 0)
{
System.out.print((char)b);
}
System.out.println("Called jar");
}
}
내가 here에서 참조했다.
명령 :java -Xmx32m -jar yui.jar in.css
는 cmd를 잘 작동하지만 위의 프로그램을 실행할 때 제가 위에서 얻을 출력이 내가 더 출력을 얻을 :
이Calling jar
1
Called jar
내가 무엇을 가르쳐주세요 잘못을 저 지르거나이를 수행하는 올바른 방법은 무엇입니까?
http://blog.teamextension.com/yui-compressor-in-java-246 – chf