有没有办法在其他项目的其他类中使用类的方法?

时间:2022-11-19 10:37:05

I have been learning java for a while and I'm still a newbie. I have written a few classes which are quite useful for me and I was wondering if there is any way the I can use their methods in other projects. Any help will be appreciated.

我一直在学习java,我还是个新手。我写了几个对我很有用的类,我想知道是否有任何方法可以在其他项目中使用他们的方法。任何帮助将不胜感激。


UPDATE

I created the jar file but I can't import it. I read this but for some reason it didn't work. I use eclipse

我创建了jar文件,但我无法导入它。我看了这个,但由于某种原因,它没有用。我用eclipse

1 个解决方案

#1


3  

The canonical way would be to put those classes in a jar file, and include that in your other projects.

规范的方法是将这些类放在jar文件中,并将其包含在其他项目中。

#1


3  

The canonical way would be to put those classes in a jar file, and include that in your other projects.

规范的方法是将这些类放在jar文件中,并将其包含在其他项目中。