How to access package from bin folder from src folder

163 Views Asked by At

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

1

There are 1 best solutions below

1
On

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?