Added text file in eclipse but cannot find it - java

I have a java project in eclipse. I right clicked my package and used the option: "add -> new textfile" a textfile was created but I cannot see it in my package.
Where do I located the textfile I created?

If you used New->General->Untitled Text File (I'm using Luna) the file appears in the text editor but isn't saved to the filesystem until you explicitly save it, and then you are prompted for the location to save it to.

You need to save the file as File -> Save or File -> Save As to locate it in package / directory.

right click on you package New>Other>General>Untitled Text File

Related

A file with the name User always saves as a text file in intellij

I am working on a Spring Boot application. I need a Java class named User. Ever since I created it as a class in IntelliJ, the file has been saved as a text file. I have deleted the file and made new Java classes with other names. The files with other names save as a Java class, but whenever I name it User, it saves as a text file. When I open the project in Eclipse, the file saves as a Java class, which was unusually odd.
Project Explorer
Package Explorer
In intellij press ctrl+alt+S , it should open File Types settings
Settings -> Editor -> FileTypes
In the Recognized File Types go to option Text and check in File Name Patterns
if it has User.java or any other pattern that points that file names starting or contain user should map to txt file.
basically this is telling intelliJ that it needs to interpret the given patterns of file as .txt file.
you can remove the patterns that are not required.
you can check the image below. hope it helps :)

Android Studio : how to copy/paste a .sfb file from one project to another?

I have got a project (implementing Sceneform) that contain sfb files in the raw folder.
I want to copy/past these sfb files to another project. But when I paste them, the content is no more readable even if the file is ok in the 3D preview window.
How to copy/paste a .sfb file from one project to another ?
Ok, found the solution. You have to create a sampledata folder like explained here: https://developers.google.com/ar/develop/java/sceneform/import-assets
And copy/paste also all your sfa, fbx, bin, etc.. files here.
And then the text in the sfb file will become readable.

Where the file will be located while using IO Streams in Java In Eclipse IDE?

I want to print the output in a file. I am using PrintWriter IO stream to add the data to file. When I want to check it, I don't know where the file is located. I am using Eclipse IDE.
PrintWriter writer=new PrintWriter("output.txt","UTF-8");
writer.println("Barcode Reader");
So can any one point me to where the file will be located?
I had this problem initially when I switched to using Eclipse. The current relative path is set to the project directory. The following code snippet will explain this better.
Path currentRelativePath = Paths.get("");
String myPath = currentRelativePath.toAbsolutePath().toString();
System.out.println("Current relative path is: " + myPath);
Note that the Path object is received from a get method in Paths((plural)). They are located in java.nio.file.
Further information about this can be found in the Path Operations page.
Does that solve your problem?
It will be present in your project's root folder.
Just open your project folder from your workspace using Explorer and it will be there.
With a filename like "output.txt" it will be placed into the current working directory.
Unless you specify otherwise, in Eclipse that will be the root directory of your project.
You may have to click "Refresh" for it to show up in the File Explorer.
If you give you file name directly like C:\java\workspace\ocpjp7 (a Windows
directory) or /home/nblack/docs (the docs directory of user nblack on UNIX), you can find your file in those directories. But if you don't give the full path, it will be in your current working directory.
"output.txt" -> root
"src/resources/output.txt" -> in resources package
At first you should create this file with File in directory you want.Next step to write data into the file. Your file will be located in directory you want , you set when file has created.
Also check this class FileInputStream

Changing java security file in windows

I am trying to edit the java.security file in windows. When I add an entry to it and try to save, it says 'Access Denied'. How do I change the permissions to this file.
I have also tried by making notepad to Run as administrator but it didn't work.
Please help.
Try this and say if it works. It worked for me while opening hosts file.
http://www.labnol.org/software/edit-hosts-files-as-administrator/13673/
edit:
The relevant information from the linked page:
Step 1. Open your Windows start menu, search for the notepad application and then right click the notepad icon.
Step 2. Choose “Run as administrator” and then, while inside notepad, browse to folder (java.home\lib\security\java.security).
You can now edit and save that file in the same folder without any issues. To recap, the trick is that instead of directly opening a protected file in the associated application, you run the application first as an administrator and then open the file inside it.
1) Copy original java.security file to desktop.
2) Edit the file there and save it.
3) Copy the file to %JAVA_HOME%/\jre\lib\security
4) Replace the original file with modified one.

Netbeans: how do I change the name of a project?

I need to change the name of my application, so people who download and install it can see the name but I don't know where to do it.
What file do I need to edit?
you must right click on your project in Project window [ctrl + 1] and choose rename option for
renaming your project name.
if your project is mobile Project you must right click on project name , select properties options and then on Application Descriptor edit MIDlet-name value.
If you use gradle:
BuildScripts/Project/settings.gradle
rootProject.name = 'yourprojectname'
If your project is Maven based, you can either add/update the application name in pom.xml (found in Project Files folder) or go to File >> Project Properties and add/update the application name.
Open "project.xml" file under nbproject folder inside the project folder of the one you want to change the name.
it is in the tag <name>.
Just change it and that is it.
open project.properties in dir nbproject
look up to manifest.midlets and change the name after MIDlet
Rightclick on the project node and select rename.
If you want the folder of the project also to have the new name or whatever that wasnt renamd then :
1.in build.xml in text editor find old name and replace with new one. Its place is: C:\NBProjectsFolder\OldName\build.xml Save that.
2. Remove all cash situated in , e.g.: C:\NBProjectsFolder\OldName\build\gwt-unitCache.
3. Find in C:\NBProjectsFolder\OldName\nbproject\private private.xml file and edit it in a text redactor by renaming old name within the file. Save that.
Do all the changes when the Netbeans was closed.
After opening the Ntbeans it may ask to reimport the project and all files you changed will be recognized/recreated automatically

Categories