Results 1 to 2 of 2
  1. #1
    waterpolobro is offline Member
    Join Date
    May 2011
    Posts
    8
    Rep Power
    0

    Default Question Creating a .jar

    I've created a Scrabble game and it works fine, but when I try to create a .jar file for it to make it easier to run it doesn't work because it loads the "dictionary" from a text file which isn't included in the .jar. So how do I create a .jar and have it include the text file or modify my code so it loads it anyway?

    The code used to load the file is basically:
    Java Code:
    File f = new File("dictionary.txt");
    I also have functionality to save and load games from files (using PrintWriter and Scanner); I don't think that will work with a .jar either which I can deal with... unless there's an easy fix?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,038
    Rep Power
    10

    Default

    How are you creating the Jar? Are you using an IDE, or doing it from the command line?

    Recommended reading: Lesson: Packaging Programs in JAR Files (The Java™ Tutorials > Deployment)
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Question about creating jar file
    By hei1233212000 in forum New To Java
    Replies: 3
    Last Post: 10-27-2010, 03:41 PM
  2. Question about creating a Game State Manager
    By nolsen01 in forum New To Java
    Replies: 1
    Last Post: 03-05-2010, 11:23 PM
  3. Replies: 5
    Last Post: 12-21-2009, 02:17 PM
  4. Creating files stopped creating...
    By Dieter in forum Advanced Java
    Replies: 3
    Last Post: 09-26-2009, 12:45 AM
  5. Creating objects question
    By sergm in forum New To Java
    Replies: 2
    Last Post: 12-27-2007, 05:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •