• Executing outside of own directory

    By Alan Jacobs1 2 years ago


     How do I get CLEnotes to execute when invoked from outside its own directory? It works fine when invoked from there but not from outside.

    I have added its path to Path.
    The command is found ok but fails to execute giving the following “Error: Could not find or load main class clenotes.Main”

    I've tried creating an Environment variable called classpath and adding the clenotes path, then the class directory and then the classes\clenotes directory where clenotes.Main live … but none worked.

    I'm using Win 7 64 with 32bit Java 1.8 installed. Clenotes 5.0.6 ( As its the latest fully approved version, at the moment )

    BTW the reason for this is that when I attach a file and send it, the attachment name is the full path of the original file and this causes problems when again using clenotes to detach that attachment. I'd like to use just the filename without any path information.


    • By Sami Salkosuo 2 years ago

      You can modify classpath-option in clenotes.cmd.
      Replace existing

      java -classpath classes;lib/* clenotes.Main  %*

      with full path to classes and lib directories. For example:

      java -classpath c:/clenotes/classes;c:/clenotes/lib/* clenotes.Main  %*

      and then add clenotes.cmd to PATH and you can execute it from any directory.

      • By Alan Jacobs1 2 years ago

        Thanks, made the change to clenotes.cmd ( path was already set ). Now I don't get an error, but I also don't get any output.

        old value:
        java -cp classes;lib\com.google.guava_10.0.1.v201203051515.jar;lib\org.eclipse.xtext.xbase.lib_2.5.1.v201402030714.jar;lib\org.eclipse.xtend.lib_2.5.1.v201402030714.jar clenotes.Main %*

        new value:

        java -classpath c:\users\username\MyApps\clenotes-5.0.6\classes;c:\users\username\MyApps\clenotes-5.0.6\lib*;lib\com.google.guava_10.0.1.v201203051515.jar;lib
        \org.eclipse.xtext.xbase.lib_2.5.1.v201402030714.jar;lib\org.eclipse.xtend.lib_2.5.1.v201402030714.jar clenotes.Main %*

        • By Sami Salkosuo 2 years ago

          That's because in v5.0.6 configuration is read from config-directory and it's assumed to be in the current directory. I changed it in v5.2.

          Workaround is to copy config-directory to current directory.
          For example:

          set CLENOTES_INSTALL_DIR=d:\home\clenotes\CLENotes-5.0.6
          mkdir config
          copy %CLENOTES_INSTALL_DIR%\config\*.* config\
          java -cp %CLENOTES_INSTALL_DIR%\classes;%CLENOTES_INSTALL_DIR%\lib\com.google.guava_10.0.1.v201203051515.jar;%CLENOTES_INSTALL_DIR%\lib\org.eclipse.xtext.xbase.lib_2.5.1.v201402030714.jar;%CLENOTES_INSTALL_DIR%\lib\org.eclipse.xtend.lib_2.5.1.v201402030714.jar clenotes.Main  %*
          rmdir/s/q config

          Note that rmdir deletes config-directory even if it existed before.