unable to include external files in a project - intellij-idea

I have created the default play application in IntelliJ in directory P. I have over-written the default index.scala.html with my own html code. The html code refers to some css and js files which are outside the directory P. To include these external files, I added the directory of these files using project configuration settings.
My webpage doesn't load properly as the server returns 404 for the css and js files. What am I doing wrong?

When you added your directory using project structure, you only say:
Hey, IDEA, please consider this folder part of my project, consider
its contents source code and display it when I open my project.
However, when you deploy or run your app, you only deploy the usual folders to the server, which contain the resources which will be available for clients to access.
The external directory is not part of these directories and will not be deployed.
What you can do is to copy the file from the external directory as a part of your build process before deploying the application.
EDIT: Detailed answer here: What is intellij's build process for play applications

Related

Importing file from another folder to an Intellij-idea project without copying it?

I have a Python project in IntelliJ-Idea.
I would like to import a remote file into my project, without copying it into the project folder (but it should be just listed in idea)
Is it somehow possible?
You can add the remote file by adding a content root to your module.
See Project Structure > Modules > 'YourModule' > +Add Content Root
This will include the 'other' content in your project without physically copying the other content into your project.
Note: you will of course need to be able to access the other content from within IntelliJ so by "remote" I presume you mean not located within your project directory but available on your host rather than something like 'available in a remote GitHub repo'.

How to upload files to the "SuiteScripts" folder from Netsuite IDE (Eclipse)

I am fairly new to NetSuite and NetSuite scripting. My company has several dozen script files already in the NetSuite File Cabinet, under the default SuiteScripts folder. Also, I am using the SuiteCloud IDE, which is just basically Eclipse with a NetSuite plugin. This way I can download all of the scripts into a single SuiteCloud IDE project, work on them locally, and then upload them back to the server for testing.
When you create a new NetSuite project, one of the project settings is File Cabinet Folder. This defaults to a subdirectory under "SuiteScripts" with the same name as your project. For example, if your project is called "MyScripts", the default will be SuiteScripts/MyScripts. You can of course change this, but it is impossible to just specify the SuiteScripts folder alone, as I get an error saying "File Cabinet folder must have 2 segments." However, the existing scripts all live under SuiteScripts (no subdirectory). Any file that I upload to the server, whether it be a new file that I created locally or even a previously downloaded file that already exists in the File Cabinet, will end up in SuiteScripts/MyScripts. This can be hugely problematic, causing dupes and all kinds of other nastiness. Anyone have any experience with this? Thanks.
Yes, NetSuite has decided to limit the uploading functionality to subfolders of SuiteScripts. If I had to guess, their intention there is to force you to place your scripting projects in their own folders so that the SuiteScripts folder itself does not get cluttered with scripts.
You can specify a subfolder of SuiteScripts with any name; it does not have to be the name of your Eclipse project. You have a couple options, depending on how you want your files to be organized in Eclipse and in the File Cabinet.
The way we typically do it is to create a single folder that will house all of our scripts, call it SuiteScripts/Projects/. In the file cabinet, we create this Projects folder under SuiteScripts. In Eclipse's NetSuite Project Settings, we map our Eclipse project to SuiteScripts/Projects. In our Eclipse project, we group related source files logically into folders, like iPad Integration or Approval Process. Then we upload to the File Cabinet, and now we have a nice folder structure of organized scripts, something like:
SuiteScripts
Projects
iPad Application
iPadScript.js
iPadRESTlet.js
Approval Process
SalesOrderApproval.js
PurchaseOrderApproval.js
We have much more detailed naming standards for our files, but you get the picture.
My recommendation is to create a new folder in your SuiteScripts folder and move all existing scripts into there using the File Cabinet's "Move" button. Then, map your SuiteCloud Project to that new folder and upload/download as needed.
I agree with the erictgrubaugh's solution and I've been following stoic software's tutorials. But steavepoll if you want to change it for only one script then you can follow these steps:
Create new SuiteCloud Project under the same folder which you are targeting
Edit into mainfest.xml file(right click->NetSuite->Add Dependency References to Manifest)
Validate Project against Account
Deploy
It worked in my case

How to include static resources in IntelliJ from external source?

At my work every project ha have two parts:
1. The project itself;
2. A external folder containing the JS, images and css.
We have an automated process that deploys this parts where they have to be. The first one at Weblogic and the second at Tomcat.
What I want to know is if there is a way to include this external folder with the application statics to the IntelliJ so I can edit them inside the IDE.
Now I'm editing the JS and CSS inside Notepad. And it is very annoying.
You can create another project via File -> Import Project, locate the folder of your static resources, then choose "Create project from existing resources".
You will end up with two projects but it should be easy to toggle between the two.

How to change the path that jar files use in java Web Applications

