📄 showxpaversion.java
字号:
/* -*- mode:java; indent-tabs-mode:nil; c-basic-offset:2 -*- * * $RCSFile$ $Revision: 1.12 $ $Date: 2006/02/01 00:20:28 $ * * Copyright (c) 2002-2003 Autonomy Corp. All Rights Reserved. * Permission to use, copy, modify, and distribute this file is hereby * granted without fee, provided that the above copyright notice appear * in all copies. */import com.ultraseek.xpa.server.*;import java.lang.Package;import java.net.URL;/** * A diagnostic that displays the version information for * <code>xpasearch.jar</code>, Java, and other required packages. */public class ShowXPAVersion { public static void main(String[] args) { ShowPackageInfo( UltraseekServer.class ); // XPA ShowPackageInfo( Object.class ); // Java ShowPackageInfo( "org.apache.commons.logging.LogFactory" ); } static void ShowPackageInfo(String klassName) { } static void ShowPackageInfo(Class klass) { Package p = klass.getPackage(); ClassLoader cl = klass.getClassLoader(); System.out.println(); // get url for the source location of the Object's class URL url = null; if (cl != null) url = cl.getResource(klass.getName().replace('.','/') + ".class"); System.out.println( "Class " + klass.getName() ); if (url != null) System.out.println( "Loaded from: " + url ); if (p==null) { System.out.println( "No package info obtained via getPackage()." ); return; } System.out.println( " getPackage()= " + klass.getPackage() ); System.out.println( " getImplementationTitle()= " + p.getImplementationTitle() ); System.out.println( " getImplementationVendor()= " + p.getImplementationVendor() ); System.out.println( " getImplementationVersion()= " + p.getImplementationVersion() ); System.out.println( " getName()= " + p.getName() ); System.out.println( " getSpecificationTitle()= " + p.getSpecificationTitle() ); System.out.println( " getSpecificationVendor()= " + p.getSpecificationVendor() ); System.out.println( " getSpecificationVersion()= " + p.getSpecificationVersion() ); System.out.println( " isSealed()= " + p.isSealed() ); /* System.out.println( "isSealed(URL url)=" + p.isSealed(URL url) ); */ if (p.getName().startsWith("com.ultraseek.xpa")) { /* Compatible with an older specification of XPA? */ String otherVersions[] = { "1.2", "1.3", "2.0", "2.1", "2.2", "2.3", "2.4" }; if (url != null && url.getProtocol().equals("jar")) { for (int i = 0; i < otherVersions.length; i++) { String other = otherVersions[i]; System.out.println( " isCompatibleWith(\"" + other + "\")= " + p.isCompatibleWith(other) ); } } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -