How do you use external Scala compiler with IDEA 12? - scala

How do you use external Scala compiler with IDEA ? I seem to have randomly appearing errors saying "scala: Cannot connect to compile server at localhost/127.0.0.1:3200"
Sometimes it works. Sometimes it doesn't. I can't find the pattern.
Here is what I have in the log
9:20:58 PM Auto make completed with errors
9:21:09 PM Using a new (SBT-based) Scala compiler.
In case of any compilation problems you may enable the previous (internal) compiler by clearing:
Project Settings / Compiler / Use external build
9:21:10 PM Scala compile server
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
9:21:12 PM Compilation completed with 1 error and 0 warnings in 3 sec
I'm using
IDEA 12.1 (129.161)
Scala compiler 2.10.1
Scala plugin 0.7.213
JDK 1.7
Windows 7
In Project Settings / Compiler / Use external build is checked.
In IDE Settings / Scala / Run compile server is checked.
Do I need to launch compiler server manually ? Anything else ?
UPD: Looks like bug to me. I posted JIRA ticket http://youtrack.jetbrains.com/issue/SCL-5523

You need to lower the heap size from 1024 to 512 or something. Then the compile server can be created and started.
Tried with the InteliJ 13.0.2 (133.331) and Scala plugin 0.26.361

Go to Settings -> Compiler and uncheck "Use external build"

It normally works without having to change any settings. This sounds like either a port conflict, a result of a previous unclean shutdown, or insufficient heap size.
Try changing the compile server port by going to Settings -> Scala (under IDE settings list, towards the bottom) -> TCP port. Over there, you can also set a different max heap size.
The issue may be related to this open ticket.

The bug I filed is marked as Fixed. JetBrains explanation is
"Fixed" means that compilation now works by default, so the major problem (as the title states) is resolved.
However, an automatic initial compile server startup before auto-make is still cannot be easily implemented. That is why auto-make is still turned off by default for Scala projects. And, of course, we're going to support auto-make after all.

I had the same issue with IntelliJ , if you open the event log (on the bottom right corner of IDE)you can see the error message that scala compiler is not configured with the jdk version and gives a link to set it up.
In Settings > Languages and Frameworks > Scala Compile Server > JVM SDK set the java you are using for the IDE as in this screenshot

you can try this simple project I wrote, which uses the sbt-idea plugin. It should work out of the box with latest Intellij IDEA or Scala IDE (EClipse)
skeleton

Reducing Heap Size to 512 or 128 MB worked for me

Related

Cannot disable CompactStrings Java 9 using Netbeans

I am trying to disable the CompactStrings feature of Java 9 using the VM option: -XX:-CompactStrings, but it does not work.
When I tried to debug my application, the COMPACT_STRINGS variable in String class is always true (with or without the VM option)
I have the latest version of Java 9: jdk-9+181
And the Netbeans IDE Build 201709070001
I tried various options to set the VM option and none of them works.
What I tried is:
setting the VM option in app.conf, setting it in project.properties, running netbeans by ./netbeans -XX:-CompactStrings, setting the JVM option in Project->Properties->Run->VM Options
Is this a bug in Netbeans? Or am I doing something wrong?
I tried to reproduce your problem using a trivial "Hello World" Java application. However, toggling the CompactStrings feature in the project properties settings worked fine for me, and caused COMPACT_STRINGS to be set appropriately, so this is not a bug in NetBeans.
Although I am using the same version of Java (181) as you, I have a more recent Dev Build of NetBeans (Build 201709220002), and there are several discrepancies between my project properties screen and yours. For example, mine shows the Runtime Platform field but yours does not:
Something else to check is that you really do have the environment you expect. I find it easy to mess things up when multiple versions of Java and Netbeans are installed.
This is what I see when I do Help -> About:
If your environment looks fine then I can only suggest that you download the latest DEV Build of NetBeans and try again.

IntelliJ and Eclipse gives different result

For some reason my project gives the below error in eclipse:
No error in IntelliJ. Any ideas?
Using IntelliJ:
IntelliJ IDEA 2016.2.5
Build #IC-162.2228.15, built on October 14, 2016
JRE: 1.8.0_112-release-287-b2 x86
JVM: OpenJDK Server VM by JetBrains s.r.o
The reason behind different results is that Different IDEs use different inspection tools.
In your particular question Eclipse shows an error, while Intellij shows a warning. So anyhow both are suggesting that something has gone wrong here.
Besides it's a warning or an error, the point both are making is Not to use key duplication in json. The reason is when you refers the value via the key then key duplication causes problems.
Since JSON is just a markup language and creates no problems for project build, Intellij would just make a warning and not an error. Since key duplication does make no sense though, Eclipse would mark up as an error. Anyway not to worry about whether warning or error, just catch the point they are making. :))

