Class NGClasspath
- java.lang.Object
-
- com.martiansoftware.nailgun.builtins.NGClasspath
-
public class NGClasspath extends java.lang.Object
Provides a means to display and add to the system classpath at runtime. If called with no arguments, the classpath is displayed. Otherwise, each argument is turned into a java.io.File and added to the classpath. Relative paths will be resolved relative to the directory in which the nailgun server is running. This is very likely to change in the future.
This is aliased by default to the command "
ng-cp
".
-
-
Constructor Summary
Constructors Constructor Description NGClasspath()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
addToSystemClassLoader(java.net.URL url)
Adds the specified URL (for a jar or a directory) to the System ClassLoader.static void
nailMain(NGContext context)
-
-
-
Method Detail
-
addToSystemClassLoader
private static void addToSystemClassLoader(java.net.URL url) throws java.lang.Exception
Adds the specified URL (for a jar or a directory) to the System ClassLoader. This code was written by antony_miguel and posted on http://forum.java.sun.com/thread.jsp?forum=32&thread=300557&message=1191210 I assume it has been placed in the public domain.- Parameters:
url
- the URL of the resource (directory or jar) to add to the System classpath- Throws:
java.lang.Exception
- if anything goes wrong. The most likely culprit, should this ever arise, would be that your VM is not using a URLClassLoader as the System ClassLoader. This would result in a ClassClastException that you probably can't do much about.
-
nailMain
public static void nailMain(NGContext context) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-