How to import .class file in a .java file?

前端 未结 2 447
感动是毒
感动是毒 2021-01-12 04:03

What i need to do is as follows:

  1. I have a bigloo scheme program (*.scm), then using the bigloo frameworks jvm a class file is generated.

  2. I w

2条回答
  •  梦毁少年i
    2021-01-12 04:37

    You can add a folder containing compiled classes to your project by right clicking the project, then select Properties > Java build path, then "Add External Class Folder"

    Or choose "Add Class Folder" if you have copied the class files into a sub directory of your project.

    This will add the class files to the projects classpath and you can then import the class into your java file using an import statement:

    import my.package.MyClass;
    

    Note: The package structure should be maintained under the folder that you add as a class folder. So if you add folder "myclasses" as a class folder, the directory structure should be as follows for the example above:

    myclasses/my/package/MyClass.class

提交回复
热议问题