Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8934219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:44:02+00:00 2026-06-15T09:44:02+00:00

I have an application that creates a temporary mp3-file and puts it in a

  • 0

I have an application that creates a temporary mp3-file and puts it in a directory like C:\

File tempfile = File.createTempFile("something", ".mp3", new File("C:\\));

I’m able to read it by just using that same tempfile again.
Everything works fine in the Eclipse IDE.

But when I export my project for as a Runnable jar, my files are still being made correctly (I can play them with some normal music player like iTunes) but I can’t seem to read them anymore in my application.

I found out that I need to use something like getClass().getResource("/relative/path/in/jar.mp3") for using resource files that are in the jar. But this doesn’t seem to work if I want to select a file from a certain location in my file system like C:\something.mp3

Can somebody help me on this one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:44:08+00:00Added an answer on June 15, 2026 at 9:44 am

    It seems you dont have file name of the temp files . When you was running your program in eclipse that instance was creating a processing files, but after you made a runable you are not able to read those file that instance in eclipse created, You runable file can create its own temp file and can process them,
    To make temp files globe put there (path + name ) entries in some db or property file

    For example of you will create a temp file from the blow code

    File tempfile = File.createTempFile("out", ".txt", new File("D:\\"));           
    FileWriter fstream = new FileWriter(tempfile);//write in file
    out = new BufferedWriter(fstream);
    

    the out will not be out.txt file it will be

    out6654748541383250156.txt // it mean a randum number will be append with file
    

    and you code in runable jar is no able to find these temp files

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have application that brings response via Ajax and creates 5-20 new jQuery click
I have an application that creates invalid Directories... e.g. c:\Program Files\somedirectory. - the period
I have created an application that creates bar graph based on inputs read from
I have a .Net application that dynamically creates a small HTML page and pops
Today we have a windows application that, using an OCX, creates a web page
I have an application that needs updating constantly. I would like to create a
I have a C# application that creates shortcuts to launch other programs with specific
Here is my situation: I have an application that use a configuration file. The
I have an application that in a certain moment has to create a temporary
I want to have an application that has a permanent database file(on a hard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.