home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
VCAFE.3.0A
/
Main.bin
/
Locate.java
< prev
next >
Wrap
Text File
|
1998-11-02
|
2KB
|
94 lines
package com.symantec.itools.tools.utilities;
import java.applet.Applet;
import java.util.Vector;
import com.symantec.itools.lang.Classpath;
import com.symantec.itools.lang.ClasspathEntry;
import com.symantec.itools.lang.JavaName;
/**
* @author Symantec Internet Tools Division
* @version 1.0
* @since VCafe 3.0
*/
public class Locate
extends Applet
{
public Locate()
{
}
public void init()
{
try
{
String location;
String name;
name = getParameter("searchName");
location = locate(name, System.getProperty("java.class.path"));
if(location != null)
{
System.out.println(name + " is located in " + location);
}
else
{
System.out.println(name + " is not on the CLASSPATH");
}
}
catch(SecurityException ex)
{
System.out.println("Security exception");
}
}
public static String locate(String name, String classpathString)
{
return (locate(name, new Classpath(classpathString)));
}
public static String locate(String name, Classpath classpath)
{
ClasspathEntry entry;
entry = classpath.find(name);
if(entry == null)
{
return (null);
}
return (entry.getName());
}
/**
* @param argv TODO
* @since VCafe 3.0
*/
public static void main(String[] argv)
{
String location;
if(argv.length == 1)
{
location = locate(argv[0], System.getProperty("java.class.path"));
}
else
{
location = locate(argv[0], argv[1]);
}
if(location != null)
{
System.out.println(argv[0] + " is located in " + location);
}
else
{
System.out.println(argv[0] + " is not on the CLASSPATH");
}
}
}