Create JAR with an enclosed txt

Asked

Viewed 202 times

0

I have a program that saves contacts in a simple txt file, but when I want to run the jar on another machine (I use the jar for the netbeans package store), when I run on another machine it does not find txt.

On android I can do this by placing the txt file inside the Assets folder, in java I read something about ClassLoader classLoader = getClass().getClassLoader(); but I couldn’t either.

To do this I must put txt in some specific folder or it is otherwise?

  • 1

    Try to change your code so that if it does not find the file, it creates a new one and starts using it. This way, on each machine it will create a different txt. Now if the goal is to have txt in common with various machines, I think this is not the best way, maybe a database is better.

  • 3

    Look at this question here, a problem similar to yours. txt file is not found when generating file. jar

  • 1

    made using ftp. thanks

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.