Load data into Java GUI [closed] Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag?Is Java “pass-by-reference” or “pass-by-value”?How do I efficiently iterate over each entry in a Java Map?Does a finally block always get executed in Java?What is the difference between public, protected, package-private and private in Java?How do I read / convert an InputStream into a String in Java?When to use LinkedList over ArrayList in Java?How do I generate random integers within a specific range in Java?How do I convert a String to an int in Java?Creating a memory leak with JavaDealing with “Xerces hell” in Java/Maven?

Is above average number of years spent on PhD considered a red flag in future academia or industry positions?

If 'B is more likely given A', then 'A is more likely given B'

What causes the vertical darker bands in my photo?

How much radiation do nuclear physics experiments expose researchers to nowadays?

Antler Helmet: Can it work?

Why are there no cargo aircraft with "flying wing" design?

How do I keep my slimes from escaping their pens?

What makes black pepper strong or mild?

ListPlot join points by nearest neighbor rather than order

Output the ŋarâþ crîþ alphabet song without using (m)any letters

Why was the term "discrete" used in discrete logarithm?

Examples of mediopassive verb constructions

What do you call a plan that's an alternative plan in case your initial plan fails?

What is a Meta algorithm?

What is the correct way to use the pinch test for dehydration?

Is high blood pressure ever a symptom attributable solely to dehydration?

Best practices for giving outside developer SSH access?

Gastric acid as a weapon

Why is black pepper both grey and black?

How do I mention the quality of my school without bragging

Is 1 ppb equal to 1 μg/kg?

How to find all the available tools in macOS terminal?

3 doors, three guards, one stone

When -s is used with third person singular. What's its use in this context?



Load data into Java GUI [closed]



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?Is Java “pass-by-reference” or “pass-by-value”?How do I efficiently iterate over each entry in a Java Map?Does a finally block always get executed in Java?What is the difference between public, protected, package-private and private in Java?How do I read / convert an InputStream into a String in Java?When to use LinkedList over ArrayList in Java?How do I generate random integers within a specific range in Java?How do I convert a String to an int in Java?Creating a memory leak with JavaDealing with “Xerces hell” in Java/Maven?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















I am working on a Java GUI which requires data to be read from an XML file. Ultimately i want to deliver a single .exe or .jar file where all the things you need are stored. These databases should get automatically parsed.



My question is: Where and in which format should I store the files so that they are always found automatically?



It should be as if the XML files are written in the sourcecode, but I don't think that this would be a good approach to this problem.



Thanks in advance.










share|improve this question













