当前位置: 首页>>代码示例>>Java>>正文


Java ClassNotFoundException类代码示例

本文整理汇总了Java中java.lang.ClassNotFoundException的典型用法代码示例。如果您正苦于以下问题:Java ClassNotFoundException类的具体用法?Java ClassNotFoundException怎么用?Java ClassNotFoundException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ClassNotFoundException类属于java.lang包,在下文中一共展示了ClassNotFoundException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Learning

import java.lang.ClassNotFoundException; //导入依赖的package包/类
public Learning()
{
  jmhal = new JMegaHal();
  // Reload brain from disk.
  try
  {
    FileInputStream fis = new FileInputStream(brainFile);
    ObjectInputStream ois = new ObjectInputStream(fis);
    Object object = ois.readObject();
    if(object instanceof JMegaHal)
      jmhal = (JMegaHal)object;
  }
  catch(ClassNotFoundException cnfe)
  {
    System.out.println("> Warning: Class not found: " + cnfe.toString());
  }
  catch(FileNotFoundException fnfe)
  {
    System.out.println("> Warning: Unable to open brain.dat: " + fnfe.toString());
  }
  catch(IOException ioe)
  {
    System.out.println("> Warning: Unable to open brain.dat: " + ioe.toString());
  }
}
 
开发者ID:ldilley,项目名称:frank,代码行数:26,代码来源:Learning.java

示例2: BadClassFiles

import java.lang.ClassNotFoundException; //导入依赖的package包/类
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:18,代码来源:BadClassFiles.java

示例3: createNode

import java.lang.ClassNotFoundException; //导入依赖的package包/类
/** 
   * Creates the node with the specified node id and fully qualified node type.
* @param nodeID device ID
* @param nodeType fully qualified node type (e.g. deviceType.softType)
   */
  private AcceleratorNode createNode( final String nodeID, final String nodeType ) throws ClassNotFoundException {
      // Check if this node type is known; if not then substitute a generic node
      if ( !_constructors.containsKey( nodeType ) ) {
	final String message = "Unknown AcceleratorNode type : \"" + nodeType + "\" for ID: " + nodeID + ".  Will substitute a GenericNode!";
          System.err.println( message );
	Logger.getLogger("global").log( Level.WARNING, message );
          final AcceleratorNode node = new GenericNode( nodeType, nodeID, CHANNEL_FACTORY );
          _classTable.put( nodeType, GenericNode.class );
          return node;
      }
      
      final Constructor<?> constructor = _constructors.get( nodeType );
//TODO: need to account for custom channel factory
      final Object[] args = new Object[] { nodeID, CHANNEL_FACTORY };
      
      try {
          return (AcceleratorNode)constructor.newInstance( args );
      } 
catch (Throwable exception)   {
           throw new ClassNotFoundException( "Unknown AcceleratorNode type : " + nodeType );
      }
  }
 
开发者ID:openxal,项目名称:openxal,代码行数:28,代码来源:AcceleratorNodeFactory.java

示例4: mixinCreateTest2

import java.lang.ClassNotFoundException; //导入依赖的package包/类
@Test
public void mixinCreateTest2( ) throws JsonProcessingException, ClassNotFoundException, IOException {
	Expression expression = 
		new Expression( "contains", 0, 0 )
			.addExpression( 
				new Expression( "contains", 0, 0 )
					.addTerm( "word", "aword0" )
					.addTerm( "word", "aword1" ) )
			.addTerm( "word", "aword2" );
	ExpressionFeature f = new ExpressionFeature( "feat", expression, 1.0f );
	StrusJsonObjectMapper mapperFactory = new StrusJsonObjectMapper( );
	ObjectMapper mapper = mapperFactory.getObjectMapper( );
	String s = mapper.writeValueAsString( f );
	LOGGER.fine( s );
	Object o = mapper.readValue( s, ExpressionFeature.class );
	LOGGER.fine( o.toString( ) );
	printNode( ((ExpressionFeature)o).expression, 1 );
}
 
开发者ID:Eurospider,项目名称:strusJavaApi,代码行数:19,代码来源:JacksonTest.java

示例5: RunList

import java.lang.ClassNotFoundException; //导入依赖的package包/类
/**
* RunList
* suitesToRun: a Vector of suites from RunSuite
* outDir: The output directory for the suite(s)
* pwOut: The output for writing suite and test results
* suiteProperties: From RunSuite for the top suite
* (individual suites in the vector may have their own
* properties which must also be located and applied)
*/

