Samuel W
Samuel W

Reputation: 39

How to access package from bin folder from src folder

So I have a folder structure as below

mainFolder\
    bin\
        file1.class,file2.class,file3.class,file4.class //under package named classes
    src\
        socialmedia\
            file5.java,file6.java,file7.java //under package named socialmedia
        PlatformTestApp

How can I import the package inside the bin folder from the socialmedia subfolder inside the src folder

I'm aware a question like this has almost certainly been answered before but I can't for the life for me find what I need

Upvotes: -1

Views: 177

Answers (1)

John Williams
John Williams

Reputation: 5440

Any files on the classpath, which /bin certainly is, can be accessed like this:

InputStream in = this.getClass().getClassLoader()
                                .getResourceAsStream("file1.class");

I have to ask - what problem are you solving that includes this very unusual requirement?

Upvotes: 1

Related Questions