Normally we write code to read a data file such as an image. In my case I want to produce a single *.class file which contains the information of some images, so that when I execute the java file it will display the images without dependency on any other files. Appreciate if anyone can help.
You can store the images as base 64 so they will be part of the file, see: Java - Convert image to Base64 for more details.
this way the image will be constant in the class and therfore will be compiled inside it
Never done this, but an image is a series of bytes. You could store the bytes in a byte array and use it to "recreate" it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.