[ https://issues.apache.org/jira/browse/FELIX-2724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12970591#action_12970591 ]
Derek Baum commented on FELIX-2724: ----------------------------------- This is the expected behaviour for gogo. loadClass is a method on Bundle, which is not installed by default. The 'type' command shows this: g! type loadclass type: loadclass not found. false The command: addcommand b (bundle 0) creates a new command group 'b' and adds all the methods on the System bundle - including loadClass which explicitly makes the loadclass available, as shown by the 'type' command: g! type loadclass loadclass is Class b:loadclass(String) true If you want these commands available by default, you can add your own gosh_profile - the default one is embedded in the gogo.shell bundle: # default gosh_profile # only read if etc/gosh_profile doesn't exist relative to the System property # gosh.home or failing that the current directory. # catch all exceptions from this script to avoid it aborting startup try { # ensure gogo commands are found first SCOPE = gogo:* # add methods on BundleContext object as commands #addcommand context ${.context} (${.context} class) # bug: above invokes (String, Object, String) instead of (String, Object, Class) addcommand context ${.context} # add methods on System object as commands addcommand system ((${.context} bundle 0) loadclass java.lang.System) # alias to print full stack trace e = { $exception printStackTrace } ## disable console auto-formatting of each result # you will then need to explicitly use the 'format' command # to print the result of commands that don't write to stdout. #.Gogo.format = false ## disable printing the formatted result of a command into pipelines #.Format.Pipe = false # set prompt prompt = 'g! ' # print welcome message cat ($0 resolve motd) } { echo "$0: ERROR: $exception" } You can see this script adds methods on the BundleContext to the context: scope and methods on the System class to the system: scope. To add your own gosh_profile, put in in etc/gosh_profile relative to the current directory, or set the System property gosh.home and put it in ${posh.home}/etc. I need to improve profile handling, so that something like ~/.gosh/goshrc is read automatically (if it exists) like in bash. > loadclass command not available until some other command is added > ----------------------------------------------------------------- > > Key: FELIX-2724 > URL: https://issues.apache.org/jira/browse/FELIX-2724 > Project: Felix > Issue Type: Bug > Components: Gogo Shell > Affects Versions: gogo-0.6.1 > Reporter: Sahoo > > ss141...@sahoo:~/software/felix-framework-3.0.6$ java -jar bin/felix.jar > ____________________________ > Welcome to Apache Felix Gogo > g! loadclass > gogo: CommandNotFoundException: Command not found: loadclass > g! addcommand b (bundle 0) > g! loadclass > gogo: IllegalArgumentException: Cannot coerce loadclass() to any of [(String)] > As you can see from the above output, first time I tried loadclass command, > it was not available, but second time it was. I have only default felix > bundles installed. > g! lb > START LEVEL 1 > ID|State |Level|Name > 0|Active | 0|System Bundle (3.0.6) > 1|Active | 1|Apache Felix Bundle Repository (1.6.2) > 2|Active | 1|Apache Felix Gogo Command (0.6.1) > 3|Active | 1|Apache Felix Gogo Runtime (0.6.1) > 4|Active | 1|Apache Felix Gogo Shell (0.6.1) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.