embedded-resource

Read a file within a jar from java code present in same jar

人走茶凉 提交于 2019-12-29 09:11:06
问题 I am trying to read a xsd file kept in a jar using java code kept inside the same jar. I am using the following code. URL tmpurl = ClassLoader.getSystemResource("com/abc/filename.xsd"); Schema s = schemaFactory.newSchema(tmpurl); jaxbUnMarshaller.setSchema(s); It is working fine when I run it as a separate project but when I make a jar, tmpurl is null, hence the setSchema gives a null pointer exception. Can you please a workaround that can make it run even inside a jar file. 回答1: Hava you

getResourceAsStream() returning null in jar but fine in eclipse

安稳与你 提交于 2019-12-29 08:51:34
问题 I have a program in Java using LWJGL. It runs fine in Eclipse, but when I try to compile it as a jar file it crashes, giving me a NullPointerException. It's been asked before, I know, but I don't seem to get an answer that works. Any help here? Thanks in advance! The thing that seems to be having the problem is the class TextureHelper: public class TextureHelper { public static Texture LoadTexture(String texture) { try { return TextureLoader.getTexture("PNG", ResPlaceholder.class

How to run unmanaged executable from memory rather than disc

核能气质少年 提交于 2019-12-29 05:25:09
问题 I want to embed a command-line utility in my C# application, so that I can grab its bytes as an array and run the executable without ever saving it to disk as a separate file (avoids storing executable as separate file and avoids needing ability to write temporary files anywhere). I cannot find a method to run an executable from just its byte stream. Does windows require it to be on a disk, or is there a way to run it from memory? If windows requires it to be on disk, is there an easy way in

Including resource file in a project by .RC file rather than .RES file

*爱你&永不变心* 提交于 2019-12-29 05:07:49
问题 I remember reading an article or post somewhere years ago that suggested including a resource file in a project by referencing the .rc file instead of an already compiled .res file so that the resource is built as part of the project's build process. I have a glyphs.rc file that I currently compile using the command brcc32 glyphs.rc. In my project file I then have the statement {$R Glyphs.res}. I'd like to simplify this by changing it to something like {$R Glyphs.rc} but am unsure of the

Jar get image as resource

﹥>﹥吖頭↗ 提交于 2019-12-29 01:50:10
问题 I'm trying to get load an image from my jar. But no matter what string I supply for getResource() it always returns null. try { System.out.println(Bootstrapper.class.getResource("./img/logo.png").toURI().getPath()); } catch (URISyntaxException ex) { Logger.getLogger(CrawlerFrame.class.getName()).log(Level.SEVERE, null, ex); } ImageIcon ii = new ImageIcon(Bootstrapper.class.getResource("./img/logo.png")); setIconImage(ii.getImage()); Exception in thread "AWT-EventQueue-0" java.lang

How can we add embedded resources to a file which is compiled from a source file at run-time

左心房为你撑大大i 提交于 2019-12-28 16:12:54
问题 I'm writing a small application which works at compiling a file from a source (.cs) code file using a function: public static bool CompileExecutable(String sourceName) { //Source file that you are compliling FileInfo sourceFile = new FileInfo(sourceName); //Create a C# code provider CodeDomProvider provider = CodeDomProvider.CreateProvider("CSharp"); //Create a bool variable for to to use after the complie proccess to see if there are any erros bool compileOk = false; //Make a name for the

Is there a Linux equivalent of Windows' “resource files”?

北城余情 提交于 2019-12-27 17:00:50
问题 I have a C library, which I build as a shared object for Linux and a DLL for Windows with MinGW32. The API depends on a couple of data files (statistical models) which I'd really like to roll in with the SO/DLL so that deployment is just one file. It looks like I can achieve this for Windows with a "resource file" compiled with windres , but then I've got to write a bunch of resource-handling code for Windows, and I'm still stuck with the files on Linux. Is there a way to achieve the same

Embedding and referencing XML file in VB.NET project

本小妞迷上赌 提交于 2019-12-25 16:25:34
问题 In a VS2013 VB.NET WinForms project I need to include an XML file in the deployed application that will be read from and written to at run time. I have the file as an embedded resource, and have "Copy Always" selected for output. The file name is "Settings.xml" and the resource name is Settings. Looking at this example I did the following to reference it in my code: Private xmlFile as XmlDocument ' In the general declaration area, before the Load event xmlFile.LoadXml(My.Resources.Settings) '

How do you publish an App Store application in mulitple languages?

≡放荡痞女 提交于 2019-12-25 12:55:24
问题 I've got an Windows 8.1 (Modern UI) Application that has support for French and Spanish. If I set the OS language to French or Spanish and run my application in the debugger, the application appears to find the correct language resource dlls and runs in the desired language. I've recently published my application (in English only) to the App Store. When I go to my test machine, change the language to Spanish, download the application from the store, I get English. Same thing happens if I set

Is there a way to compare two .exes to see what differs between them?

那年仲夏 提交于 2019-12-25 12:15:52
问题 Is there a tool / process by which I can decompile two .exes (one of which runs on a handheld device, the other which doesn't) so that I can get a glimpse into what differs/what the problem may be? Of course, seeing that one has "00xA" where the other has "00xB" won't help me. I mean a way to see code that differs, or more likely, a compiled resource or config file difference, or some build option or so? I'm almost positive the problem has nothing to do with code per se (if/while/switch