當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。