How to add new .java source file in Spring MVC project - spring-mvc

I have copied a new .java file in relevant src folder. But, it doesn't appear in project explorer in STS4. No option in IDE to import file.
I know this is such a simple thing. Should have obvious options there. However I am not getting clue.

Press F5 or execute the menu item Refresh on the project once you have added a file to the project from outside the IDE, like on the file system directly.

Related

JavaFX Application not loading fxml files when exported to a jar file

I have just finished my first java project, however I can't seem to get it to build properly. It will load the initial fxml file that the whole calculator runs on, however when I try to add a holiday/break in the holiday/break menu a dialogpane is supposed to display so the user can fill information, but I keep getting a location not set error when I run the jar file in the cmd. It all works when I launch it in intellij but not in the jar.
This is how I have my files set up. I made a resource directory in the FinishedCalCulator project and marked it as the resource root
This is how I set the Location of the FXML file into the loader. This works when I run it in Intellij but not in the jar file.
Project Structure
Running through CMD
Invocation Target Exception/Location not set error
I have looked around and found a few posts talking about putting all of the fxml files into a resource file and I did that and got it working again in Intellij, but it still will not display the dialog panes when I try to add them. I'm not really sure what I am doing wrong here. I don't think I fully understand what I am doing wrong. Any help would be great.
To expand on my comment...
Answer
In your code you are calling getResource("/addHolidayDialog.fxml"). Your resource's filename, however, is AddHolidayDialog.fxml. Simply change the "a" in your code to "A" and your code should work.
Explanation
Running from Intellij
When you run your application from Intellij it uses the output files in the out/production/classes directory. In other words, the classes are not in a JAR file. When you call getClass().getResource("/addHolidayDialog.fxml") you will get a URL like:
file://C:/.../out/production/classes/addHolidayDialog.fxml
Which works on Windows despite the fact the file is actually named AddHolidayDialog.fxml because Windows has a case-insensitive file system.
Running from JAR
Then you export your project to a JAR and run it from there. Calling the same getResource code you will now get a URL (if the code worked) like:
jar:file://C:/.../your-application.jar!/addHolidayDialog.fxml
What your code actually returns from getResource, however, is null. According to the JAR file, the resource addHoldiayDialog.fxml doesn't exist. It'll happily tell you that AddHolidayDialog.fxml does exist, however. The reason for this being that a JAR file has a case-sensitive "file system".

How to add a project to QTCreator

I have a project with so many files and all the files are either CPP or Java. I want to add this project to QTCreator for code navigation and code completion while editing. I don't need QTCreator for compilation. Can anyone please help me how to add this code to QTCreator.
You can just start a new project, selecting "Project without Qt".
In the new project right click the project folder and select adding an existing directory to it.

Use script files from another project inside same solution

I'm trying to use some script files between different projects. I have one solution with four projects. In the project "A" I have some scripts like Jquery, Javascript Plugins, etc, and i want to use them on the project "B", by adding a scriptmanager, or anything that works. What can i do this?
I'm using Visual Studio 2010.
Here is a printscreen with my environment.
[EDIT]
Hello, after doing what #CStick says, a have now the scripts in my other project, so a can't add them to a ScriptManager. The problem is path not found on Asp.net code. It cant find the script cause they're placed in the other project. What can i do to solve it?
I know this is old, but for future reader i post an answer.
You will have to use "Link project file" for this.
From the target project, right click on the folder you what the file to be
Select add -> Existing file
Browse to the file you need then click on the arrow at the right of the add button and select add as a link
After this you can modify the file in booth project, but the fille will be only in the source physical location until you publish the project.
This can cause problem for client side file, like script file, on debug because you cant view the file because it's not physically in the target project.
You can use MsBuild to copy the source file on the target directory on build.
(See this answer)
In short, you will create a .targets file then add a reference in your project file.

recover project in visual studio 2010

i have 4 project in my solution, framework , domain objects,business objects and website ...
but this morning website project couldnt be loaded... when i tried firsttime to open solution... "The solution file has been modified outside the enviroment" message seemed and press reload then error is project file is corrupted... how can it happen... how can i fix this...
thx..
One way... if its from some source control , get the latest and leave the changed part by you.
If you dont have any source control then you can have the two options
- Create a new solution and add all your projects to it and rebuild it. Check for the errors.
- If your code is completely corrupted and files are unreadable, that is unrecoverable,
then you must have to follow this
copy the projects dlls out of bin
dir,
use red gate reflector and extract
all the class file in new project
file.
Now for aspx.cs you can create a new
project add all aspx file in that new project and also the
new cs files generated by the reflector addin. Do it for all pages. When done , right click on Project of web app(if its), then choose convert to web application. Also check the Page header of each page that they are using the same class files.
I know this is little bit tough , but will work....to recover almost that much code, when your app was last compiled.
Note : Also you will have to maintain the hierarchy of the project as the reflector add in (FileGenerator on Codeplex) might miss the actual project hierarchy.
You can open your solution file (.sln) in notepad and check for the consistency of the document.
The sln file will be in a hierarchical structure (like we have an xml).
You can also open csproj files of different projects that you have in the solution check the xml of the csproj.

Source from external Folder (linked Source) not appearing in Flex?

i have a Air Project in which i have added three extenal source folders.
but when i reopen project or strat flash builder again i get icon on those folder like this
but when i open the configuration for that project and try to validate the path and adding it again i get message like this
but the path is valid. proof is this pic
what could be possible error,,, is there any way that i when ever re-open project i get no warning and able to navigate through the linked source code. now i am doing it
1- deleting on of the linked folder
2- again adding that folder.
as for quick:
install flas builder 4.1
2.imort that project into workspace
3rd is using maven ;)
check your project files,
.actionScriptProperties
.flexProperties
.project
make all of them writeable. this issue occur when you get code from Visual Source Safe that the files are copied to local machine in read-only mode.

Resources