Class NGClasspath

java.lang.Object
com.martiansoftware.nailgun.builtins.NGClasspath

public class NGClasspath extends 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 Details

    • NGClasspath

      public NGClasspath()
  • Method Details

    • addToSystemClassLoader

      private static void addToSystemClassLoader(URL url) throws 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:
      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 Exception
      Throws:
      Exception