closed as too broad by DanielBarbarian, greg-449, Matteo Baldi, EdChum, Mark Rotteveel Mar 22 at 9:39


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
























    2















    I am working on a Java GUI which requires data to be read from an XML file. Ultimately i want to deliver a single .exe or .jar file where all the things you need are stored. These databases should get automatically parsed.



    My question is: Where and in which format should I store the files so that they are always found automatically?



    It should be as if the XML files are written in the sourcecode, but I don't think that this would be a good approach to this problem.



    Thanks in advance.










    share|improve this question













    closed as too broad by DanielBarbarian, greg-449, Matteo Baldi, EdChum, Mark Rotteveel Mar 22 at 9:39


    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.




















      2












      2








      2








      I am working on a Java GUI which requires data to be read from an XML file. Ultimately i want to deliver a single .exe or .jar file where all the things you need are stored. These databases should get automatically parsed.



      My question is: Where and in which format should I store the files so that they are always found automatically?



      It should be as if the XML files are written in the sourcecode, but I don't think that this would be a good approach to this problem.



      Thanks in advance.










      share|improve this question














      I am working on a Java GUI which requires data to be read from an XML file. Ultimately i want to deliver a single .exe or .jar file where all the things you need are stored. These databases should get automatically parsed.



      My question is: Where and in which format should I store the files so that they are always found automatically?



      It should be as if the XML files are written in the sourcecode, but I don't think that this would be a good approach to this problem.



      Thanks in advance.







      java xml javafx






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 8:21









      lospolloslospollos

      254




      254




      closed as too broad by DanielBarbarian, greg-449, Matteo Baldi, EdChum, Mark Rotteveel Mar 22 at 9:39


      Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









      closed as too broad by DanielBarbarian, greg-449, Matteo Baldi, EdChum, Mark Rotteveel Mar 22 at 9:39


      Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
























          1 Answer
          1






          active

          oldest

          votes


















          3














          If these files shall only be read, you may store them as resources in the class path. If the resource file is in the same directory as your class you may access the resource from within instances of that class like:



          final URL myResource = getClass().getResource(nameOfFile);
          final InputStream myResourceStream = getClass().getResourceAsStream(nameOfFile);


          Static access is possible like:



          final URL myResource = MyClass.class.getResource(nameOfFile);


          The nameOfFile may also contain a path to navigate withing the package structure:



          final Resource myResource = getClass().getResource("subpackage/data.xml");
          final Resource myResource = getClass().getResource("/com/myCompany/somePackage/data.xml");


          And by the way: i recommend to use the java.nio.* classes to access files. One huge benefit is that this allows you to set custom file system implementations, if needed.






          share|improve this answer

























          • Thanks, this works fine when executed in my IDE, but does not work when building an .exe artifact and executing the .exe program (it cannot find the directory). Do you know a solution do this problem as well?

            – lospollos
            Mar 27 at 8:31











          • @lospollos I am not at all familiar with creating executables from java projects. Maybe your process does not include the resources into your compilation target. Maybe you missed an option for that? Or maybe you need to include a second file with your .exe?

            – Amadán
            Mar 27 at 11:54












          • Lets forget the .exe thing and assume I want to build a jar application. Do you know how I could set the path in the sourcecode in order to load the databases when delivering my tool? E.g. the databases are in a specific folder and the jar file is in another

            – lospollos
            Mar 27 at 15:11












          • If you mean providing the configuration of DB access, then a java properties file as resource may be a good approach. If you mean setting something like the windows PATH variable: for heaven's sake don't! The system configuration is something your application should not take control over.

            – Amadán
            Apr 1 at 7:59

















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          If these files shall only be read, you may store them as resources in the class path. If the resource file is in the same directory as your class you may access the resource from within instances of that class like:



          final URL myResource = getClass().getResource(nameOfFile);
          final InputStream myResourceStream = getClass().getResourceAsStream(nameOfFile);


          Static access is possible like:



          final URL myResource = MyClass.class.getResource(nameOfFile);


          The nameOfFile may also contain a path to navigate withing the package structure:



          final Resource myResource = getClass().getResource("subpackage/data.xml");
          final Resource myResource = getClass().getResource("/com/myCompany/somePackage/data.xml");


          And by the way: i recommend to use the java.nio.* classes to access files. One huge benefit is that this allows you to set custom file system implementations, if needed.






          share|improve this answer

























          • Thanks, this works fine when executed in my IDE, but does not work when building an .exe artifact and executing the .exe program (it cannot find the directory). Do you know a solution do this problem as well?

            – lospollos
            Mar 27 at 8:31











          • @lospollos I am not at all familiar with creating executables from java projects. Maybe your process does not include the resources into your compilation target. Maybe you missed an option for that? Or maybe you need to include a second file with your .exe?

            – Amadán
            Mar 27 at 11:54












          • Lets forget the .exe thing and assume I want to build a jar application. Do you know how I could set the path in the sourcecode in order to load the databases when delivering my tool? E.g. the databases are in a specific folder and the jar file is in another

            – lospollos
            Mar 27 at 15:11












          • If you mean providing the configuration of DB access, then a java properties file as resource may be a good approach. If you mean setting something like the windows PATH variable: for heaven's sake don't! The system configuration is something your application should not take control over.

            – Amadán
            Apr 1 at 7:59















          3














          If these files shall only be read, you may store them as resources in the class path. If the resource file is in the same directory as your class you may access the resource from within instances of that class like:



          final URL myResource = getClass().getResource(nameOfFile);
          final InputStream myResourceStream = getClass().getResourceAsStream(nameOfFile);


          Static access is possible like:



          final URL myResource = MyClass.class.getResource(nameOfFile);


          The nameOfFile may also contain a path to navigate withing the package structure:



          final Resource myResource = getClass().getResource("subpackage/data.xml");
          final Resource myResource = getClass().getResource("/com/myCompany/somePackage/data.xml");


          And by the way: i recommend to use the java.nio.* classes to access files. One huge benefit is that this allows you to set custom file system implementations, if needed.






          share|improve this answer

























          • Thanks, this works fine when executed in my IDE, but does not work when building an .exe artifact and executing the .exe program (it cannot find the directory). Do you know a solution do this problem as well?

            – lospollos
            Mar 27 at 8:31











          • @lospollos I am not at all familiar with creating executables from java projects. Maybe your process does not include the resources into your compilation target. Maybe you missed an option for that? Or maybe you need to include a second file with your .exe?

            – Amadán
            Mar 27 at 11:54












          • Lets forget the .exe thing and assume I want to build a jar application. Do you know how I could set the path in the sourcecode in order to load the databases when delivering my tool? E.g. the databases are in a specific folder and the jar file is in another

            – lospollos
            Mar 27 at 15:11












          • If you mean providing the configuration of DB access, then a java properties file as resource may be a good approach. If you mean setting something like the windows PATH variable: for heaven's sake don't! The system configuration is something your application should not take control over.

            – Amadán
            Apr 1 at 7:59













          3












          3








          3







          If these files shall only be read, you may store them as resources in the class path. If the resource file is in the same directory as your class you may access the resource from within instances of that class like:



          final URL myResource = getClass().getResource(nameOfFile);
          final InputStream myResourceStream = getClass().getResourceAsStream(nameOfFile);


          Static access is possible like:



          final URL myResource = MyClass.class.getResource(nameOfFile);


          The nameOfFile may also contain a path to navigate withing the package structure:



          final Resource myResource = getClass().getResource("subpackage/data.xml");
          final Resource myResource = getClass().getResource("/com/myCompany/somePackage/data.xml");


          And by the way: i recommend to use the java.nio.* classes to access files. One huge benefit is that this allows you to set custom file system implementations, if needed.






          share|improve this answer















          If these files shall only be read, you may store them as resources in the class path. If the resource file is in the same directory as your class you may access the resource from within instances of that class like:



          final URL myResource = getClass().getResource(nameOfFile);
          final InputStream myResourceStream = getClass().getResourceAsStream(nameOfFile);


          Static access is possible like:



          final URL myResource = MyClass.class.getResource(nameOfFile);


          The nameOfFile may also contain a path to navigate withing the package structure:



          final Resource myResource = getClass().getResource("subpackage/data.xml");
          final Resource myResource = getClass().getResource("/com/myCompany/somePackage/data.xml");


          And by the way: i recommend to use the java.nio.* classes to access files. One huge benefit is that this allows you to set custom file system implementations, if needed.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 22 at 10:58

























          answered Mar 22 at 8:35









          AmadánAmadán

          28229




          28229












          • Thanks, this works fine when executed in my IDE, but does not work when building an .exe artifact and executing the .exe program (it cannot find the directory). Do you know a solution do this problem as well?

            – lospollos
            Mar 27 at 8:31











          • @lospollos I am not at all familiar with creating executables from java projects. Maybe your process does not include the resources into your compilation target. Maybe you missed an option for that? Or maybe you need to include a second file with your .exe?

            – Amadán
            Mar 27 at 11:54












          • Lets forget the .exe thing and assume I want to build a jar application. Do you know how I could set the path in the sourcecode in order to load the databases when delivering my tool? E.g. the databases are in a specific folder and the jar file is in another

            – lospollos
            Mar 27 at 15:11












          • If you mean providing the configuration of DB access, then a java properties file as resource may be a good approach. If you mean setting something like the windows PATH variable: for heaven's sake don't! The system configuration is something your application should not take control over.

            – Amadán
            Apr 1 at 7:59

















          • Thanks, this works fine when executed in my IDE, but does not work when building an .exe artifact and executing the .exe program (it cannot find the directory). Do you know a solution do this problem as well?

            – lospollos
            Mar 27 at 8:31











          • @lospollos I am not at all familiar with creating executables from java projects. Maybe your process does not include the resources into your compilation target. Maybe you missed an option for that? Or maybe you need to include a second file with your .exe?

            – Amadán
            Mar 27 at 11:54












          • Lets forget the .exe thing and assume I want to build a jar application. Do you know how I could set the path in the sourcecode in order to load the databases when delivering my tool? E.g. the databases are in a specific folder and the jar file is in another

            – lospollos
            Mar 27 at 15:11












          • If you mean providing the configuration of DB access, then a java properties file as resource may be a good approach. If you mean setting something like the windows PATH variable: for heaven's sake don't! The system configuration is something your application should not take control over.

            – Amadán
            Apr 1 at 7:59
















          Thanks, this works fine when executed in my IDE, but does not work when building an .exe artifact and executing the .exe program (it cannot find the directory). Do you know a solution do this problem as well?

          – lospollos
          Mar 27 at 8:31





          Thanks, this works fine when executed in my IDE, but does not work when building an .exe artifact and executing the .exe program (it cannot find the directory). Do you know a solution do this problem as well?

          – lospollos
          Mar 27 at 8:31













          @lospollos I am not at all familiar with creating executables from java projects. Maybe your process does not include the resources into your compilation target. Maybe you missed an option for that? Or maybe you need to include a second file with your .exe?

          – Amadán
          Mar 27 at 11:54






          @lospollos I am not at all familiar with creating executables from java projects. Maybe your process does not include the resources into your compilation target. Maybe you missed an option for that? Or maybe you need to include a second file with your .exe?

          – Amadán
          Mar 27 at 11:54














          Lets forget the .exe thing and assume I want to build a jar application. Do you know how I could set the path in the sourcecode in order to load the databases when delivering my tool? E.g. the databases are in a specific folder and the jar file is in another

          – lospollos
          Mar 27 at 15:11






          Lets forget the .exe thing and assume I want to build a jar application. Do you know how I could set the path in the sourcecode in order to load the databases when delivering my tool? E.g. the databases are in a specific folder and the jar file is in another

          – lospollos
          Mar 27 at 15:11














          If you mean providing the configuration of DB access, then a java properties file as resource may be a good approach. If you mean setting something like the windows PATH variable: for heaven's sake don't! The system configuration is something your application should not take control over.

          – Amadán
          Apr 1 at 7:59





          If you mean providing the configuration of DB access, then a java properties file as resource may be a good approach. If you mean setting something like the windows PATH variable: for heaven's sake don't! The system configuration is something your application should not take control over.

          – Amadán
          Apr 1 at 7:59





          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현