In my Flex/BlazeDS application I'm trying to read a properties file to load database connection settings. Where should I keep this file (the location) in my project so that I can read the file as in Client Server architecture.
I tried to write a new file into the server root location
new FileOutputStream("OracleSettings.properties")
but the file was never created. I refreshed my Project, explored through Windows Explorer and Searched through Search Engine but was unable to locate OracleSettings.properties file.
How to include this file into project properties so that Eclipse will also export this file into the output folder of the application???
I use Eclipse with FlashBuilder 4.6 Plugin
I created a Flex Project with Server type Java and loaded BlazeDS war file.
Thanks in Advance.
FlexContext.getServletContext().getRealPath("/") is your web application root location.
Related
I am developing an application in Spring-Boot with an embedded tomcat server.
My program downloads documents to the public class path inside the resources folder. Also I am accessing the files downloaded in Iframe tag in HTML, so the file should be in server for me to access it.
When I run the code from my eclipse IDE , it works fine, and I am able to access the files but when I run the war from the command prompt(Since it has an embedded tomcat server) I am unable to locate the folders. Please note that I opened the war and was able to find the folders but the program couldn`t access it.
Any Idea on how to access class resources folder from tomcat embedded war in java? Any help would be much appreciated.
TIA
Try:
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream inputDataStream = classLoader.getResourceAsStream("some-file.txt");
I want to access directory of domino designer project by java agent to make report from database ,I want to save this report file in agent directory I try this code
File file = new File("Local/file.txt");
but it doesn't work.Can any one help me please?
Domino Designer for Eclipse creates the Local directory for each project in a location you can figure out, but it probably is NOT the place to create a report file. The Local directory is in the Notes/Data/Workspace/<servername>/<dbpath>/Local. You would be better to use a directory below the Notes/Data directory which you can find using NotesSession.getEnviromentString("Directory", true)
I'm trying to deploy my app to Web App Engine. I have WAE module in web part of my project; there is a path specified in Modules/web/Google App Engine:
/Users/Kamil/IdeaProjects/appengine-java-sdk-1.9.12/
Although when I click on we in general (Modules/web/"Paths" tab), I see following settings:
Output path:
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/classes
The problem is:
When I click "Upload Web App Engine Application" following error appears:
Bad configuration: Could not locate
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
I don't get it why it tries to search in wrong directory, not the one specified in Modules. Please advise.
Edit
I noticed that in Modules/web/"Sources" tab whole folder named "target" is excluded. Maybe that's the problem?
According to the error message
Bad configuration: Could not locate
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
, the deployment code is looking for appengine-web.xml, a crucial config file for your App Engine app. It's looking for that file here:
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
Is it possible that the file
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
could not be located ("Bad configuration: Could not locate ") because the file
/Users/Kamil/IdeaProjects/NameOfMyProject/web/target/web-1.0.0-SNAPSHOT/WEB-INF/appengine-web.xml
does not exist?
The path /Users/Kamil/IdeaProjects/appengine-java-sdk-1.9.12/ is the path to your SDK, not the target folder, and is not related to this issue.
The target file is excluded from "sources" because "sources" is the location of files that are included as source code into the build. The target folder is the opposite of source files - it's the flattened-out WAR archive that is used to deploy your app. The deployment tool you use will pack it up into a .war file and send that to the App Engine data centers.
Finally, the output path folder .../classes is where the compiled .java files that turn into .class files for your app are put.
I think you should look into some tutorials on IntelliJ and App Engine to make sure that your project was created and configured properly.
Good luck!
One you can do that locate build folder in explorer and delete it. After that reopen android studio build it again and run it. Now every thing is fine.
I am using eclipse Indigo IDE ..I am developing a jsp application (myProject) using eclipse in which i have a property file (myProject\webcontent\db.properties) for configuring database credentials.
I am trying to access this file from a class (myProject\src\samplePackage\sampleDBConnect.java). I have exported samplePackage.jar into *myProject\webContent\WEB-INF\lib*.
I have a Test.jsp page which calls a method in sampleDBConnect.java.
When i am trying to run this Test.jsp page, the current directory path shows C:\Documents and Settings\username. I have my project in some other drive(E:).
Can someone tell me how to access the properties file....
getClass().getResourceAsStream("db.properties");
This assumes your db.properties is in the same directory "samplePackage".
If you want to keep it in src directory or say resource directory then use
getClass().getClassLoader().getResourceAsStream("db.properties");
Since your java code belongs to the same web project you don't have to create a jar of the same project and place that in the WEB-INF/lib folder
move db.properties to myProject\src dir,
java code:
InputStream input = sampleDBConnect.class.getClassLoader().getResourceAsStream("db.properties");
I am developing a web application.
My project is stored in
F:\Pro1\OHCMS
Now i want to upload a video in
F:\Pro1\OHCMS\Webcontent\Video
folder.
When i write
filePath=getServletContext().getRealPath("/Video")+"\\";
It is returning file path as
F:\Pro1\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\OHCMS
How can i get the real path of my actual Webcontent folder ?
Your application is being run by your IDE's default application server. That is, your WebContent folder is actually copied to somewhere else (check out your build script to know where exactly is it copied). And after that, all your data is published to server.