javashelljprofiler

Not able to start Jprofiler and error message is not clear


I have a shells script running

#!/bin/sh
echo -n "Starting JProfiler... "
nohup java -agentpath:/opt/jprofiler13.0.2/bin/linux- x64/libjprofilerti.so=port=8864,nowait

After running the script I see following but Jprofiler never started even though it says VM initialized.

JProfiler> 64-bit library
JProfiler> Starting up without initial configuration.
JProfiler> Listening on port: 8865.
JProfiler> Enabling native methods instrumentation.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Retransforming 110 base class files.
JProfiler> Base classes instrumented.
Usage: java [options] <mainclass> [args...]
           (to execute a class)
   or  java [options] -jar <jarfile> [args...]
           (to execute a jar file)
   or  java [options] -m <module>[/<mainclass>] [args...]
       java [options] --module <module>[/<mainclass>] [args...]
           (to execute the main class in a module)
   or  java [options] <sourcefile> [args]
           (to execute a single source-file program)

 

Arguments following the main class, source file, -jar <jarfile>,
 -m or --module <module>/<mainclass> are passed as the arguments to
 main class.

 where options include:

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
    --class-path <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -p <module path>
    --module-path <module path>...
                  A : separated list of directories, each directory
                  is a directory of modules.
    --upgrade-module-path <module path>...
                      A : separated list of directories, each directory
                  is a directory of modules that replace upgradeable
                  modules in the runtime image
    --add-modules <module name>[,<module name>...]
                  root modules to resolve in addition to the initial module.
                  <module name> can also be ALL-DEFAULT, ALL-SYSTEM,
                  ALL-MODULE-PATH.
    --list-modules
                  list observable modules and exit
    -d <module name>
    --describe-module <module name>
                  describe a module and exit
    --dry-run     create VM and load main class but do not executee main method.
                  The --dry-run option may be useful for validating the
                  command-line options such as the module system configuration.
    --validate-modules
                  validate all modules and exit
                  The --validate-modules option may be useful for finding
                  conflicts and other errors with modules on the module path.
    -D<name>=<value>

Solution

  • This is not a way to start JProfiler. On Linux/Unix, the JProfiler UI is started by executing the shell script bin/jprofiler.

    What your shell script does is the same as just executing java - which gives you the usage help text.

    With the -agentpath VM parameter, you load the JProfiler agent into the JVM. This is how you would manually start a JVM for profiling, but you would have to specify the class path and your main class as well.