REDHAWK IDE 1.9 runs out of memory and has to be shutdown

I am using REDHAWK 1.9. While doing the development of C++ component, the IDE gives the following popup errors. This happens on a regular basis. If developing a C++ component it happens multiple times a day.
'Update Monitor' has encountered a problem. An internal error occurred during: Update Monitor.
Another popup gives the following:
An out of memory error has occurred. Consult the 'Running the Eclipse' section of the readme file for information on preventing this kind of error in the future. You are recommended to exit the workbench. Subsequent errors may happen and may terminate the workbench without warning.
It looks like this may be related to Eclipse Bug #400073
Particularly, see Comment #25:
Boost libraries are used within REDHAWK components and devices, and the R1.9.0 IDE uses CDT version 8.1.2
That thread also lists a couple work arounds including:
"A workaround for me was decreasing the indexers absolute cache limits from 64MB to 32MB, though I don't know if this will work in general. You may find the settings at Window -> Preferences -> C/C++ -> Indexer" from Comment #23
You could also try adjusting additional preferences within the indexer page, "Index source files not included in the build" and "Index unused headers" could be unchecked. This can be done on a workspace level or a per project level.
As a last resort, you could try a new workspace or disabling the indexer entirely.

Eclipse #ifdef error using JNI, Android NDK and Vuforia

With Vuforia's ImageTargets sample application, I tried using OpenGL ES 1.1 by setting USE_OPENGL_ES_1_1 to true in jni/Android.mk and uncommenting and changing the corresponding line in AndroidManifest.xml (). After converting the project so that it has a C++ perspective and associating ndk-build and the proper include directories, I could successfully run the application on my Android device.
However, the problem is that once I open up jni/ImageTargets.cpp, I get several errors from Eclipse, all from places where OpenGL ES 2.0 code would execute, the first one being:
Description Resource Path Location Type Symbol 'vertexHandle' could
not be resolved ImageTargets.cpp /ImageTargets/jni line 402 Semantic
Error
Sure enough, vertexHandle is defined at the top of the ImageTargets.cpp, inside the "#ifdef USE_OPENGL_ES_2_0" block. Because USE_OPENGL_ES_2_0 is not defined (per Android.mk), the code should be able to compile successfully, and sure enough, ndk-build does not report any problems. So it seems that only Eclipse reports the problems and when I run the project, Eclipse says, "Your project contains error(s), please fix them before running your application." And thus, I cannot run my application anymore. In a sense, it's kind of strange that this never occurred until I opened ImageTargets.cpp and Eclipse "discovered" the errors.
The best work-around I've found so far is to just delete or comment out those lines (that should not be causing problems because USE_OPENGL_ES_2_0 is not supposed to be defined)... Is there a better way to deal with this problem? Did I miss a setting in Eclipse that should solve this?
I've found a solution: go to the project properties -> C/C++ Build -> Discovery Options -> Check "Automate discovery of paths and symbols"

GWT compiler is running out of memory. How do I configure it within IntelliJ?

I'm running GWT from within IntelliJ. (Plain GWT, IntelliJ v9). I'm able to run my application via my "GWT development mode" configuration, but when I try to run it through my "local tomcat" configuration, I get a bunch of incomprehensible error messages referring to Oracle and all sorts of weird stuff that I don't use, followed by this error which is sorted to the bottom of all the others:
Error: Out of memory; to increase the amount of memory, use the -Xmx flag at startup (java -Xmx128M ...)
I'm guessing that this error is the root cause.
According to my understanding, there is a GWT compilation step which runs in a JVM separate to both IntelliJ and tomcat, and so I'm unsure where to set the -Xmx parameter.
My question is: where do I find this -Xmx parameter? (And: am I on the right track, taking this error message at face value, or is it a symptom of deeper problems?)
You can configure the heap in the GWT facet settings:
As CrazyCoder just said you can increase the amount of memory for gwt compiler in the GWT Facet settings. The GWT Compiler running out of memory on bigger apps is very common if you don`t increase the amount of memory. Most projects should be fine with 512m, but on large projects I already needed more memory.
So this is not some out of memory error caused by some bad design on your behalf.
In my application, I set it to 1024 but it gives me out of memory after 7-9 page refresh on dev mode. And after that I tried it to optimize by doing performance hack, I separated my *.gwt.xml for every gwt module for specific browsers by setting:
MySampleModule_FF.gwt.xml
<set-property name="user.agent" value="gecko1_8"/>
And I run my dev mode with this gwt.xml for Firefox. In addition to it also separated internationalization as well.
After that my out of memory issues considerably decreased.
32 bit JDK also sometimes causes Out Of Memory error. Try using 64 bit JDK.
To those who get the same error under Eclipse, try to restore cache files (if they were removed accidentally in WAR folder ), this way I solve the same problem under my Eclipse project.