Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: System cannot find path specified in a jar?

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy System cannot find path specified in a jar?

    I'm trying to make a jar file but i keep getting "The system cannot find the path specified" from a resource.I only get the error when I launch it from a runnable jar file but not from an IDE.here are the lines of code that won't run on a a jar file.

    File file = new File("src/scores/scores.txt");
    PrintWriter b = new PrintWriter(file);


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: System cannot find path specified in a jar?

    When a file is inside the Jar, it's no longer a File, it's a Resource.

    Check out the getResource() functions in the ClassLoader class.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Issue with PATH system variable
    By Melawe in forum The Cafe
    Replies: 12
    Last Post: December 29th, 2011, 08:07 AM
  2. Replies: 3
    Last Post: March 17th, 2011, 10:09 AM
  3. CHALLENGE - find the shortest path
    By ice in forum Algorithms & Recursion
    Replies: 13
    Last Post: January 20th, 2011, 12:30 PM
  4. locating the path to a jar file within a program
    By nemo in forum What's Wrong With My Code?
    Replies: 7
    Last Post: January 2nd, 2011, 05:41 PM
  5. [SOLVED] How to a set java class path?
    By captjade in forum Java Theory & Questions
    Replies: 1
    Last Post: March 10th, 2009, 06:40 AM

Tags for this Thread