embedded-resource

How to read a file inside a jar's resources from ouside the jar

ⅰ亾dé卋堺 提交于 2019-12-02 07:24:16
问题 I have a file X.json inside abc.jar in its classpath. There is a method readFile in abc.jar which reads the file as URL url = Abc.class.getClassLoader().getResource("X.json"); File file = new File(url.toURI());* which reads it fine if i run it from within the jar's context i.e main method in some file inside the abc.jar But when readFile is called from from outside of abc.jar from some other code it fails with java.lang.IllegalArgumentException: URI is not hierarchical How do I get the File

Re-Embedding Sqlite Database file into the same Executable

最后都变了- 提交于 2019-12-02 07:22:30
问题 I'm Creating Win Form application ,I'm adding a Empty Sqlite Database file having Tables in it as embedded data source. on run time i extract Database file into application path and INSERT THE VALUES into the TABLE of that Database file. On Closing the application again i have to update or replace Database File into Executable. Is it possible ,if so how to do that. 回答1: I'm not sure if I understand the question correctly. If you are trying to re-write to the same exe you are running this is

Where have I to put an image to use it to create a new Swing ImageIcon object?

时间秒杀一切 提交于 2019-12-02 06:35:12
I am studying Java Swing library and I have a problem. In an example program it create an ImageIcon object by this line: ImageIcon icon = new ImageIcon(getClass().getResource("exit.png")); Whe I execute my program I obtain the following error caused by the fact that in the project the exit.png is missing: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(ImageIcon.java:205) at com.andrea.second.SimpleMenu.initUI(SimpleMenu.java:23) at com.andrea.second.SimpleMenu.<init>(SimpleMenu.java:17) at com.andrea.second.SimpleMenu$2.run(SimpleMenu.java

Change executable icon through ilasm

邮差的信 提交于 2019-12-02 05:26:25
问题 I have a installer app with a embedded .resx file with some information, like server name, port, password etc... I have to generate this installer ( this process is automated, and is done through our website ) for each customer. This is working fine I use ildasm for disassembler and replace the resx file, and then I use ilasm to make .exe again. But after this process the .exe lost our icon, putting the default one in it's place. I cannot find a way to change the default icon. Thanks 回答1: You

Access images inside jar

 ̄綄美尐妖づ 提交于 2019-12-02 04:43:17
问题 First. I know that there already exists a variety of topics on how to access the image inside the jar file. Second. I tried many options and none of them did not work. Of course I know that somewhere I make a mistake. Can you help me understand what I'm doing wrong? so, I have prototype project with name 'j' and it contains just one java class - Client. Client trying to access to image good.png. After I packed all to executable jar file, Client can't accesss file. I work in eclipse, and use

Using resource files in Java

☆樱花仙子☆ 提交于 2019-12-02 03:58:24
I'm just getting into using "Java Resource Files" and i have a few questions... I am hoping to distribute my program to others and I'm assuming JAR file isn't the best way. I'd probably go about it by "converting to exe" is this good practice? what are the limitations? If I convert to an exe does it keep the resource files? I'm actually just trying to use a resource file. This file is a text file and will just save the users directories for certain files so they don't need set them up every time they open the program. is this even the best way to go about it? how do you reference the resource

Embedding ASCII hex string SigString into HTML page, not base64

折月煮酒 提交于 2019-12-02 03:30:12
I am currently working on a project that is requiring me to embed a Topaz signature image into a HTML page. I know that this is possible if the image has been changed into a base64 string but the string value that the signature is returning is a "ASCII hex string". Does anyone have code that will display an embedded "ASCII hex string"? Thanks. Below is an example string I found that will embed a red dot into a page and it works perfect. <html> <head> <title>Display Image</title> </head> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8

Access images inside jar

空扰寡人 提交于 2019-12-02 02:44:54
First. I know that there already exists a variety of topics on how to access the image inside the jar file. Second. I tried many options and none of them did not work. Of course I know that somewhere I make a mistake. Can you help me understand what I'm doing wrong? so, I have prototype project with name 'j' and it contains just one java class - Client. Client trying to access to image good.png. After I packed all to executable jar file, Client can't accesss file. I work in eclipse, and use ant. j/ -src/ --com/ ---pupcom/ ----Client.java -images/ --good.png -build.xml -.classpath -.project com

Change executable icon through ilasm

若如初见. 提交于 2019-12-02 01:03:45
I have a installer app with a embedded .resx file with some information, like server name, port, password etc... I have to generate this installer ( this process is automated, and is done through our website ) for each customer. This is working fine I use ildasm for disassembler and replace the resx file, and then I use ilasm to make .exe again. But after this process the .exe lost our icon, putting the default one in it's place. I cannot find a way to change the default icon. Thanks Hans Passant You are missing out on a fairly obscure detail in a C# program. The executable the compiler

Packaging a program containing images

十年热恋 提交于 2019-12-01 23:25:34
I'm having massive issues packaging my java program which contains images into a jar for conversion into and executable file. The images have been used in the background of the program and buttons. Please see the diagram below which shows the program I desire to convert to a jar. IMAGE As you see above the program runs OK. I created the same program with no custom background and custom buttons containing no images and I successfully packaged it into a jar and subsequently into an .exe file. With regards to drawing my background I'm doing this as follows: public void paintComponent(Graphics g)