java.lang.IllegalAccessError when using a java class from within the file
11 次查看(过去 30 天)
显示 更早的评论
When I use my JTableForMatlabMod in Matlab i get a java.lang.IllegalAccessError in the method that wants to instantiate a BtnCE object. Why can this be? BtnCE is in the same file as JTableForMatlabMod. I can use FilterData from JTableForMatlabMod with no problem. In an older version everything worked just fine. The only possible difference really is that I don't how the old version was compiled. I am using OpenJDK 1.7 and that's the only version with which I got it running at all.. Anyone got an idea?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1365624/image.png)
// THIS ONE I CAN USE!
class FilterData {
// lots of stuff left out here
// ...
}
class BtnCE extends AbstractCellEditor implements TableCellEditor, ActionListener, MouseListener {
private final JButton editButton;
private final JTable tbl;
private boolean isButtonColumnEditor;
public BtnCE(JTable table, String txt, Font myFont) {
this.editButton = new JButton(txt);
this.editButton.setFont(myFont);
editButton.addActionListener(this);
this.tbl = table;
this.tbl.addMouseListener(this);
}
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
return editButton;
}
@Override
public Object getCellEditorValue() {
return editButton.getText();
}
public void actionPerformed(ActionEvent e) {
fireEditingStopped();
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
this.stopCellEditing();
this.tbl.removeMouseListener(this);
}
public void mouseClicked(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
}
public class JTableForMatlabMod extends JTable {
// lots of stuff left out here
// ...
@Override
public TableCellEditor getCellEditor(int row, int column) {
// lots of stuff left out here
// ...
if ((this.btns != null) && (this.btns[this.convertRowIndexToModel(row)][modelColumn] == true))
return new BtnCE(this, this.getValueAt(row, modelColumn).toString(), this.myFont);
// lots of stuff left out here
// ...
}
// lots of stuff left out here
// ...
}
Here's the java error text:
Exception in thread "AWT-EventQueue-0": java.lang.IllegalAccessError: BtnCE
at JTableForMatlabMod.getCellEditor(JTableForMatlabMod.java:478)
at javax.swing.JTable.editCellAt(JTable.java:3516)
at javax.swing.plaf.basic.BasicTableUI$Handler.adjustSelection(BasicTableUI.java:1108)
at javax.swing.plaf.basic.BasicTableUI$Handler.mousePressed(BasicTableUI.java:1038)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
at java.awt.Component.processMouseEvent(Component.java:6536)
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:4532)
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)
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/ReferenceData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.ReferenceData
Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/ReferenceData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.ReferenceData
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!