Initially, I have a folder 'Project' containing my scripts and a configuration file.
script1.py
script2.py
config.yml
In 'script1.py', I need to import 'script2.py'. Everything was fine.
After moving all the scripts to a sub-folder 'Project/code', it reports error "can't find script2". Then after searching around, I followed the advice and marked the sub-folder 'Project/code' as the source root and add a 'init.py' in the sub-folder. Now it reports error "can't find config.yml". In my scripts, I need to import the config.yml file.
I prefer not to provide a absolute path in front of the config.yml file, as the scripts are sync with a remote server.
Related
I am trying to create a task that needs to read from a file in IntelliJ EduTools.
I tried creating a directory at the root of the course and marked it as a resources, I tried putting the actual file in the src component of the Task. I tried a number of locations for the resource file.
Here's what I got. Once I created a resource file at the top level of the project, the task was able to work. However, the tests were not able to find the file. (I then tried creating a test resource directory in many locations without success).
Where should I place resource files for Tasks and Tests to run in IntelliJ Edu Tools?
You should put the files for tasks into the task directory and files for tests into the tests directory. Path to file should be defined like this:
./filename.extension - for task files
./tests/filename.extension - for test files
I want to open the Mule project from a repository folder that contains the project with the following folder structure.
I am doing this so I can commit the changes of the project straight to the repository (so others can also download the changes) without having to export and import the project as a zip file every time.
I am getting the following error message and Mulesoft also overwrites the mule.xml file to a blank file.
Is there anything I can do to avoid this from happening?
workspace print screen
option when importing
error message
You need to carry mule-project.xml, .classpath and .project files in the repository in case that you are not using Maven.
Please check / share your gitignore file. Also check the Error Log, there should be description of what is missing.
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
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'.
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