本文整理汇总了Java中java.lang.ClassNotFoundException类的典型用法代码示例。如果您正苦于以下问题:Java ClassNotFoundException类的具体用法?Java ClassNotFoundException怎么用?Java ClassNotFoundException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassNotFoundException类属于java.lang包,在下文中一共展示了ClassNotFoundException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: newInstance
import java.lang.ClassNotFoundException; //导入依赖的package包/类
/**
* Create a new instance of a Checksum object.
* @return The newly created Checksum object
*/
static public Checksum newInstance(String className) throws IOException {
try {
Class<?> clazz = getClassByName(className);
return (Checksum)newInstance(clazz);
} catch (ClassNotFoundException e) {
throw new IOException(e);
}
}
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:ChecksumFactory.java
示例17: BuildSuitesVector
import java.lang.ClassNotFoundException; //导入依赖的package包/类
static void BuildSuitesVector(String parent, String subsuites)
throws ClassNotFoundException, IOException
{
Properties p;
StringTokenizer st = new StringTokenizer(subsuites);
String child = "";
while (st.hasMoreTokens())
{
child = st.nextToken();
if (child.equals(parent))
{
suitesToRun.addElement(parent+":"+child);
//System.out.println("Add this: " + parent+":"+child);
}
else
{
p = getSuiteProperties(child, false);
if ( p.getProperty("suites") == null )
{
suitesToRun.addElement(parent+":"+child);
//System.out.println("Add this: " + parent+":"+child);
}
else
{
String moresuites = p.getProperty("suites");
BuildSuitesVector(child, moresuites);
}
}
}
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:31,代码来源:RunSuite.java
示例18: 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);
this.diskException = DataSerializer.readObject(in);
}
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:13,代码来源:RegionEventImpl.java
示例19: mixinCreateTest1
import java.lang.ClassNotFoundException; //导入依赖的package包/类
@Test
public void mixinCreateTest1( ) throws JsonProcessingException, ClassNotFoundException, IOException {
TermFeature f = new TermFeature( "feat", 1.0f, "word", "aword0" );
StrusJsonObjectMapper mapperFactory = new StrusJsonObjectMapper( );
ObjectMapper mapper = mapperFactory.getObjectMapper( );
String s = mapper.writeValueAsString( f );
LOGGER.fine( s );
Object o = mapper.readValue( s, TermFeature.class );
LOGGER.fine( o.toString( ) );
LOGGER.fine( (((TermFeature)o).term).toString( ) );
printNode( ((TermFeature)o).term, 0 );
}
开发者ID:Eurospider,项目名称:strusJavaApi,代码行数:13,代码来源:JacksonTest.java
示例20: mixinCreateTest3
import java.lang.ClassNotFoundException; //导入依赖的package包/类
@Test
public void mixinCreateTest3( ) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
Query query = new Query( )
.setFirstRank( 0 )
.setNofRanks( 20 )
.addWeightingScheme(
new WeightingScheme( "bm25" )
.addParameter( "b", 0.77f )
.addParameter( "k1", 2 )
.addParameter( "avgdoclen", 11943 )
.addParameter( "metadata_doclen", "doclen" )
.addParameter( "match", "feat" ) )
.addSummarizer(
new SummarizerConfiguration( "docid", "attribute" )
.addParameter( "name", "docid" ) )
.addSummarizer(
new SummarizerConfiguration( "attr1", "attribute" )
.addParameter( "name", "attr1" ) )
.addSummarizer(
new SummarizerConfiguration( "doclen", "metadata" )
.addParameter( "name", "doclen" ) )
.defineFeature( "feat", "word", "aword0", 1.0f )
.defineFeature( "feat", new Term( "word", "aword1" ), 1.0f )
.defineFeature( "sel",
new Term( "word", "aword1" ), 1.0f )
.defineFeature( "sel",
new Expression( "contains", 0, 0 )
.addExpression(
new Expression( "contains", 0, 0 )
.addTerm( "word", "aword0" )
.addTerm( "word", "aword1" ) )
.addTerm( "word", "aword2" ), 1.0f )
.addSelect( "sel" )
// AND of OR-groups (CNF), first is a shortcut for a single and condition
.addMetadataRestriction(
new MetadataRestriction( MetadataCondition.COMPARE_GREATER_OR_EQUALS, "doclen", 2 )
)
.addMetadataRestriction(
new MetadataRestriction( )
.addCondition( MetadataCondition.COMPARE_GREATER, "doclen", 3 )
.addCondition( MetadataCondition.COMPARE_LESS_OR_EQUALS, "doclen", 100 )
);
// long for:
// QueryResponse response = new QueryResponse( query );
// in private static class in WebService:
Class<?> queryRequestClazz = Class.forName( "net.strus.service.impl.ws.WebService$QueryRequest" );
Constructor<?> constructor = queryRequestClazz.getDeclaredConstructor( Query.class );
constructor.setAccessible( true );
Object request = constructor.newInstance( query );
LOGGER.fine( request.toString( ) );
}
开发者ID:Eurospider,项目名称:strusJavaApi,代码行数:54,代码来源:JacksonTest.java
注:本文中的java.lang.ClassNotFoundException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论