GavriYashar / Matlab-Editor-Plugin

Extends features for the matlab editor, Bookmarks, FileStructure, Clipboard stack
MIT License
74 stars 12 forks source link

Installation uses Matlab Packages which are not available during the installation process #144

Open qlahcim opened 5 years ago

qlahcim commented 5 years ago

When I try to install MEP on Linux Mint 18.3 with Matlab R2018b, I always get the following error message:

Long stack trace ``` kva@lr17:~/Documents/MATLAB$ java -jar MEP_1.34.jar Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/mathworks/services/settings/SettingNotFoundException at at.mep.installer.JPanelInstall.copyFiles(JPanelInstall.java:378) at at.mep.installer.JPanelInstall.doInstall(JPanelInstall.java:295) at at.mep.installer.JPanelInstall.access$700(JPanelInstall.java:14) at at.mep.installer.JPanelInstall$4.actionPerformed(JPanelInstall.java:238) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6539) at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6304) at java.awt.Container.processEvent(Container.java:2239) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2297) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4535) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4476) at java.awt.Container.dispatchEventImpl(Container.java:2283) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84) at java.awt.EventQueue$4.run(EventQueue.java:733) at java.awt.EventQueue$4.run(EventQueue.java:731) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74) at java.awt.EventQueue.dispatchEvent(EventQueue.java:730) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) Caused by: java.lang.ClassNotFoundException: com.mathworks.services.settings.SettingNotFoundException at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 40 more ```

I would like to avoid manual installation, because I plan to install MEP on many desktop PCs with linux.

Any help???

GavriYashar commented 5 years ago

could you try this version? MEP_1.35.jar.zip

I could also add the possibility to define the 3 paths with command line arguments. e.g.: java -jar mep... "jarpath" "javaclasspath" "installdir"

qlahcim commented 5 years ago

OK ... thanks for help. After command: java -jar MEP_1.35.jar

was automatically created a directory MEP at ~/Documents/MATLAB with the following content:

kva@lr17:~/Documents/MATLAB/MEP$ tree -a
.
├── CustomProps.properties
├── DefaultProps.properties
├── matconsolectl-4.5.0.jar
├── MEP_1.35.jar
└── Replacements
    ├── MEPR_Rev.m
    ├── MEPR_SC.m
    ├── MEPR_THIS.m
    └── Variables
        ├── MEPV_AUTHORLONG.m
        ├── MEPV_DATE.m
        ├── MEPV_REV.m
        └── MEPV_THIS.m

2 directories, 11 files

After that I had javaclasspath.txt with the following content:

/home/kva/Documents/MATLAB/MEP/MEP_1.35.jar
/home/kva/Documents/MATLAB/MEP/matconsolectl-4.5.0.jar

and I was created two additional files: startup.m with the following content:

at.mep.Start.start('/home/kva/Documents/MATLAB/MEP/CustomProps.properties', ...
                   '/home/kva/Documents/MATLAB/MEP/DefaultProps.properties');

import at.mep.util.*;
import at.mep.editor.*;

ctrl = true;
shift = true;
alt = true;

ks_MyKeyReleaseFunction = KeyStrokeUtil.getKeyStroke(java.awt.event.KeyEvent.VK_INSERT, ~ctrl, ~shift, alt, false);
EditorApp.addMatlabCallback('MyKeyReleaseFunction', ks_MyKeyReleaseFunction , 'MyKeyReleaseFunction');

and MyKeyReleaseFunction.m with the following content:

function out = MyKeyReleaseFunction(actionEvent)
if nargin == 0; out = []; return; end
% this is necessary, the first thing happen is trying find out whether 
% the passed function is a valid matlab function or not
% assignin('base','actionEvent',actionEvent)
fprintf('ALT + INSERT\n')
out = 1;

according your suggestions on wiki. But after all that, when I start MATLAB I always get open editor, see attached screenshot. screenshot_2018-12-03_11-02-11

Is that normal behavior? Is possible to suppress opening editor window with

MEP: Sorry!

text ???

Will be possible to create automatically the javaclasspath.txt file in a case when it does not exist at default MATLAB directory /home/kva/Documents/MATLAB and add some generic content to startup.m file at the same directory (+ in a case of no startup.m file)?

It would be really very useful, if the installer solve all installation steps fully interactively and automatically.

GavriYashar commented 5 years ago

MEP needs at least one editor open. If none is open it will create one editor tab. It's annoying, yes.

I could do that, it's definitely something the installer should do. but i cannot validate that the folder of javaclasspath.txt and startup.m is a valid matlab folder.

qlahcim commented 5 years ago

I think the validation of startup.m file is possible to perform by check

>> which startup

and javaclasspath could be checked by output parsing of javaclasspath command.

Moreover, other MEP-like files, the "MyKeyReleaseFunction.m" for example, should be located at MEP directory, too. And MEP installer should add this directory to the PATH automatically.

And, what do you think about any "uninstall" and/or "plugin on/off" switcher MATLAB function?

So finally, I think that your plugin is really very good (!!!), but I strongly propose to finalize MEP installer to be more comprehensive and "fully" automatic.

GavriYashar commented 5 years ago

I cannot use matlab libraries and/or functions in the install environment, therefore i cannot use the which method, the javaclasspath method and change the PATH entry.

Plugin on/off: yes, this should possible... maybe. Uninstall: is tricky. but should be possible too.

qlahcim commented 5 years ago

I cannot use matlab libraries and/or functions in the install environment, therefore i cannot use the which method, the javaclasspath method and change the PATH entry.

Yes of course, you are right! Installer is entirely based on java. But, what about two-step installation process, when 2nd step is realized in Matlab by proper "MEP_configure" script, which will be best place for MEP "on/off" switching, too. Or, what about fully MATLAB based install script ???

Please, understand my position, your plugin has very good functionality, but the installation process is really a tricky part for anybody, who is not familiar with MATLAB.

Plugin on/off: yes, this should possible... maybe. Uninstall: is tricky. but should be possible too.

OK ... I will be happy for these modifications in future releases. But, anyway, thanks for your plugin, it is really very helpful.

GavriYashar commented 5 years ago

FYI: you don't have to create MyKeyReleaseFunction, this is just an example on how to create custom keybindings, and is not necessary to run MEP.