public RunList(Vector suitesToRun, 
    File runDir, File outDir, PrintWriter pwOut,
    Properties suiteProperties, 
    Properties specialProperties, 
    String topParentSuite)
    throws ClassNotFoundException, IOException, Exception
{
    this.runDir = runDir;
    this.outDir = outDir;
    this.pwOut = pwOut;
    this.suiteProperties = suiteProperties; // usual suite props
    this.specialProperties = specialProperties; // for special test Flags
    this.topSuiteName = suiteProperties.getProperty("suitename");
    //System.out.println("----------------------------------------");
    //System.out.println("RunList topSuiteName= " + topSuiteName);
    this.topParentSuite = topParentSuite;
    //System.out.println("topParentSuite= " + topParentSuite);

    // Run the suites
    runSuites(suitesToRun);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:32,代码来源:RunList.java

示例6: verifyTestType

import java.lang.ClassNotFoundException; //导入依赖的package包/类
static void verifyTestType()
      throws ClassNotFoundException, FileNotFoundException, IOException
  {
      //java requires '/' as separator to look into jar, irrespective of OS
      InputStream is =
          loadTestResource("harness/testtypes.properties");
Properties p = new Properties();
p.load(is);
      String testtypes = p.getProperty("testtypes");
   StringTokenizer st = new StringTokenizer(testtypes,",");
   String ttype = "";
      while (st.hasMoreTokens())
      {
          ttype = st.nextToken();
          if ( testType.equals(ttype) )
              return;
      }
      // Not a known test type
      System.out.println("Unknown test type: " + testType);
      System.exit(1);
  }
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:22,代码来源:RunTest.java

示例7: initClassifier

import java.lang.ClassNotFoundException; //导入依赖的package包/类
private void initClassifier (PrintStream output) {

    try {
      classifier = CRFClassifier.getClassifier (serializedClassifier);
    }
    catch (ClassNotFoundException cnfe) {
      output.println ("Class not found exception initializing NER extractions.");
      output.println ("Exception: " + cnfe.toString ());
      System.exit (1);
    }
    catch (IOException ioex) {
      output.println ("Exception in initClassifier");
      output.println ("Exception: " + ioex.toString ());
      System.exit (1);
    }
  }
 
开发者ID:jjfiv,项目名称:galago-git,代码行数:17,代码来源:AnnotationsGenerateFn.java

示例8: loadAuthenticationFilter

import java.lang.ClassNotFoundException; //导入依赖的package包/类
public static String loadAuthenticationFilter() {
        
    // Check if custom AuthFilter is available
    String customAuthFilterClassName = JiveGlobals.getProperty(CUSTOM_AUTH_PROPERTY_NAME);
    String restAuthType = JiveGlobals.getProperty(REST_AUTH_TYPE);
    String pickedAuthFilter = AUTHFILTER;
    
    try {
        if(customAuthFilterClassName != null && "custom".equals(restAuthType)) {
            Class.forName(customAuthFilterClassName, false, JerseyWrapper.class.getClassLoader());
            pickedAuthFilter = customAuthFilterClassName;
            loadingStatusMessage = null;
        }
    } catch (ClassNotFoundException e) {
        loadingStatusMessage = "No custom auth filter found for restAPI plugin! " + customAuthFilterClassName + " " + restAuthType;
    }
    
    prc.getProperties().put(CONTAINER_REQUEST_FILTERS, pickedAuthFilter);	
    return loadingStatusMessage;
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:21,代码来源:JerseyWrapper.java

示例9: getListTypes

import java.lang.ClassNotFoundException; //导入依赖的package包/类
private List<Class> getListTypes(Field fld) {
List<Class> listVals = new ArrayList<Class>();
if (fld != null &&
    (fld.getType() == List.class || fld.getType() == ArrayList.class)) {
    ParameterizedType pt = (ParameterizedType) fld.getGenericType();
    for (Type type: pt.getActualTypeArguments()) {
	if (type instanceof Class) {
	    // Single dimensional ListOf
	    listVals.add((Class) type);
	} else {
	    // Multidimensional ListOf
	    //listVals.add((new ArrayList<Object>()).getClass());
	    for (String sub: type.toString().split("<"))
		if (sub.indexOf("List") > 5)
		    listVals.add((new ArrayList<Object>()).getClass());
		else try {
			String cn = sub.substring(0, sub.indexOf(">"));
			listVals.add(Class.forName(cn));
		    } catch (ClassNotFoundException cnf) {
			throw new Error ("Class not found: '"+sub+"'");
		    }
	}
    }
}
return listVals;
   }
 
开发者ID:glyph,项目名称:amp-java,代码行数:27,代码来源:AMPBox.java

示例10: implementations

import java.lang.ClassNotFoundException; //导入依赖的package包/类
/**
    * Display all the classes inheriting or implementing a given
    * interface in the currently loaded packages.
    * @param interfaceName the name of the interface to implement
    */
   public static Set<String> implementations( String interfaceName ) {
Set<String> list = new HashSet<String>();
try {
    Class toclass = Class.forName(interfaceName);
    //Package [] pcks = Package.getPackages();
    //for (int i=0;i<pcks.length;i++) {
	//logger.trace(interfaceName+ ">> "+pcks[i].getName() );
	//implementations( pcks[i].getName(), toclass, list );
	//}
    implementations( toclass, list );
} catch (ClassNotFoundException ex) {
    logger.debug( "IGNORED Class {} not found!", interfaceName );
}
return list;
   }
 
开发者ID:dozed,项目名称:align-api-project,代码行数:21,代码来源:AServProtocolManager.java

示例11: getPackageClass

import java.lang.ClassNotFoundException; //导入依赖的package包/类
private static Class getPackageClass(String packageName) {
  Class packageClass;
  if(packageName == null || packageName.equals("base")) {
    packageClass = Base.class;
  } else if(packageName.equals("methods")) {
    packageClass = Methods.class;
  } else if(packageName.equals("grDevices")) {
    packageClass = Graphics.class;
  } else {
    String packageClassName = "org.renjin." + packageName + "." +
        packageName.substring(0, 1).toUpperCase() + packageName.substring(1);
    try {
      packageClass = Class.forName(packageClassName);
    } catch (ClassNotFoundException e) {
      throw new EvalException("Could not find class for 'native' methods for package '%s' (className='%s')",
          packageName, packageClassName);
    }
  }
  return packageClass;
}
 
开发者ID:bedatadriven,项目名称:renjin-statet,代码行数:21,代码来源:Native.java

示例12: clone

import java.lang.ClassNotFoundException; //导入依赖的package包/类
/** depth clone **/
public Object clone() {
	try {
		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		ObjectOutputStream oos = new ObjectOutputStream(bos);
		oos.writeObject(this);
		ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
		ObjectInputStream ois = new ObjectInputStream(bis);
		return ois.readObject();
	} catch (IOException | ClassNotFoundException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:qq1588518,项目名称:JRediClients,代码行数:15,代码来源:UserEntity.java

示例13: decodeObject

import java.lang.ClassNotFoundException; //导入依赖的package包/类
private Object decodeObject(String base64String) throws PersistentVarsException {

    Object object = null;
    
    try {
        byte[] bytes = Base64.getInstance().decode(base64String);
        
        InputStream inputStream = new ByteArrayInputStream(bytes);
        ObjectInputStream objectStream = new ObjectInputStream(inputStream);
        object = objectStream.readObject();
        objectStream.close();
        inputStream.close();
    } catch (ClassNotFoundException classNotFoundException) {
        throw new PersistentVarsException(classNotFoundException.getMessage());
    } catch (IOException ioException) {
        throw new PersistentVarsException(ioException.getMessage());
    }

    return object;
}
 
开发者ID:will-gilbert,项目名称:OSWf-OSWorkflow-fork,代码行数:21,代码来源:HibernatePersistentVars.java

示例14: fromData

import java.lang.ClassNotFoundException; //导入依赖的package包/类
/**
 * Reads the contents of this message from the given input.
 */
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
  this.regionPath = DataSerializer.readString(in);
  this.callbackArgument = DataSerializer.readObject(in);
  this.op = Operation.fromOrdinal(in.readByte());
  this.originRemote = in.readBoolean();
  this.distributedMember = DSFIDFactory.readInternalDistributedMember(in);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:RegionEventImpl.java

示例15: BadClassFiles

import java.lang.ClassNotFoundException; //导入依赖的package包/类
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        loader.defineClass("BadParams", BadParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:BadClassFiles.java


注:本文中的java.lang.ClassNotFoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。