1

I have had some experience programming in Java and a little with Java for Android. I haven't done much with Android but enough for me to gain respect for the standard file system within the project. I like how all the resources are contained separately in XML files instead of hard coded into the application.

My question is: Is there a way to emulate this same system when making a project designed to run as a desktop application?

I know I could just code it myself, including the XML files in the jar, set up a separate class to read them, and reference that class when using the resources, but is there a built in way to do this?

MiguelHincapieC
  • 5,445
  • 7
  • 41
  • 72
  • What kind of resources do you want to have? If you want XML layouts, take a look at [this thread](http://stackoverflow.com/questions/4468710/java-swing-library-with-layout-defined-in-xml). For general use of XML in a Java project, try [this thread](http://stackoverflow.com/questions/3816021/is-there-a-simple-way-to-use-xml-resources-within-a-java-project-in-eclipse). – Ted Hopp May 13 '15 at 19:50
  • I would just like to access regular resources (String, int, etc..) saved in an XML document and be able to look them up in much the same way as with an Android application. – CB Software and Engineering May 13 '15 at 19:59

2 Answers2

1

I think what you need is just a key-value pair system. JSON is quite enough to fulfill your requirements. How to parse JSON in Java

Community
  • 1
  • 1
Hank Chang
  • 199
  • 2
  • 10
0

I don't think so.. The xml files are compiled, in a certain way that its better to find another approach. You don't want to write the android compiler from scratch.

bgauryy
  • 416
  • 3
  • 7