该例不是直接使用javac,而是使用tools.jar
import java.io.*; 【程序编程相关:以C的精神(上)】
/* * 创建日期 2004-7-2 * 创建人 hongsoft * 文件名 testcompile.java */package com.hongsoft.test; 【推荐阅读:臆断B/S开发技术选择的心态】
public static void main(string[] args) { 【扩展信息:在dotnet中如何使用资源(转自MS中】
//定制的类装入器public class mycompile extends classloader{ string _classpath;
new testcompile(); }
public mycompile() { super(classloader.getsystemclassloader()); //编译器类型 _classpath = "."; string extraclasspath = "c:\\program files\\java\\j2re1.4.2\\lib\\rt.jar"; // = system.getproperty("calc.classpath"); if (extraclasspath != null) { _classpath = _classpath + system.getproperty("path.separator") + extraclasspath; } compile(); }
... 下一页