I’m looking to create a universal logging file for all of my companies Java applications. I’ve done something similiar in C++, where you simply import the file.
My question is, what is the most effective/efficent way to create a public Java file (basically what do you create it as, and then how do you reference it)? I’m assuming its by importing your own class or jar? Thanks!
It’s not really clear what you mean, but it sounds like you’re trying to create a library to be used by multiple applications.
I’d suggest that the other projects should simply refer to it as a jar file – whether they build that jar file from source or fetch one from some company-wide repository which is updated when the logging code changes is up to you. From the application code, you’d just import it as any other class – whether the class is found in a jar file or as a .java file is irrelevant in the consuming Java source code.
It’s worth noting that there are already many other logging APIs for Java – I would think very carefully before you create a new one.