Getting list of classes?
Hello all, I was just wondering if there is any way to get a list of all the known classes in a certain package? I know I can get a list of the packages themselves, but not sure about how to go about getting the actual classes.
Thanks for the help!
-Nick
If you only want to get a classes list from a jar package,read the api specof java.uitil.jar.
java.uitil.jar privides classes for reading and writing the jar file.
So I think it can satisify your requirement.
Similar Messages
-
How to get list of classes in classpath?
Hi.
I need to get list of classes in CLASSPATH which implements the some interface.
How i can get list of classnames from CLASSPATH ?
TIAWhat you want to do is not that trivial.Its not trivial, but its not really all that hard either.
I this thing quite a bit in JUnit tests (e.g, all SomeInterface implementations are expected to be serializable - lets hunt them out and check we can actually serialize them. Turned out to do that I needed a generic yet fairly intellegent object creator / populator: That was significantly less trivial than the other task). -
Getting list of classes from a jar
Hi
I want to retrieve list of class names from a jar. i used URLClassLoader and it retrieves pakcage name but i don't know how to retrieve class namesI don't know if this is the best way, but I did this once before like this:import java.util.jar.JarEntry;
import java.util.jar.JarFile;
// then you can do this
String path = "path to some JAR file goes here";
JarFile jar = new JarFile(path);
Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements())
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (name.endsWith(".class"))
// this is a class entry
} -
Get list of classes present in an applet's Jar file?
I have an applet for drawing diagrams, which is bundled in a jarfile together with classes for each type of element in the drawing (e.g. a class for drawing 2-input NAND gates, a class for J-K flip-flops, and so on). When I add a new type of drawing element I have to modify the applet to add the new class to the applet's "Insert" menu to allow the element to be inserted. What I want to do is to search the jarfile containing the applet for any classes derived from DrawingElement and add them automatically to the Insert menu when the applet is inited. I presume this would require using getClass().getClassLoader() to get the class loader that read the JAR file, but from there it would seem I need to know the name of the resource to load. Is there a way of browsing the list of resources in the JAR file?
AndrewThompson64 wrote:
That 'modify the applet' is not strictly necessary. The list of menu items and classes might be passed to the applet as applet parameters, or as a property file or XML (or whatever) that defines the available elements.I could do this -- I'm just trying to avoid getting the list out of step with the contents (or if you prefer, I'm just being lazy!).
Is there a way of browsing the list of resources in the JAR file?Yes and no. You might try this general strategy (untested).
1) Gain an URL to a resource in the Jar in which the plug-ins exist.
2) Parse that URL for everything before the '!' symbol to get an URL for the Jar itself.
3) Get an InputStream from the Jar via URL.openStream().
4) Get a ZipInputStream by wrapping the InputStream.
5) Iterate the ZipEntry(s) to identify classes in the correct package, and store them in a collection of some type.
6) Iterate the collection and check each one for extending DrawingElement, using reflection.
I am guessing step 6 will require the applet to be trusted.Sounds plausible, and I'll give it a whirl. However, I hadn't thought about the "trusted" bit of this; maybe I can just create new instances and cast to DrawingElement, ignoring any that throw exceptions. I'll have to give it a go and see what happens.
BTW - once you have the right classes, how do you get the screen name of them? Is the name defined in one of the attributes of a DrawingElement? What prevents name clashes?Plan A: I have a getIdentification() method that returns a string identifying the element, but I have to keep this unique the hard way (by hand).
Plan B: use the class name with some prettification (e.g. have a class _2_input_NAND_gate which gets displayed as "2 input NAND gate") so that the compiler does the work of keeping it unique. Not sure I like this, though.
Many thanks for your help. -
Func/BAPY to get list of objects from Material class
Hi guys,
I am looking for BAPI/FUNC to get list of material/objects if I know Class and Class type. In MM02 I am doing following: In selection of input I choose Materilas of Class there I write Class and Class type, and then there is icon FIND IN INITIAL CLASS after clicking that icon I get list of materials for entered class.
Can you advise me which BAPI/Func do that or in which tables I can find this DATA.
Thanks very much for any help.
ZbynekZbynek,
Try using this BAPI....<b>BAPI_CLASS_SELECT_OBJECTS</b>
Actually you can do this by directly going to tables....
First using the class type and class number, go to KLAH tables... get the Int class no. (KLAH-CLINT). Using this go to KSSK table and use the KLAH-CLINT value in KSSK-CLINT and adda another condition like KSSK-MAFID = 'O'.
Hope this helps...
Please provide reward points if you find this reply helpful.
Balaji -
We are setting up registrations for a paid event and have bought a SSL certificate for our site. Everything works fine when the registration page is accessed through IE, Chrome, Opera or Safari (which list StartCom Class 2 Primary Intermediate Server CA as a Trusted Intermediate Certification Authority), but when I click on that link in Firefix I get the "This Connection is Untrusted" page because only StartCom Class 1 is listed as trusted.
Why is that?It is always the responsibility of a website to send the complete certificate chain.
You can check the certificate chain of breastfeedingconference.asn.au and see that the server doesn't send the intermediate certificate.
* http://www.networking4all.com/en/support/tools/site+check/ -
How to get SDKODBC Wrapper class for indesign cs3
Hi,
I have to implement the mysql database with my indesign plugin. I didn't have a SDKODBC Wrapper class. Can any one say how to get SDKODBC Wrapper class from adobe.
Regards,
saravanan.I doubt if change documents are generated for SE78 transaction.
For list of change documents defined, please check table: TCDOB.
Hope this helps.
Kind Regards
Eswar -
Hi
I need to know the command for getting list of softwares installed on all the remote systems in network which are existing in their respective registry like HKEY_LOCAL_MACHINE\SOFTWARE of all other systemsHey
Sorry this isn't powershell but it should do the job if you want to use it. The problem with using the Win32_Product WMI Class to enumerate the installed software (especially on Windows 2000 & 2003 Servers) is that the WMI class is NOT installed by default. Here is a VBScript i wrote to read a list of hostnames from a text file named "ComputerNames.txt" from the scripts directory and attempt to remotely enumerate all subkeys within the following registry key
HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall
For each subkey enumerated it will attempt to read the value of the "DisplayName" key and output the results to a csv file.
(the results should be the same as what you would see when you open Add/Remove Programs)
Hope that helps
Cheers
Matt :)
'Script Name : CheckInstalledSoftware.vbs
'Author : Matthew Beattie
'Created : 01/03/10
'Description : This script reads a list of hostnames from a text file name "ComputerNames.txt" in the scripts working
' : directory. For each hostName it requests an ICMP response and if successfull attempts a remote registry
' : connection to enumerate and read the registry values of installed software. All results are logged to the
' : scripts working directory in a log file per computer name.
'Initialization Section
Option Explicit
Const ForReading = 1
Const ForAppending = 8
Dim objFSO, wshNetwork, wshShell, hostName
Dim scriptBaseName, scriptPath, scriptLogPath
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set wshShell = CreateObject("WScript.Shell")
Set wshNetwork = CreateObject("WScript.Network")
scriptBaseName = objFSO.GetBaseName(Wscript.ScriptFullName)
scriptPath = objFSO.GetFile(Wscript.ScriptFullName).ParentFolder.Path
scriptLogPath = scriptPath & "\" & IsoDateString(Now)
If Err.Number <> 0 Then
Wscript.Quit
End If
On Error Goto 0
'Main Processing Section
On Error Resume Next
PromptStart
ProcessScript
If Err.Number <> 0 Then
Wscript.Quit
End If
PromptEnd
On Error Goto 0
'Functions Processing Section
'Name : ProcessScript -> Primary Function that controls all other script processing.
'Parameters : None ->
'Return : None ->
Function ProcessScript
Dim fileSpec, hostNames, regKey, keyName, results, result
keyName = "DisplayName"
regKey = "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall"
fileSpec = scriptPath & "\ComputerNames.txt"
'Ensure the "ComputerNames.txt" file exists within the scripts working directory.
If Not objFSO.FileExists(fileSpec) Then
MsgBox DQ(fileSpec) & " does not exist!", vbCritical, scriptBaseName
Exit Function
End If
'Read the list of hostNames from the "ComputerNames.txt" text file within the scripts working directory.
If Not GetScriptInput(hostNames, fileSpec) Then
Exit Function
End If
'Attempt to read the registry from each hostname read from the list of hostnames.
For Each hostName In hostNames
Do
'Ensure the system responds to an ICMP request.
If Not CheckConnection(hostName) Then
LogMessage 2, "Failed to respond to an ICMP Request"
Exit Do
End If
'Enumerate and read the registry values.
If Not GetRegValues(results, hostName, keyName, regKey) Then
Exit Do
End If
'Log the registry values results.
For Each result In results
LogMessage 0, result
Next
Loop Until True
Next
End Function
'Name : GetScriptInput -> Reads a text file to be used as Script input.
'Parameters : items -> Output: An array of items in the script input file.
' : fileSpec -> The full folder Path, file Name and extention of the script input file.
'Return : GetScriptInput -> Returns an array of items for script input and True or False.
Function GetScriptInput(items, fileSpec)
Dim scriptInputFile, itemsDict, item
GetScriptInput = False
Set itemsDict = NewDictionary
If Not objFSO.FileExists(fileSpec) Then
Exit Function
End If
On Error Resume Next
Set scriptInputFile = objFSO.OpenTextFile(fileSpec, ForReading)
If Err.Number <> 0 Then
Exit Function
End If
On Error Goto 0
Do Until scriptInputFile.AtEndOfStream
item = scriptInputFile.ReadLine
If item = "" Then
Exit Function
End If
If Not itemsDict.Exists(item) Then
itemsDict.Add item, ""
End If
Loop
items = itemsDict.Keys
GetScriptInput = True
End Function
'Name : CheckConnection -> Checks a remote host using WMI ping.
'Parameters : hostName -> Hostname of computer system to verify network connectivity with.
'Return : Boolean -> True if hostname replies. False otherwise.
Function CheckConnection(hostName)
Dim ping, response, replied
Set ping = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("select * from Win32_PingStatus where address = '" & hostName & "'")
For each response in ping
replied = Not IsNull(response.StatusCode) And response.StatusCode = 0
Next
CheckConnection = replied
End Function
'Name : GetRegValues -> Enumerates the subkeys in a registry key and the values of the keyName.
'Parameters : hostName -> String containing the hostName of the system to enumerate the registry keys on.
' : keyName -> String containing the name of the registry key value to enumerate.
' : regKey -> Registry key to enumerate subkey names for.
'Return : GetRegValues -> Returns True and an Array containing the registry key values otherwise False.
Function GetRegValues(results, hostName, keyName, regKey)
Dim objReg, regDict, rootKey, hive, keyValue, subKeys, i
GetRegValues = False
rootKey = regKey
hive = GetRegistryHiveFromKey(rootKey)
On Error Resume Next
If hive <> 0 Then
'Create a dictionary object to store the registry values in.
Set regDict = NewDictionary
If Err.Number <> 0 Then
LogMessage 1, "Creating Dictionary Object"
Exit Function
End If
'Connect to the remote registry.
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & hostName & "\root\default:StdRegProv")
If Err.Number <> 0 Then
LogMessage 1, "Creating StdRegProv Object"
Exit Function
End If
'Enumerate the subkey names within the regKey paramater.
objReg.EnumKey hive, rootKey, subKeys
If Err.Number <> 0 Then
LogMessage 1, "Enumerating Registry Keys"
Exit Function
End If
'Ensure the results are an array.
If Not IsArray(subKeys) Then
subKeys = Array(subKeys)
End If
'Read the registry key value for each subkey. Add the results to the dictionary.
For i = 0 to UBound(subKeys)
objReg.GetStringValue hive, rootKey & "\" & subKeys(i), keyName, keyValue
If Err.Number = 0 Then
If Not IsNull(keyValue) Then
regDict(regDict.Count) = keyValue
End If
Else
Err.Clear
End If
Next
End If
On Error Goto 0
results = regDict.Items
GetRegValues = True
End Function
'Name : GetRegistryHiveFromKey -> Get the hive ID from a registry key name.
'Parameters: Input/Output: key -> Registry key name. Hive name will be removed.
'Return : GetRegistryHiveFromKey -> ID of hive of given key name (0 if invalid).
' : -> The hive name is removed from the input key name.
Function GetRegistryHiveFromKey (key)
Dim pos, hive
pos = Instr (key, "\")
If pos = 0 Then
pos = Len(key) + 1
End If
hive = Left (UCase (Left (key, pos - 1)) & " ", 4)
key = Mid (key, pos + 1)
GetRegistryHiveFromKey = Array(0, &H80000000, &H80000001, &H80000002, &H80000003, &H80000005, &H80000006) _
(Int ((Instr("HKCR,HKCU,HKLM,HKU ,HKCC,HKDD", hive) + 4) / 5))
End Function
'Name : NewDictionary -> Creates a new dictionary object.
'Parameters : None ->
'Return : NewDictionary -> Returns a dictionary object.
Function NewDictionary
Dim dict
Set dict = CreateObject("scripting.Dictionary")
dict.CompareMode = vbTextCompare
Set NewDictionary = dict
End Function
'Name : DQ -> Place double quotes around a string and replace double quotes
' : -> within the string with pairs of double quotes.
'Parameters : stringValue -> String value to be double quoted
'Return : DQ -> Double quoted string.
Function DQ (ByVal stringValue)
If stringValue <> "" Then
DQ = """" & Replace (stringValue, """", """""") & """"
Else
DQ = """"""
End If
End Function
'Name : IsoDateTimeString -> Generate an ISO date and time string from a date/time value.
'Parameters : dateValue -> Input date/time value.
'Return : IsoDateTimeString -> Date and time parts of the input value in "yyyy-mm-dd hh:mm:ss" format.
Function IsoDateTimeString(dateValue)
IsoDateTimeString = IsoDateString (dateValue) & " " & IsoTimeString (dateValue)
End Function
'Name : IsoDateString -> Generate an ISO date string from a date/time value.
'Parameters : dateValue -> Input date/time value.
'Return : IsoDateString -> Date part of the input value in "yyyy-mm-dd" format.
Function IsoDateString(dateValue)
If IsDate(dateValue) Then
IsoDateString = Right ("000" & Year (dateValue), 4) & "-" & _
Right ( "0" & Month (dateValue), 2) & "-" & _
Right ( "0" & Day (dateValue), 2)
Else
IsoDateString = "0000-00-00"
End If
End Function
'Name : IsoTimeString -> Generate an ISO time string from a date/time value.
'Parameters : dateValue -> Input date/time value.
'Return : IsoTimeString -> Time part of the input value in "hh:mm:ss" format.
Function IsoTimeString(dateValue)
If IsDate(dateValue) Then
IsoTimeString = Right ("0" & Hour (dateValue), 2) & ":" & _
Right ("0" & Minute (dateValue), 2) & ":" & _
Right ("0" & Second (dateValue), 2)
Else
IsoTimeString = "00:00:00"
End If
End Function
'Name : LogMessage -> Parses a message to the log file based on the messageType.
'Parameters : messageType -> Integer representing the messageType.
' : -> 0 = message (writes to a ".csv" file)
' : -> 1 = error, (writes to a ".err" file including information relating to the error object.)
' : -> 2 = error message (writes to a ".err" file without information relating to the error object.)
' : message -> String containing the message to write to the log file.
'Return : None ->
Function LogMessage(messageType, message)
Dim prefix, logType
prefix = hostName
Select Case messageType
Case 0
logType = "csv"
Case 1
logType = "err"
message = "Error " & Err.Number & " (Hex " & Hex(Err.Number) & ") " & message & ". " & Err.Description
Case Else
LogType = "err"
End Select
If Not LogToCentralFile(scriptLogPath & "." & logType, hostName & "," & message) Then
Exit Function
End If
End Function
'Name : LogToCentralFile -> Attempts to Appends information to a central file.
'Parameters : logSpec -> Folder path, file name and extension of the central log file to append to.
' : message -> String to include in the central log file
'Return : LogToCentralFile -> Returns True if Successfull otherwise False.
Function LogToCentralFile(logSpec, message)
Dim attempts, objLogFile
LogToCentralFile = False
'Attempt to append to the central log file up to 10 times, as it may be locked by some other system.
attempts = 0
On Error Resume Next
Do
Set objLogFile = objFSO.OpenTextFile(logSpec, ForAppending, True)
If Err.Number = 0 Then
objLogFile.WriteLine message
objLogFile.Close
LogToCentralFile = True
Exit Function
End If
Randomize
Wscript.sleep 1000 + Rnd * 100
attempts = attempts + 1
Loop Until attempts >= 10
On Error Goto 0
End Function
'Name : PromptStart -> Prompt when script starts.
'Parameters : None ->
'Return : None ->
Function PromptStart
MsgBox "Now processing the " & DQ(Wscript.ScriptName) & " script.", vbInformation, scriptBaseName
End Function
'Name : PromptEnd -> Prompts when script has completed.
'Parameters : None ->
'Return : None ->
Function PromptEnd
MsgBox "The " & DQ(Wscript.ScriptName) & " script has completed successfully.", vbInformation, scriptBaseName
End Function
'Name : PromptError -> Prompts when an unexpected script error occurs.
'Parameters : None ->
'Return : None ->
'Function PromptEnd
' MsgBox "Error " & Err.Number & " (Hex " & Hex(Err.Number) & "). " & Err.Description, vbCritical, scriptBaseName
'End Function -
Getting Bad Applet class name exception while opening applet.
Hi,
While opening an applet in my mac os x v10.6.8 machine i am getting "Bad Applet class name exception" which is working fine in mac os x v10.7.5.Java version in my mac is 1.6.0_43.Can anyone please help me to resolve this.Apple barred Java from running on Macs in order to safeguard users by blocking Java 7 Update 11 and adding it to the banned list in XProtect.
This was the second time in two weeks that Apple had blocked Oracle's code from running on Macs. The threat was so serious that the U.S. Department of Homeland Security had recommended that all Java 7 users disable or uninstall the software until a patch was issued. This time Java is blocked through Apple's XProtect anti-malware feature.
Java has come under fire as the means by which hackers have been able to gain control of computers. In April 2012 more than 600,000 Macs were reported to have been infected with a Flashback Trojan horse that was being installed on people's computers with the help of Java exploits. Then in August Macs were again at risk due to a flaw in Java, this time around, there was good news for Mac users: Thanks to changes Apple has made, most of us were safe from the threat.
Unwilling to leave its customers open to potential threats Apple decided it's safer to block Java entirely.
In order to block older versions of Flash, Apple has updated its "Xprotect.plist" file so that any versions that come before the current one (version 11.6.602.171) cannot be used on a Mac. Users who have older versions of Flash installed will be greeted with an alert that says "Blocked plug-in," and Safari will prompt the user to update to a newer version.
Macs running OS X Snow Leopard and beyond are affected.
UPDATE for those running Lion or Mountain Lion:
Oracle on Friday February 1 released a new version reportedly addressing vulnerabilities seen with the last build.
Apple disabled Java 7 through the OS X XProtect anti-malware system, requiring users to have at least version "1.7.0_10-b19" installed on their Macs. The release dated February 1 carries the designation "1.7.0_13-b20," meeting Apple's requirements.
Oracle "strongly recommends" applying the CPU fixes as soon as possible, saying that the latest Critical Patch Update contains 50 new security fixes across all Jave SE products.
Update for Snow Leopard users:
Apple issued update 12 for Java for OS 10.6:
http://support.apple.com/kb/DL1573
Note: On systems that have not already installed Java for Mac OS X 10.6 update 9 or later, this update will configure web browsers to not automatically run Java applets. Java applets may be re-enabled by clicking the region labeled "Inactive plug-in" on a web page. If no applets have been run for an extended period of time, the Java web plug-in will deactivate.
If, after installing Java for OS X 2013-002 and the latest version of Java 7 from Oracle, you want to disable Java 7 and re-enable the Apple-provided Java SE 6 web plug-in and Web Start functionality, follow these steps:
http://support.apple.com/kb/HT5559?viewlocale=en_US
Further update:
Apple issued this Java related security update No. 13 on February 19:
http://support.apple.com/kb/HT5666
and Update No. 14 on March 4: http://support.apple.com/kb/DL1573
http://support.apple.com/kb/HT5677
You should also read this:
https://support.apple.com/kb/HT5672
The standard recommendation is for users to turn off Java except when they have to use it on known and trusted websites (like their bank). Javascript, which is unrelated despite the name, can be left on.
Further useful comment in this article:
http://www.macworld.co.uk/macsoftware/news/?newsid=3435007&olo=email -
Better way how to get list of all classpath URLs in runtime
Hello everyone,
How to get list of all classpath items (URLs) in runtime from Java code?
I am aware of solution based on System.getProperty("java.class.path"). Is there any alternative?
This solution has several drawbacks. You have to parse String output. And I not sure if it contains ALL resources (JARs, class directories) loaded by ClassLoader or just reflects -cp arguments.
Does system property "java.class.path" contain ALL loaded JARs?
Does it contain items (JARs, class directories) loaded by bootstrap classpath?
What about JARs loaded in runtime?
Is the separator ":" always same on all operation systems?
I was looking for some Java API based solution, method like List<URL> getAllClasspathItems()
But there is nothing like this in ClassLoader, Class, Runtime or System classes.
For curious, here is code I use.
String classpath = System.getProperty("java.class.path");
StringTokenizer st = new StringTokenizer(classpath, ":");
while (st.hasMoreElements()) {
System.out.println(st.nextElement());
}For curious, here are output prints for all 3 methods:
1) parsing system property
2) tschodt
3) overcast SystemClassLoader to URLClassLoader
/home/espinosa/workspace/jboss_embedded_test1/target/test-classes
/home/espinosa/workspace/jboss_embedded_test1/target/classes
/opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
/opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
/opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
package com.sun.org.apache.xerces.internal.impl.validation, Java Platform API Specification, version 1.6
package com.thoughtworks.qdox.directorywalker
package com.sun.org.apache.xerces.internal.parsers, Java Platform API Specification, version 1.6
package java.util.jar, Java Platform API Specification, version 1.6
package org.testng.internal.thread
package com.sun.org.apache.xerces.internal.util, Java Platform API Specification, version 1.6
package java.net, Java Platform API Specification, version 1.6
package sun.reflect.misc, Java Platform API Specification, version 1.6
package esp.ejb.samples1.test
package sun.security.provider, Java Platform API Specification, version 1.
file:/home/espinosa/workspace/jboss_embedded_test1/target/test-classes/
file:/home/espinosa/workspace/jboss_embedded_test1/target/classes/
file:/opt/javalibs/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar
file:/opt/javalibs/javax/jms/jms/1.1/jms-1.1.jar
file:/opt/javalibs/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
...Interestingly, method 1 and 3 gives the same list, same order, same count, just format of item is a little bit different. The order is same as in Eclipse .classpath file.
Method 2 (tschodt) give significantly more items! rougly 3x! Different order (somewhat random it seems to me). Some items contain extra information, like version and string "Java Platform API Specification".
It prints not absolute paths but logical Java names. -
Need to get list of all portlet instances in system
Hi guys
Probably such question already was here, but I cant find any solution.
I need to get list of instance labels of all portlets used on all desktops in current domain.
Thanks for help.
Edited by AndreW at 04/08/2008 8:23 AMHi
you havent told me the version you are using.
For 8.1 (and i suppose you should have similar classes in 10)
get a IDesktopDefinitionManager from the DesktopDefinitionManagerHome
IDesktopDefinitionManager.getDesktopDefinitions --> gets all the definition
for each definition IDesktopDefinitionManager.getDesktopView
from the desktopView get the Primary BookView.
recursively go through the book view to get getNavigableView . if the navigable is itself a BookView , recurse. if it is a pageView then get the PlaceableView. If the placeable view is of type BookView then do the recursive stuff, else if it is a PortletView you have what you want.
regards
deepak -
Obtaining list of classes used in an application
I want to be able to obtain a list of all the classes and interfaces that an application uses
I have been looking at the Class Object but with limited success
I can get only limited things from the class
eg the superclasses, interfaces, innerclasses, and public variables
but I want to be able to get which private classes are used also
the code below shows my test code to get info about a class
Class testClass = (new java.awt.Panel()).getClass();
Class classList[] = testClass.getClasses();
for(int i = 0; i < classList.length; i++)
System.out.println("class "+i+" = "+classList);
Class innerClassList[] = testClass.getDeclaredClasses();
for(int i = 0; i < innerClassList.length; i++)
System.out.println("innerClass "+i+" = "+innerClassList[i]);
java.lang.reflect.Field fieldList[] = testClass.getFields();
for(int i = 0; i < fieldList.length; i++)
System.out.println("field "+i+" = "+fieldList[i]);
java.lang.reflect.Field innerFieldList[] = testClass.getDeclaredFields();
for(int i = 0; i < innerFieldList.length; i++)
System.out.println("innerField "+i+" = "+innerFieldList[i]);
Object interfaceList[] = testClass.getInterfaces();
for(int i = 0; i < interfaceList.length; i++)
System.out.println("interface "+i+" = "+interfaceList[i]);
Class nextSuper = testClass;
while(nextSuper != null){
System.out.println("Class "+nextSuper);
nextSuper = nextSuper.getSuperclass();
The reason that I want to do this is:
When I use an application I want to be able to get the version of each of the classes I use.
Ideally I would build up a set of classes used in the application (and the classes that those classes use, etc, etc)
as I did this I would filter for things that start with my class hierarchy.
and I would save the public String of each class that stores the version.
Then heypresto I would have a list of all the classes of mine that are used and their version numbers.The idea is to write your own class which extends classloader, then use an instance of that to load the program you're trying to examine. When java wants to use a class it calls a classloader giving it the class name and package e.g. "java.lang.String". The classloader then checks to see if the class is already there, and if not attempts to load it, usually from a .class or .jar file.
When classes loaded with a particular class loader go looking for other classes they call the classloader than loaded them.
So if you load your main program class through your own classloader then any classes it demands (and those they demand), will also be looked for through your classloader. Since class loading is a dynamic process you actually need to run the application (having loaded your main class use getMethod to get the main method then Method.invoke(..).
Mind you if java -verbose:class does the job (and it looks to me like it does) that's a lot simpler.
Just run your program with that and analyse the resulting list of load events. -
How do I list all classes in a Jar file?
How do I list all classes in a Jar file?
Its no problem if the jar file contains classes, but I have an EAR file, which contains a jar-file, and I want to list all classes in that jar-file.
I would like to do something like this:
java.util.jar.JarFile jarfile = new java.util.jar.JarFile( new File("/meYear.ear"), true );
java.util.jar.JarEntry jar = jarfile.getJarEntry( "myJar.jar" );
// Cast it to a new JarFile:
java.util.jar.JarFile newJar = (java.util.jar.JarFile)jar;
But the method getEntry returns something like jarFile$JarEntry, if I try to class cast it I get an classCastException. -
Complete list of class IDs and names
Is there a complete list of all the built-in class IDs with their corresponing names?
I have looked at the LV2012 Class ID Property help page located here: http://zone.ni.com/reference/en-XX/help/371361J-01/lvprop/gen_class_id/, but this is incomplete. For example, the RadioButtonsControl has an ID of 72 and is not listed.
Or better yet, are there any VIs out there that can convert a U32 ID value into the corresponding class name?
Solved!
Go to Solution.I've taken Paul's VI and expanded it to loop through a few hundred numbers and ignore any errors. I've also downcasted it to 2009 for you. Hopefully this is the complete list you're looking for.
Value 1 = Application
Value 2 = VI
Value 3 = Generic
Value 4 = Decoration
Value 5 = Text
Value 6 = Control
Value 7 = ColorBox
Value 8 = Boolean
Value 9 = RefNum
Value 10 = LVVariant
Value 11 = Path
Value 12 = ListBox
Value 13 = Table
Value 14 = Array
Value 15 = Picture
Value 16 = ActiveXContainer
Value 17 = Numeric
Value 18 = Digital
Value 19 = NamedNumeric
Value 20 = ColorRamp
Value 21 = Slide
Value 22 = GraphChart
Value 23 = WaveformChart
Value 24 = WaveformGraph
Value 25 = IntensityChart
Value 26 = IntensityGraph
Value 27 = String
Value 28 = IOName
Value 29 = ComboBox
Value 30 = Cluster
Value 31 = Panel
Value 32 = Knob
Value 33 = NumericWithScale
Value 34 = Ring
Value 35 = Enum
Value 36 = GObject
Value 37 = Plot
Value 38 = Cursor
Value 39 = NumericText
Value 40 = Scale
Value 41 = ColorScale
Value 42 = GraphScale
Value 43 = ColorGraphScale
Value 44 = TypedRefNum
Value 45 = Generic
Value 46 = MulticolumnListbox
Value 47 = WaveformData
Value 48 = DSCTag
Value 49 = DAQChannelName
Value 50 = VISAResourceName
Value 51 = IVILogicalName
Value 52 = SlideScale
Value 53 = PageSelector
Value 54 = Page
Value 55 = TabControl
Value 56 = ConnectorPane
Value 57 = DAQmxName
Value 58 = VIRefNum
Value 59 = LVObjectRefNum
Value 60 = AbsTime
Value 61 = DigitalTable
Value 62 = SubsystemVI
Value 63 = Generic
Value 64 = Generic
Value 65 = SubPanel
Value 66 = TreeControl
Value 67 = GenClassTagRef
Value 68 = GenClassRef
Value 69 = RotaryColorScale
Value 70 = PlugInControl
Value 71 = PlugInDDODummyContainer
Value 72 = RadioButtonsControl
Value 73 = Project
Value 74 = ProjectItem
Value 75 = Pane
Value 76 = Splitter
Value 77 = BuildSpecification
Value 78 = Pixmap
Value 79 = FacadeVI
Value 80 = Library
Value 81 = Variable
Value 82 = TagSet
Value 83 = XYGraph
Value 84 = SceneWindow
Value 85 = LVClassLibrary
Value 86 = Generic
Value 87 = MethodVI
Value 88 = XControlLibrary
Value 89 = XNodeLibrary
Value 90 = Scrollbar
Value 91 = LVTarget
Value 92 = MixedSignalGraph
Value 93 = Provider
Value 94 = CopyOperation
Value 95 = TargetItem
Value 96 = ProjectItemType
Value 97 = CopyItem
Value 98 = CopyConflict
Value 99 = CopyExpert
Value 100 = SceneGraphDisplay
Value 101 = PolymorphicVI
Value 102 = LabVIEWClassControl
Value 103 = XInterfaceLibrary
Value 104 = SceneNode
Value 105 = SceneObject
Value 106 = SceneLight
Value 107 = Generic
Value 108 = Generic
Value 109 = Generic
Value 110 = SceneClipPlane
Value 111 = SceneTexture
Value 112 = SceneGeometry
Value 113 = SceneBox
Value 114 = SceneCone
Value 115 = SceneCylinder
Value 116 = SceneHeightField
Value 117 = SceneSphere
Value 118 = SceneMesh
Value 119 = XPropertyFolder
Value 120 = PropertyFolder
Value 121 = DigitalGraph
Value 122 = GenClassTagFlatRef
Value 123 = Scene
Value 124 = Generic
Value 125 = LibraryData
Value 126 = StatechartLibrary
Value 127 = MixedCheckbox
Value 128 = SceneDrawable
Value 129 = SceneText
Value 130 = MultiSegmentPipe
Value 131 = Bus
Value 132 = StubDDO
Value 133 = ProjectFilesViewItem
Value 134 = LVClassPropDefFolder
Value 135 = DataValRefNum
Attachments:
Get Name from Class ID.vi 7 KB -
Hi,
I created with JDeveloper (version 10.1.3.2) a simple ADF Swing application. I used class JTable and data bindings. But could not get some informations from page definition in my java code. Yes, I had a file "*PageDef.xml", where I saw values^
<pageDefinition>
<bindings>
<table>
<AttrNames>
<Item Value="Name"/>
I need to get list "AttrNames", but I did know how!
Please, help me!
Thank.Did you not see the properties associated with findGlyphPreferences? Your query isn't entirely clear, but I'm guessing you're after something like this:
app.findGlyphPreferences = null;
app.findGlyphPreferences.glyphID = myId;
myDoc.findGlyph();
Though if you want to find all the glyphs in a document you wouldn't need findGlyph, would you?
Peter
Maybe you are looking for
-
How to increase No. of attempt to Lock user account in DB
Hi, How to increase the number of attempt [by giving wrong password] to lock the user account in DB Connection? We have default feature as No. of attempt is 3 by giving wrong password to lock the user account. Is it possible to increase the no. of ti
-
French special characters not displayed properly in discoverer 11g
Gurus We are upgrading to discoverer 11.1.1.3 I have found that French special characters (letters with accents) are not displayed properly in the discoverer tool menu. Example Sélectionner is displayed as S?lectionner. This doesn't seem to be a serv
-
Hi there, So I'm getting a tad frustrated with this BBM copying issue. As I select the text, choose copy as its the only option, it then reads message copied...my where to?? where is it copied to?? I seem to have no clipboard so where can I find it?
-
How to install Route 66 navigation software on N95...
I am trying to install Route 66 Mobile 7 Benelux navigation software on my N95. The software manufacturer has given me the instructions below, but this still has not worked. I cannot see the Rooute 66 Icon in the phone. Can someone help? Thanks The i
-
New Macbook, what's in the box?
Hello all, just bought a new refurbished Macbook 2.0 to replace my aging ibook. I really miss the pretty boxes with the new ones, not the plan brown ones of the refurbs (reminds me of a dell shudder). Anyway, the software/manual pack seems to be a li