File Saving Under Wrong IDE - java

I have been using two separate IDE's for my coursework (jGRASP and Netbeans). Whenever I attempt to save a file in Netbeans, the file automatically saves as a "jGRASP Java file" instead (see picture below). When I open the project from file explorer it automatically opens jGRASP instead of Netbeans, even though I saved the project while using Netbeans. Is there a way to ensure that projects I work on in Netbeans do not save as jGRASP files? When submitting my assignments, I have been instructed to ensure they are Netbeans projects (not any other IDE).

What it looks like to me, is the file association for .java files in your computer are set to use jGRASP, you should be able to just change the association in your PC and it would be fine. They are just .java files so if you submit them it should be ok, but you can change it.
https://support.microsoft.com/en-us/windows/change-default-programs-in-windows-10-e5d82cad-17d1-c53b-3505-f10a32e1894d

To explain a bit more, there is nothing in the file itself that indicates which application saved it. A source file is just plain text, and what you see when editing it is all that is there.

Related

Eclispe project "locked"

I have been working on a struts project for a month now, with the IDE Eclipse JEE. So far, everything was good, but this afternoon it decided not to update my project anymore.
Before that, after modifying something, I went on my project, right click, Export and then I exported the whole project into a war file and copied the result in the proper directory on the server machine.
Now, even if I updated one of the java files, nothing changes between one update and another. I even tried to completely erase the content of a file (the one that manages the user login), exported it into a war file and the website was still functional.
The weird part is that if I modify a non java file (ex a JSP file) the modifications work and I can see the difference on the website.
My theory is that Eclipse caches the java files to accelerate the compilation, so that if a file was not modified it does not have to entirely compile it again. But for some reason it is completely broken.
Some more details about the problem: even if I intentionally write something wrong in a file and save it, the red marker that should appear next to the file name is not there (same for the yellow marker for the warnings). I also have a weird red exclamation point on my project name and I don't think that it was there before.
So, does anyone knows what is going on ? Did I accidentally lock my project ? I tried to relaunch eclipse, close and reopen the project, delete and recreate it, I even reinstalled Eclipse but nothing works.
Ok I figured it out.
Turns out that one of the libraries I set in the build path was missing (don't ask me why, the JAR is still there but whatever). After removing it from the build path (as I was not using it anyway), everything works fine again.

Can't use the downloaded java file

I am trying to write some code to use class from a downloaded java file. I saved them in the same folder and I can open the file with Eclipse. I noticed that there is a hollow "J" there, then I researched related problems online and knew that this is caused by the build path of files. Those methods told me to open the "properties" in "Project" section, but the icon is just grey and I cannot do anything with it!
How to solve this problem?
Eclipse does not automatically refresh changed content in the file system. You have to refresh the workspace whenever you edit/delete/add files directly in the file system. Right click on the project (or the subfolder) you want to refresh and choose 'refresh' (or F5).

Importing .java and .class file gone wrong in eclipse

Recently I worked on a project on a mac, using eclipse. When I was done with the project I copied certain .java files and their corresponding .class files onto a USB drive and brought it to my personal computer. When I try to use the import feature on eclipse and import everything, my main method is not recognized by eclipse. It will work if I create a new eclipse "class" by the name I have in the program and copy paste the code. I have many classes so I can not do this for each one. Is there any way for me to change all .java/.class files into files that will be read by the system?
Thanks
An eclipse project contains a lot of meta information. Just open the project directory in a file browser, and have a closer look. There are files like .classpath for example.
When you just copy your source code, you leave all the meta information behind!
You should either copy the complete project directory, or simply use the export task to create a ZIP file of your project. (to later import that in other systems).
There is one other way you can do this. Just create a new project with the SAME EXACT PROJECT NAME that you did at school or wherever. After you create your project, go to your file explorer and navigate to the following place:
<"Directory to work-space">/<"Project Name">/src/
For ex: in Windows, it is Generally:
C:/Users/your_name/workspace/projectName/src
In here, copy all your ".java" files.
Now go to eclipse, right click on your project and hit refresh. You will find all your .java files there. Right-click on your project and hit "Run"->"Run as a Java Project". It should run! hope this helps.
PS: You do not need your class if you are executing it in Eclipse. Eclipse will create its own class files.

Java Noob : Dealing with image files in IntelliJ

I am Java NOOB (seriously, about two weeks) and using IntelliJ.
My homework is to make a classes, which can process given images(which is in "input" folder), and store them into the "output" folder.
I really have no idea where to put those two folders(input, output) in.
My question is, which place should I put them in, without changing given directory written in template code.
Screenshot of my problem
By default, IntelliJ reads files from the top level directory of your project. For you, that is HW6. Place the input folder there.
See also Reading files with Intellij idea IDE.
In addition, it is possible to specify the "working directory in IntelliJ". You can specify where files are loaded from from the Run Configurations:

When trying to open a .java file from windows explorer I get a "No project found to open file in" error message

So, when I double click a file in windows explorer, Intellij fires up, but instead of just showing me the file I want to see, shows up the following message:
I think I get what it means: it means this given .java file isn't associated with an Intellij project.
That's actually true, but even so I'd like to be able to open the file and see it with syntax highlighting and such.
How to overcome this problem?
Thanks
It's a known limitation which we plan to address in the future versions to allow opening and editing individual files without project context.
Please watch/vote the related issue.
I don't think you can'tcan by default. I'm assuming you are opening downloaded files or such. What I would is create a project (Scrapbook for example is a good name) on desktop and I would put/download the file I want to see in the corresponding src folder. That way when I'm clicking it would open properly.
Most of the syntax highlight and such goodness of idea comes from a proper project setup (proper JDK paths, libraries, etc).

Categories

Resources