本文整理了Java中javassist.Loader.run()
方法的一些代码示例,展示了Loader.run()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Loader.run()
方法的具体详情如下:
包路径:javassist.Loader
类名称:Loader
方法名:run
[英]Loads a class and calls main()
in that class.
[中]加载一个类并在该类中调用main()
。
代码示例来源:origin: redisson/redisson
/**
* Loads a class and calls <code>main()</code> in that class.
*
* @param args command line parameters.
*
* <br> {@code args[0]} is the class name to be loaded.
* <br> {@code args[1..n]} are parameters passed
* to the target {@code main()}.
*/
public void run(String[] args) throws Throwable {
int n = args.length - 1;
if (n >= 0) {
String[] args2 = new String[n];
for (int i = 0; i < n; ++i)
args2[i] = args[i + 1];
run(args[0], args2);
}
}
代码示例来源:origin: org.javassist/javassist
/**
* Loads a class and calls <code>main()</code> in that class.
*
* @param args command line parameters.
*
* <br> {@code args[0]} is the class name to be loaded.
* <br> {@code args[1..n]} are parameters passed
* to the target {@code main()}.
*/
public void run(String[] args) throws Throwable {
if (args.length >= 1)
run(args[0], Arrays.copyOfRange(args, 1, args.length));
}
代码示例来源:origin: redisson/redisson
/**
* Loads a class with an instance of <code>Loader</code>
* and calls <code>main()</code> of that class.
*
* <p>This method calls <code>run()</code>.
*
* @param args command line parameters.
* <br> {@code args[0]} is the class name to be loaded.
* <br> {@code args[1..n]} are parameters passed
* to the target {@code main()}.
*
* @see javassist.Loader#run(String[])
*/
public static void main(String[] args) throws Throwable {
Loader cl = new Loader();
cl.run(args);
}
代码示例来源:origin: org.javassist/javassist
/**
* Loads a class with an instance of <code>Loader</code>
* and calls <code>main()</code> of that class.
*
* <p>This method calls <code>run()</code>.
*
* @param args command line parameters.
* <br> {@code args[0]} is the class name to be loaded.
* <br> {@code args[1..n]} are parameters passed
* to the target {@code main()}.
*
* @see javassist.Loader#run(String[])
*/
public static void main(String[] args) throws Throwable {
Loader cl = new Loader();
cl.run(args);
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Loads a class and calls <code>main()</code> in that class.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*/
public void run(String[] args) throws Throwable {
int n = args.length - 1;
if (n >= 0) {
String[] args2 = new String[n];
for (int i = 0; i < n; ++i)
args2[i] = args[i + 1];
run(args[0], args2);
}
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Loads a class and calls <code>main()</code> in that class.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*/
public void run(String[] args) throws Throwable {
int n = args.length - 1;
if (n >= 0) {
String[] args2 = new String[n];
for (int i = 0; i < n; ++i)
args2[i] = args[i + 1];
run(args[0], args2);
}
}
代码示例来源:origin: org.jboss/javassist
/**
* Loads a class and calls <code>main()</code> in that class.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*/
public void run(String[] args) throws Throwable {
int n = args.length - 1;
if (n >= 0) {
String[] args2 = new String[n];
for (int i = 0; i < n; ++i)
args2[i] = args[i + 1];
run(args[0], args2);
}
}
代码示例来源:origin: org.jboss.javassist/com.springsource.javassist
/**
* Loads a class and calls <code>main()</code> in that class.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*/
public void run(String[] args) throws Throwable {
int n = args.length - 1;
if (n >= 0) {
String[] args2 = new String[n];
for (int i = 0; i < n; ++i)
args2[i] = args[i + 1];
run(args[0], args2);
}
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Loads a class and calls <code>main()</code> in that class.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*/
public void run(String[] args) throws Throwable {
int n = args.length - 1;
if (n >= 0) {
String[] args2 = new String[n];
for (int i = 0; i < n; ++i)
args2[i] = args[i + 1];
run(args[0], args2);
}
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Loads a class with an instance of <code>Loader</code>
* and calls <code>main()</code> of that class.
*
* <p>This method calls <code>run()</code>.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*
* @see javassist.Loader#run(String[])
*/
public static void main(String[] args) throws Throwable {
Loader cl = new Loader();
cl.run(args);
}
代码示例来源:origin: org.jboss/javassist
/**
* Loads a class with an instance of <code>Loader</code>
* and calls <code>main()</code> of that class.
*
* <p>This method calls <code>run()</code>.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*
* @see javassist.Loader#run(String[])
*/
public static void main(String[] args) throws Throwable {
Loader cl = new Loader();
cl.run(args);
}
代码示例来源:origin: org.jboss.javassist/com.springsource.javassist
/**
* Loads a class with an instance of <code>Loader</code>
* and calls <code>main()</code> of that class.
*
* <p>This method calls <code>run()</code>.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*
* @see javassist.Loader#run(String[])
*/
public static void main(String[] args) throws Throwable {
Loader cl = new Loader();
cl.run(args);
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
/**
* Loads a class with an instance of <code>Loader</code>
* and calls <code>main()</code> of that class.
*
* <p>This method calls <code>run()</code>.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*
* @see javassist.Loader#run(String[])
*/
public static void main(String[] args) throws Throwable {
Loader cl = new Loader();
cl.run(args);
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
/**
* Loads a class with an instance of <code>Loader</code>
* and calls <code>main()</code> of that class.
*
* <p>This method calls <code>run()</code>.
*
* @param args command line parameters.
* <ul>
* <code>args[0]</code> is the class name to be loaded.
* <br><code>args[1..n]</code> are parameters passed
* to the target <code>main()</code>.
* </ul>
*
* @see javassist.Loader#run(String[])
*/
public static void main(String[] args) throws Throwable {
Loader cl = new Loader();
cl.run(args);
}
代码示例来源:origin: sc.fiji/fiji-compat
private static void doMain(final String mainClass, final String... args) throws Throwable {
setActive(true);
loader.run(mainClass, args);
report(System.err);
}
}
代码示例来源:origin: sc.fiji/fiji-compat
public static void main(String[] args) throws Throwable {
Thread.currentThread().setContextClassLoader(MemoryProfiler.class.getClassLoader());
if (args.length == 0) {
System.err.println("Usage: java " + MemoryProfiler.class + " <main-class> [<argument>...]");
System.exit(1);
}
String mainClass = args[0];
String[] mainArgs = new String[args.length - 1];
System.arraycopy(args, 1, mainArgs, 0, mainArgs.length);
Loader loader = new Loader();
loader.addTranslator(ClassPool.getDefault(), new MemoryProfiler());
gc();
loader.run(mainClass, mainArgs);
}
}
代码示例来源:origin: org.openimaj/core-aop-support
protected static Loader run(final ClassLoader parent, ClassPool pool, MultiTransformClassFileTransformer tf,
String mainClass, String[] args)
throws Throwable
{
final Loader cl = new Loader(parent, pool);
// Set the correct app name on OSX. Are there similar controls for other
// platforms?
System.setProperty("com.apple.mrj.application.apple.menu.about.name", mainClass);
// skip args4j
cl.delegateLoadingOf("org.apache.log4j.");
cl.addTranslator(pool, tf);
cl.run(mainClass, args);
return cl;
}
代码示例来源:origin: openimaj/openimaj
protected static Loader run(final ClassLoader parent, ClassPool pool, MultiTransformClassFileTransformer tf,
String mainClass, String[] args)
throws Throwable
{
final Loader cl = new Loader(parent, pool);
// Set the correct app name on OSX. Are there similar controls for other
// platforms?
System.setProperty("com.apple.mrj.application.apple.menu.about.name", mainClass);
// skip args4j
cl.delegateLoadingOf("org.apache.log4j.");
cl.addTranslator(pool, tf);
cl.run(mainClass, args);
return cl;
}
代码示例来源:origin: ago1024/WurmServerModLauncher
public static void main(String[] args) {
try {
initLogger();
Loader loader = HookManager.getInstance().getLoader();
loader.delegateLoadingOf("javafx.");
loader.delegateLoadingOf("com.sun.");
loader.delegateLoadingOf("org.controlsfx.");
loader.delegateLoadingOf("impl.org.controlsfx");
loader.delegateLoadingOf("com.mysql.");
loader.delegateLoadingOf("org.sqlite.");
loader.delegateLoadingOf("org.gotti.wurmunlimited.modloader.classhooks.");
loader.delegateLoadingOf("javassist.");
Thread.currentThread().setContextClassLoader(loader);
loader.run("org.gotti.wurmunlimited.serverlauncher.DelegatedLauncher", args);
} catch (Throwable e) {
Logger.getLogger(ServerLauncher.class.getName()).log(Level.SEVERE, e.getMessage(), e);
e.printStackTrace();
System.exit(-1);
}
}
代码示例来源:origin: org.openimaj/core-aop-support
/**
* Re-load the given class in a newly created {@link Loader} that is
* configured to apply the given transform(s), and then run the main method.
*
* @param transformer
* the transformer
* @param clz
* the class
* @param args
* the arguments
* @throws Throwable
* if an error occurs
*/
public static void run(MultiTransformClassFileTransformer transformer, Class<?> clz, String[] args) throws Throwable {
final ClassPool pool = new ClassPool();
pool.appendSystemPath();
final Loader loader = new Loader(pool);
// skip args4j
loader.delegateLoadingOf("org.apache.log4j.");
loader.addTranslator(pool, transformer);
loader.run(clz.getName(), args);
}
内容来源于网络,如有侵权,请联系作者删除!