I have written a java Servlet web application, using NetBeans 7.2.1. The program have some jar file libraries that I have attached to the project. The application runs fine using NetBeans and Apache Tomcat 7.0.27.
My problem is that some of the jar file libraries that I am using in the project, need to access to some folders and files. I put these folder and files on the same directory as the whole NetBeans project is. but I got this exception:
Exception: java.lang.RuntimeException: java.io.FileNotFoundException
So I used these codes to find out where should I put them:
out.println("current directory: " + new File(".").getAbsolutePath());
out.println("current directory: " + System.getProperty("user.dir"));
out.println("current directory: " + getServletContext().getRealPath(("/")));
So I figured out that the current working directory is:
C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.27\bin
My question is that how can I set different directory address for each web application? I have many web applications and some of them use the same resource file names. I can't just put all of them in one directory.
Please note that I don't have access to the source code of jar files to change the. I just need a way to set the absolute path that the jar files use.
I have the same problem when I put the WAR file on the unix server. The extracted WAR file is in this location on the server:
/data02/tools/Apache/Tomcat/apache-tomcat-6.0.37/webapps/BANNEROnline
But I figure I should put the resource folders and files in this path (moosavi3 is my username!):
/home/moosavi3
How can I change the path?
The working directory is the directory from which java.[exe,bin] is started. I assume the bin directory is where the tomcat start-up script is? If the jars are all using this working directory I don't believe there is a way to make different web-apps have different working directory, they're all loaded on the same jvm (java.exe) from the same working directory.
A working directory is the directory from which a binary is started, it is not some arbitrary value that you can change.
I suspect these jar files where meant to be run as standalone applications and expected the filesystem resources they are trying to access to be in the same location as themselves.
Any filesystem resources would have to be moved to the location of your java.exe so that the correct file path resolution can result from your jars.
Standard Servlet project requires external libraries to be placed in the 'WEB-INF/lib' directory under project root. You can search google for 'servlet directory structure' and do your own research for more information. Shared libraries between web applications can be placed in the 'lib' directory under tomcat root, they should be picked up by tomcat jvm. My recommendation would be to keep the dependencies project specific, because you may need different versions in different projects in the future.
Update:
Read this page on the tomcat documentation, it will explain exactly how the project should be structured, and how to add a library that will be shared across all web applications:
http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html
Update 2:
The following Stackoverflow link explains several options how to add a static file to your web application, that will available at runtime.
https://stackoverflow.com/a/2161583/940754
Update 3:
Add a path to the classpath using the project's manifest:
http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html

What is the file structure of the Share Webscript extensions for Alfresco 4.0.3+

I've been reading David Drapers' blog on the new feature - the extension of share webscripts, but I didn't find any working examples. What is the file naming and structure convention?
From what I gather, I have a module configuration file, and I don't know how to name it or where to put it (share/WEB-INF/classes/alfresco?)
Also, I understood that my custom client side resources (.js and .css files) go to META-INF/custom-dashlet/extension/ in the JAR file. Is this correct? Finally, the *.get.js and *.get.html.ftl go to webscripts/com/mycompany/mypackage/*?
So I have now:
*share/WEB-INF/lib/mypackage.jar*
and in it:
*META-INF/mypackage/extension/myfile.js
webscripts/com/mycompany/mypackage/myfile.get.js
webscripts/com/mycompany/mypackage/myfile.get.html.ftl
*
and the
*share/WEB-INF/classes/alfresco/something.xml*
This question was also posted to the Alfresco forums here: https://forums.alfresco.com/en/viewtopic.php?f=48&t=46438
The answer provided was as follows:
An extension module a Surf configuration object so you should place XML files containing module configuration in any of the locations where Surf config gets picked up... e.g. <web-server>/webapps/share/WEB-INF/classes/alfresco/site-data (there are lots of places where Surf configuration gets picked up, but alfresco/site-data on the classpath is the most common). Extension config files should be placed in the extensions folder within the directory. So you could place an extension config file in: alfresco/site-data/extensions or alfresco/web-extension/site-data/extensions, for example.
You could create a JAR file containing this folder structure. Everything that the extension refers to (e.g. WebScripts, other Surf config objects such as Pages, Template-Instances, Components, etc) should just be placed in their normal location. These can also be built into a JAR file.
If you want to access resources (e.g. CSS, images, JS) from a JAR file then place them in the META-INF folder of the JAR. You should place your JAR file in the <web-server>/webapps/share/WEB-INF/lib directory (obviously your server will need to be restarted to pick up new JAR contents).
WebScripts should be in (on the classpath):
alfresco/site-webscripts
alfresco/web-extension/site-webscripts
webscripts
You can also configure other locations in the Surf configuration from which to load Surf config objects/WebScripts. It's pretty much endlessly customizable but you should probably just stick to the default locations configured for Share.