Problem with paths in a java jar -


I have a folder called eta, in which there is an image that I want to use in another file in the same folder , E.g., Java. So I have an ATC \ image.png and etc. \ example.java I have used the image path as "ATC / Image paging", but it is not working. How should I go about this?

Also, suppose the files were in different packages, how would I do this?

My main. Java class is in a package called Main, Record.

Edit:

I used it:

Classloader .getSystemClassLoader (). GetResource ("Png Png");

You can use Class.getResource () , the resource For example, use the class loader to get the URL for example:

  import java.net.URL; Import javax.swing.ImageIcon; Public class examples {public image getImage () {URL URL = example.clash.tatsource ("image page"); If (url! = Null) {return the new image icon (url); } Return tap; // TODO: Better error handling}}  

Important part is example.clash.getRSORS ("image.png") - relative to image path relative named cell In; In this case, it is in a similar directory as is a class file. You can also use this line in any other category, example. Excluding the context of the square unbroken


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -