gephi / gephi-plugins

Repository for Gephi Plugins maintained by the team. Each plugin has it's branch.
270 stars 623 forks source link

Gephi exception: classnotfound TimeFormat #110

Closed AnonymizedAccount closed 2 years ago

AnonymizedAccount commented 8 years ago

I am trying to develop a plugin in gephi tool and in this one I have a button that let me import file and visualize it automatically by clicking in this button. After pressing the button i had this error. is there anyone to help me and thank you in advance . capture

eduramiba commented 8 years ago

Hi, Can you point to your code in github so I can try to find the problem?

AnonymizedAccount commented 8 years ago

try { File graphmlFile = new File("C:\Users\amina\Desktop\firstOne.gdf"); JOptionPane.showMessageDialog(null, "tache effectuée ggggggggggg1"); //Init a project - and therefore a workspace Lookup up = Lookup.getDefault();//getDefault().lookup(ProjectController.class); JOptionPane.showMessageDialog(null,"ggjgjgj"); ProjectController pc =up.lookup(ProjectController.class); JOptionPane.showMessageDialog(null, "tache effectuée aaaaaaaa"); pc.newProject();

                JOptionPane.showMessageDialog(null, "tache effectuée 0000000");

                Workspace workspace = pc.getCurrentWorkspace();
                if(workspace !=null)
                {
                    JOptionPane.showMessageDialog(null, "workspace not null");
                }
                JOptionPane.showMessageDialog(null, "tache effectuée 111111");
                // get import controller
                ImportController importController = Lookup.getDefault().lookup(ImportController.class);
                JOptionPane.showMessageDialog(null, "tache effectuée 22222222");
                //Import file
                Container container=importController.importFile(graphmlFile);
                if(container!=null)
                {
                    JOptionPane.showMessageDialog(null, "not null");
                }
                JOptionPane.showMessageDialog(null, "tache effectuée 333333333");

                //Append imported data to GraphAPI
                importController.process(container, new DefaultProcessor(), workspace);
                JOptionPane.showMessageDialog(null, "tache effectuée");

            } catch (Exception ex) {
                pw.println(ex.getLocalizedMessage());
                ex.printStackTrace(pw);
                pw.close();
                JOptionPane.showMessageDialog(null, "error");
            }
AnonymizedAccount commented 8 years ago

this is my code and the problem is in the container that doesn't contains data ,it is usually empty and the exception is in the timeFormat class in the Graph API (if I try org.gephi.graph.api.TimeFormat in netbeans I found it bu twhen trying the plugin in gephi it shows me exception about this class)

eduramiba commented 8 years ago

I actually want to check how your pom.xml file is set up.

AnonymizedAccount commented 8 years ago

I didn't find this file in my projet althoug I follow all of the steps of creating a plugin :(

eduramiba commented 8 years ago

Did you follow the steps here? https://github.com/gephi/gephi-plugins#create-a-plugin

AnonymizedAccount commented 8 years ago

I create a netbeans plugin then I generate a nbm file then I install it in gephi, the plugin works well except the code below doesn't work

eduramiba commented 8 years ago

There are probably dependency problems/mismatch. Don't create a plugin from Netbeans directly, and please try to follow the steps detailed at https://github.com/gephi/gephi-plugins#create-a-plugin

AnonymizedAccount commented 8 years ago

I try to follow this one in the beginning but I had some dependency problems and I didn't inderstand what shall I do :(

eduramiba commented 8 years ago

Well the command mvn org.gephi:gephi-maven-plugin:generate will create a folder for your plugin under modules directory, and that folder will contain a pom. Then you can open this module folder in netbeans and add your code.

If then you find some classes are not available to your plugin module, make sure to add the right dependencies to it manually. You can find them at the parent directory pom, where they all are listed starting at

<dependency>
  <groupId>org.gephi</groupId>
  <artifactId>utils-longtask</artifactId>
  <version>${gephi.version}</version>
</dependency>

So just copy the dependencies that your plugin needs without the "version" tag.

For example add the following to your pom for the Project API and Graph API basic dependencies:

 <dependency>
  <groupId>org.gephi</groupId>
  <artifactId>graph-api</artifactId>      
</dependency>
 <dependency>
  <groupId>org.gephi</groupId>
  <artifactId>project-api</artifactId>      
</dependency>

You will probably also need the Import API dependency.

You can check examples of other working plugins here: https://github.com/gephi/gephi-plugins/tree/master-forge/modules