I wrote a calender plugin in eclipse with rcp and to input some data in my calender I used a csv. file. When I export my plugin as deployable plugin get I a jar. file. Thats fine, but when I add this jar file to another project have I no access on the csv. and cannot change the data in it. If there is a solution for it?
Greets
I am not sure how you have implemented this.But better you keep the .csv file in the plugin itself.Also If you could explain why you are using the csv file, there could be better options than csv file.
Iff you already have added in the project , Make sure you have checked (selected)the file in Build tab of Maifest.mf file(So that it is exported with the jar.)
Related
I wrote a little Java app for analyzing .csv files. Now I want to keep reading from and writing to a .txt file, which acts similar to a mini-database. For this purpose I simply added the .txt in my project and used the Files.readString(Path) and Files.write(Path path, byte[] bytes) methods.
When I do this in IntelliJ I have no problems but as soon as I build/export the file with Maven and started with the created launcher the app didn't work because the project structure / file organization isn't the same anymore.
I also tried to just add the .txt file to the exported folder afterwards but even then I couldn't manage to implement a relative path to the file.
I'm still relatively new to programming and it's just a small app so I don't think mySQL would fit my needs. I've also read that I could store the data in a property file but I don't know if that would be the right way to archive what I want. Certainly it must be possible to somehow keep a .txt for reading and writing in your exported project. Does someone have an idea?
If you use a ยด*.txt` file for storing, that file cannot be inside the jar because the jar cannot change its contents while running.
You need to put the file somewhere else, either at some dedicated location (let the user choose/configure one), or next to the jar. To figure out your own execution path, you can use
How to get the path of a running JAR file?
Maven is one tricky tool. You need to go to the pom file and add the resource.
Unable to add resources to final jar for maven project in Intellij.
-I hope this helps
Trader
I'm working on a group project using IntelliJ, but my partners are using Eclipse. In IntelliJ I was able to place my csv files in my project folder and I am able to access them by just using the name of the file. However, my partners using eclipse are unable to use the csv files this way. The only way they have been able to is to type out the whole file location which obviously won't work if we are running the program on different computers. I don't have experience with eclipse is there a solution for this?
The default location for file I/O in Eclipse projects is in the root project directory. The Eclipse users will need to adjust their project settings so the default path is set to where yours is in your IntelliJ project.
I currently involved in a project which requires to load a properties file which is located inside a jar file and i need to edit tat. I have Googled a bit and saw quite a few different ways of achieving this ALL idea says i need to rename it to .zip file and after editing again converted to .jar , but i am not satisfied with that answer because i would like to perform the editing without extracting the jar ...is there any possibility by using command prompt or using some interface.... ANY IDEA FRIENDS
JAR files are built on the ZIP file format and have the .jar file extension. you can create or extract JAR files using the jar command that comes with a JDK. You can also use zip tools to do so;
You have to know that JAR files - like any other ZIP files is in compressed format. You cannot update a file inside a zip archive without extracting it and putting it back to the archive,no matter what tool may you use (Zip,WinRar,7-Zip or jar) you are just extracting the file and editing and then putting it back to the archive.The below given answers are also doing that,but the file are being extracted to a temporary directory and you are not seeing it.
If you install 7-zip you should be able to open the jar file directly and drag the properties file out of the archive to the desktop or something. Once there you can open/edit then drag it back to the 7-zip window. That's how I do it.
Use 7zip, right click on jar and with 7z say open archive, then go to property file, double click and open file with notepad, edit it and save. Now when you will close 7z console, it will ask "update archive?" Say yes... That's it.
Yes you can, In Centos 7 and the vim version 7.4 you can edit zip or jar files zip whit out unzip. So you execute the next commands and you can edit your properties file.
vim Programm.jar 2
[Then you see a lot of directories, so you go to the specific file you wan edit and push enter then you can edit the file use vim with the vim commands.]
i have developed a project in java using swings and mysql. now in order to assign security to the project i want to store the Registration key in an unknown file format like .xyz using serialization. the key entered by the user is compared with the key stored in .xyz file. now, is it possible to add my .xyz file with jar file? if yes how is it possible? please help me to complete the project. thank you.
Jar file is just a zip file. You can add there as many files of any type as you want.
I do not know how your project is organized. If you do not use maven or gradle you probably have to add your file to src folder. If you do use maven add it to resources folder.
I am trying to use the jAudioPackage in a class project. I need it's functionality of getting the id3 tag info from the header of a MP3 file. I looked at the website and once you have everything set-up it seems pretty easy to use. I am just having trouble with actually importing the .jar file which contains the code. How would I go about this in NetBeans?
To summarize, I have the .jar file I just dont know how to get to use the code within the file.
Right click on your project and go to Properties -> Libraries -> Add JAR/Folder and select the jar file in the following dialog. It should then have access to it when coding/compiling.
You need to add the jar file in your project's libraries. Read http://netbeans.org/kb/docs/java/project-setup.html#projects-classpath.
Please read the documentation for the library as to what the calls are and then call the required methods in order to accomplish what you are doing. Before you do that you will have to import the jar in to your project...