embedded-resource

Reading Files Within a Jar(ZipInputStream, etc.) [duplicate]

大兔子大兔子 提交于 2019-12-23 01:12:27
问题 This question already has answers here : How do I read a resource file from a Java jar file? (9 answers) Closed 6 years ago . I'm writing a game in java and all is working more or less well, as you would expect when coding, but one issue I have come across is reading the image and sound files into the game. I wrote a method that works really well within Eclipse, but as soon as I try to test it in a runnable jar (exported using Eclipse) my game gets stuck on the loading screen because it can't

getResource() -> Source not found

我们两清 提交于 2019-12-23 01:04:48
问题 I'm following the tutorial here. The file is in the same root folder of the project. I've tried doing it when it's in the src folder and in the same package folder. None of those 3 locations worked. The specific line of code is: ImageIcon ii = new ImageIcon(this.getClass().getResource("bardejov.jpg")); Any idea what I'm doing wrong? 回答1: // absolute from the classpath MyClass.class.getResource("/myfolder/abc.txt"); // relative to the class location MyClass.class.getResource("abc.txt"); //

Java classes can't get the resources in JAR files that compiled with IKVM

人走茶凉 提交于 2019-12-22 18:15:54
问题 I've converted a java library succesfully with ikvmc. Java library uses some resources inside its self jar file. I can reach all classes of this java library, but if I call a method that calls this.getClass().getResource(), it doens't search these resources in the assembly or the jar file in the assembly. But if I put these resources to same folder with the assembly, it can find the resources. But it doesn't work well everytime. For instance, it can't find the resources if I referenced the

When Resources of a PE file are loaded

余生长醉 提交于 2019-12-22 12:28:42
问题 When using a resource included in a PE file (for example a binary resource) in C++ . we have to first call 1 )FindResource and then 2 )LoadResource to access the resource . Being accurate about the function name "LoadResource" i wonder if the "Windows Loader" does load all resource of an application in memory just when loading other parts (like code or data section) or they are delay loaded only when we need them ? If so can we unload these resources after we have used them in order to free

Embedded Binary Resources - how can I enumerate the image files embedded?

戏子无情 提交于 2019-12-22 09:14:18
问题 I was following the instructions in this book, chapter on Resources etc. and what I can't quite figure out is, how do I replace this: images.Add(new BitmapImage(new Uri(@"/Images/Deer.jpg", UriKind.Relative))); images.Add(new BitmapImage(new Uri(@"/Images/Dogs.jpg", UriKind.Relative))); images.Add(new BitmapImage(new Uri(@"/Images/Welcome.jpg", UriKind.Relative))); by a loop that would simply run through all embedded image resources to avoid hard-coding the image names and paths. How would I

Embedded Binary Resources - how can I enumerate the image files embedded?

旧街凉风 提交于 2019-12-22 09:13:55
问题 I was following the instructions in this book, chapter on Resources etc. and what I can't quite figure out is, how do I replace this: images.Add(new BitmapImage(new Uri(@"/Images/Deer.jpg", UriKind.Relative))); images.Add(new BitmapImage(new Uri(@"/Images/Dogs.jpg", UriKind.Relative))); images.Add(new BitmapImage(new Uri(@"/Images/Welcome.jpg", UriKind.Relative))); by a loop that would simply run through all embedded image resources to avoid hard-coding the image names and paths. How would I

Why are resx cultures not found in unit tests?

余生长醉 提交于 2019-12-22 05:02:07
问题 I have embedded string resources in my .NET 4.0 project: Strings.resx and Strings.de.resx. In production code the correct localised strings are retrieved, dependent on the value of Strings.Culture: Strings.Culture = new Culture("de"); string deString = Strings.Welcome; // 'Willkommen' Strings.Culture = new Culture("en"); string enString = Strings.Welcome; // 'Welcome' But in my unit test code (using MSTest) the strings from 'Strings.de.resx' are never returned - I only ever get the strings

Render embedded image in PDF using Flying-Saucer from html

流过昼夜 提交于 2019-12-22 04:40:57
问题 I have an xhtml document that I'm turning into a PDF using flyingsaucer. The xhtml has several tags that have a base64 encoded images inline. The source of the xhtml is dynamic so the structure of where the image tags are can vary. This is a sample of what the tag looks like: <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAagAAAEuCAYAAADbW4YFAAAgAElEQVR4Aex9CYBdRZ ... When I look at the html in a browser, the image appears correctly, however, the img element doesn't get rendered in

Visual Studio Installer Project: Installer and Application Icons

痴心易碎 提交于 2019-12-22 04:07:54
问题 I've got an icon for one of my applications, which I've embedded in a resource file and is used as the main icon for the application. So far so good. However, I want to use the same icon for the installer project, and for the shortcut that the installer places in the Start Menu. I can set the icon for the installer package itself, but only if I add the icon as an .ico file in the main application folder. The whole point of embedded the icon in a resource file is so that I don't have an ICO

How to read user-defined resource in Visual C++ 2012?

百般思念 提交于 2019-12-22 01:17:40
问题 all I have source below: in my .rc file IDR_XML1 XML "LoginQuery.xml" in my resource.h file //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // #define IDR_XML1 106 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 107 #define _APS_NEXT_COMMAND_VALUE 40002 #define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif and in my .cpp file. HMODULE handle = :