I'm using the latest IntelliJ IDEA Community IDE with the latest Python plugin to edit Jython code. In the IDE I can edit and run pure Python code using the Jython runtime installed on the machine.
However when I import a java class, the IntelliJ IDE marks the elements in the import statement as "unresolved references". But the code itself correctly runs.
Is there anyway to convince the IntelliJ syntax highlighting that this is valid Jython code?
One solution to my issue was to install the Jython Helper plugin (also on Github). This plugin creates stub files for any Java class that is referenced by a Jython program. Once the stub files are created then the red lines go away. But as I have already proved, the red lines are not an impediment to actually running the code.
Note that I am not associated with this plugin, I only discovered it after posting my question.
Related
Like the title says, I downloaded Pycharm and now my Java project in Intellij is broken. IntelliJ was totally fine beforehand. I know have errors in every file in random places. I also had errors on java imports such as "import java.util.List", (resolved now, see below).
In IntelliJ, I went to File > Project Structure and saw that the SDK was set to Python 3. I changed that JDK 1.8 that I already had set up. That resolved the import errors but I now have weird methods that can't resolve such as concat() or orElse().
Any ideas??
To fix this, I had to right click on the pom file and click "add as maven project"
I'm having some trouble on putting tornadoFx in my project. I'm using the last version of IntellIj, Kotlin and I'm also downloading tornadoFx from here:
TornadoFxGitLink
I added the pom file to Maven and I already tried to change a few things that Readme of tornado recommended to me like use 1.1 kotlin version or updating IDE.
The thing is that when I create a TornadoFx file in the project and I try to build, these error appears:
import tornado.fx is apparently an unresolved reference
Can someone explain why is this happening or why these errors normally appear?
Thanks in advance, I'm open to all questions due to my bad english.
That import is not needed or at all pointing to anything TornadoFX related. The only import you need for the most part is import tornadofx.*.
Install the TornadoFX IDEA plugin, and it will add the import for you. You should also start be reading the guide.
You should not be downloading TornadoFX manually, use Maven or Gradle to import the dependencies.
I recommend trying out TornadoFX in a simple standalone project first, for example by creating a template project using the TornadoFX IDEA Plugin. After you understand the basics you can revisit integrating it into an existing application.
I have a license for PyCharm Professional and am using IntelliJ IDEA Community Edition to develop a plugin for it. I need to run the plugin in PyCharm to test it out. I can't use the Python plugin for IntelliJ IDEA to test it as only the Community edition of the plugin appears to be available for me. If I manually download the professional version and try to install it I get Plugin 'Python' is incompatible with this installation. I assume I would need IntelliJ IDEA Ultimate to be able to use the professional version of the Python plugin.
I saw this question, which suggests it is possible to use PyCharm as the target for a "Plugin" run configuration, but I haven't had any luck following those steps. I set the JRE to /opt/pycharm-professional/jre64 but got Exception in thread "main" java.lang.ClassNotFoundException: com.intellij.idea.Main. I then grabbed the java command line args from a running instance of PyCharm and added those in (particularly the classpath) but got Error: Could not find or load main class com.intellij.rt.execution.application.AppMainV2. I haven't been able to find anything in the docs on how to set this up.
I know there is one for play1, but I don't find any for play2.
I hope the plugin can compile the templates to scala code automatically. It's not convenient now.
I just came across Scala IDE Play2 plugin for Eclipse Indigo/Juno and Scala IDE. The current features are
Syntax Highlighting (routes and templates)
Code completion (templates)
Formatter (routes)
Hyperlinking (routes and templates)
Note that hyperlinking to Java files is not supported for now. Also there are some limitations for the code completion feature, just take some time to read the doc. I didn't try it myself as I'm not working with Play2 right now, but thought it might be helpful for someone.
Edit: This answer is outdated. A Play Eclipse plugin has been written, as #Baztoune says.
There is no Play 2 plugin for Eclipse at the time I’m writing these lines. However, there is an eclipsify sbt command, provided by the Play 2 sbt plugin, which is able to generate an Eclipse project from a Play 2 application.
You won’t get syntax highlighting, contextual completion or code navigation inside Play 2 templates, but you can have them to be automatically compiled when saved by using the ~run sbt command (instead of just run). Check the Eclipse “General −> Workspace −> Refresh using native hooks or polling” option is enabled so it will take compiled templates changes into account.
Yes, here's how to get started:
Find the correct update site for your version of Eclipse from http://scala-ide.org/download/current.html.
In Eclipse go to Help->Install New Software. Use the update site from above to locate Scala related plugins.
Install both the Scala IDE for Eclipse plugin and the Play2 support in Scala IDE plugin. Note that the Play2 support in Scala IDE plugin is listed under the Scala IDE plugins checkbox.
I was unable to get this working at all starting from bare Eclipse, as many sources have suggested doing. The problem seems to be incompatible dependencies that only show up after much wasted time. The Scala IDE route eliminated this problem.
Yes. That's Scala IDE.
Update Site for Eclipse Juno and Kepler: http://download.scala-ide.org/sdk/e38/scala210/stable/site
Install with the following features:
Scala IDE for Eclipse
Scala IDE Plugins (incubation)
I use Scala IDE from http://scala-ide.org/ , then eclipsify my play2 project and import.
It works like a charm: it compiles my scala/java code.
You can get more details at this URL http://scala-ide.org/docs/tutorials/play20scalaide20/index.html
I have a Maven module, that depends on various other Maven dependencies by which I am accessing through my jython code.
I am now done, and I would like to compile the project as a .jar, or even just run it without compiling, but I have no clue where to start.
Does anyone have any idea how I can run some .py files that accesses some Java libraries in other packages?
Also, how can I compile it as a .jar file when all is done and good?
Thanks!
Compiling and integrating python
Use the jython-compile-maven-plugin. It allows you to deploy a standalone project that includes jython with libraries.
For demonstration of this plugin, see the demo project and its source code. It shows how to
launch a python console -- look at AbstractInitJython and InitJython on how to launch a python/jython console, how to execute python code snippets, and how to run a python script.
include python libraries -- the plugin also downloads and bundles python libraries (using easy_install) in the package phase, and adds them to the jar. The resulting jar can have all the libraries of the project, all pom dependencies and all the python libraries requested. The demo project shows this with the "nose" python library (see the pom file).
Testing python / jython code
The python-test-maven-plugin allows you to run your python tests alongside the normal junit tests. The demo project (look at the source at source code) shows the use of standard python unit tests (with nose) and BDD (behaviour testing) with the lettuce-clone freshen.
The sourceforge umbrella project is http://mavenjython.sourceforge.net/
Unlike maven-jython-plugin, they don't use the outdated jythonc compiler.
I am now done, and I would like to compile the project as a .jar,
It looks like there is a maven-jython-plugin allowing to compile jython source files to Java class files.
I've kinda figured out my answer to this. I shouldn't have tried to compile it, but instead wrap the python code with Java: http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html#using-jython-within-java-applications
The compiler portion of jython, jythonc, is deprecated as of 2.5 -- http://wiki.python.org/jython/ReplaceJythonc -- a replacement is in the works.