Package jadex.bytecode.vmhacks
Class NativeHelper
- java.lang.Object
- 
- jadex.bytecode.vmhacks.NativeHelper
 
- 
- All Implemented Interfaces:
- INativeHelper
 
 public final class NativeHelper extends java.lang.Object implements INativeHelper Helper class using JNA to provide native features.
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedNativeHelper()Create helper.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanSetAccessible()Tests if the setAccessible() method can be used.java.lang.Class<?>defineClass(java.lang.String name, byte[] b, java.lang.ClassLoader loader)Define a class in any ClassLoader.booleanisRootAdmin()Tests if the JVM is running as root/admin.static voidmain(java.lang.String[] args)Test mainvoidsetAccessible(java.lang.String flagname, java.lang.reflect.AccessibleObject accobj, boolean flag)Sets reflective object accessible without checks.booleanstartInstrumentationAgent(java.lang.String jarfile)Method for starting an instrumentation agent.booleantryChangeUser(java.lang.String username)Attempts to change the user of the process to the given name.
 
- 
- 
- 
Method Detail- 
setAccessiblepublic void setAccessible(java.lang.String flagname, java.lang.reflect.AccessibleObject accobj, boolean flag)Sets reflective object accessible without checks.- Specified by:
- setAccessiblein interface- INativeHelper
- Parameters:
- accobj- The accessible object.
- flag- The flag value.
 
 - 
canSetAccessiblepublic boolean canSetAccessible() Tests if the setAccessible() method can be used.- Specified by:
- canSetAccessiblein interface- INativeHelper
- Returns:
- True, if method can be used.
 
 - 
defineClasspublic java.lang.Class<?> defineClass(java.lang.String name, byte[] b, java.lang.ClassLoader loader)Define a class in any ClassLoader.- Specified by:
- defineClassin interface- INativeHelper
 
 - 
tryChangeUserpublic boolean tryChangeUser(java.lang.String username) Attempts to change the user of the process to the given name.- Specified by:
- tryChangeUserin interface- INativeHelper
- Parameters:
- username- The target user name.
- Returns:
- True, if successful, false if the attempt probably failed.
 
 - 
isRootAdminpublic boolean isRootAdmin() Tests if the JVM is running as root/admin.- Returns:
- True, if running as root.
 
 - 
startInstrumentationAgentpublic boolean startInstrumentationAgent(java.lang.String jarfile) Method for starting an instrumentation agent.- Specified by:
- startInstrumentationAgentin interface- INativeHelper
- Parameters:
- jarfile- The path to the jar file of the agent.
- Returns:
- True, on successful start.
 
 - 
mainpublic static void main(java.lang.String[] args) throws java.lang.ExceptionTest main- Throws:
- java.lang.Exception
 
 
- 
 
-