What are the exact versions of stuff you have to install in order to be able to step-debug a Scala program? - eclipse

How do YOU debug a Scala program?
I mean YOU as in the person posting the Answer :) Please answer only from personal experience, not from stuff you've heard or read on the Internet. You should not believe everything you read on the Internet, especially tales of complex open-source software configurations that actually work :-)
The are many Java tools which claim to support Scala in some way or another, but I have so far struck out in trying to get any one of them to actually let me set a breakpoint in Scala code and step through it. These are big, major open-source IDEs I'm talking about here.
The main problem in getting a debugger to work seems to be the "version hell" with fast-changing IDEs, Plug-Ins, JDKs, and the Scala language itself.
Hence, the more detailed re-statement of the question is appropriate: What is the exact version number of the IDE, Plug-In, JDK, Scala, and even Operating System, that you are successfully using?
My question is related to this one, but wider in scope:
How To: debug Scala code when outside of an IDE
Thanks

In our development we use IntelliJ IDEA 9.0.1 which is available by the link below:
http://www.jetbrains.com/idea/download/
with Scala plugin installed:
http://confluence.jetbrains.net/display/SCA/Getting+Started+with+IntelliJ+IDEA+Scala+Plugin
All you need is to have project with Scala sources (probably, mixed with Java or other JVM-based languages) opened. You can compile it and run as Java application, maven goal etc. or connect to the remote application if it has been run in debug mode.
See IntelliJ help for details of adjusting debug configuration.
Cheers!
Ilya

I've worked with Eclipse and the Scala plugin for it. It works somewhat ok, if you can overlook the fact that it doesn't remember the configuration for your Scala application on the next run.

I debug my Scala programs by running relevant parts of it on the REPL, as to verify what it is really doing. Other than that, the good old println or logs.
Digressing here a bit, it has been a rare thing in my life a situation where step-in debuggers were actually required -- and, then, mostly for assembler code, though languages where testing snippets of code is difficult for some reason were more likely to require it than others which weren't.

OS: xUbuntu(GNU/Linux) 9.10
JDK:
java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)
(which is the Java-6-sun-version, used by the xUbuntu-installer).
Eclipse: 3.5.1 Build id: 20090920-1017
Scala-Plugin 2.7.7final
Scala 2.7.7
If possible: println-Statements, because eclipse is often tricky to invoke (does not find the main class, even after complete rebuild, closing/opening project, deleting old class-Files). The latest search for a problem ended when I 'deleted all bookmarks' - suddenly I was allowed to run the program.
Curious observation: class Bruch was what I tried to run, but eclipse allways mentioned 'Bruc' and named the runtime-configuration like this. Adding and removing characters reflected in the generated name accordingly (Bruc => Bru).

Related

TieredCompilation is disabled in this release - running Leiningen in Counterclockwise

I'm running Leiningen in Counterclockwise in Eclipse (Windows, if it's relevant).
The thing is, when I run Leiningen from the command prompt, it runs just fine. However when I run it inside Eclipse, although it runs fine it haunts me with the following warning:
Java HotSpot(TM) Client VM warning: TieredCompilation is disabled in this release.
The only relevant thing I found on the Internet is this. However the solution doesn't work for me as I don't have this line in lein.bat file. I've tried fiddling with Java options in lein.bat to enable TieredCompilation explicitly with no avail. I'm trying to understand - what's different when Eclipse runs lein, compared to when I run it from the prompt, how does it run it? How do I hide this message?
EDIT: this warning seems to appear only in 32-bit JVM; for anyone having the same problem, using 64-bit JVM solves it. For anyone that as to use 32-bit JVM for whatever reason, I'm still looking for a good solution.
(converted from comment as I have to add additional info)
CCW uses its own version of Leiningen - for example, when I execute lein version from inside CCW I get 2.5.1, but if I drop to the command line and execute the same command I get 2.7.1. In my install (Neon + CCW - couldn't make the standalone CCW install work) there's a leiningen-standalone.jar in C:\eclipse\plugins\ccw.core_0.35.1.STABLE001. There may be a way to get Counterclockwise to use a separate version of Leiningen - perhaps more knowledgeable users will chime in with how to do this.
Also note that in the Windows install of Leiningen the LEIN_JVM_OPTS environment variable isn't defined at all in lein.bat, although it is used when invoking Java. Thus it seems you have two options:
Less-preferred option: edit lein.bat and add the definition of LEIN_JVM_OPTS, probably somewhere near the beginning of the file. This has the disadvantage that when you upgrade Leiningen you'll lose your definition of LEIN_JVM_OPTS and have to find this message again.
More-preferred option: since this is Windows you can go into Control Panel, type "environ" in the search box, then click on on the "Edit environment variables for your account" link which comes up under System (or click on "Edit the system environment variables" if you like). Create a new entry for LEIN_JVM_OPTS, specifying something like
-XX:-TieredCompilation
and you should be good to go. While I don't know for certain if this environment variable is used by the standalone .jar version of Leiningen I'd certainly hope and expect it would be.
Best of luck.

Installation of EclipseFP on Eclipse Luna (Mac OS X Yosemite)

I'm trying to get EclipseFP (Haskell support, but the original coder stopped maintaining it last month) working on my iMac but everything seems to fail constantly. I've been debugging this for hours now and like most other Haskell stuff there isn't much decent support out there regarding the installation of such tools. I haven't even written a single line of Haskell code yet (apart from some playing around in GHC/GHCI which surprisingly did work)!
I've tried so many things already, different libraries, different solutions, different versions etc. But it seems that everything that has to do with haskell support is just one big clutter of confusion for me and nothing seems to point me in an apparent direction which bothers me since I am an experienced programmer and dealing with command line interfaces, tools and dependencies isn't unknown to me on all sort of platforms for years now.
Even the most relevant topics on StackOverflow or other knowledgebases just won't cut it regarding this topic and I'm starting to feel like dropping the entire Haskell language and just use something which does play nice with the system without such troubles since it is already such a pain in the ass to get the most basic development tools to work, let alone the coding itself...
The things I got:
Mac OSX Yosmite
GHC
GHCI
Cabal (repository)
Eclipse Luna
I've installed EclipseFP using the install instructions which worked out all great. At this point I thought it would just all work without any problems as the plugin installs just fine...
Well, that was not the case of course. I've restarted Eclipse as it requested after installing new plugins. Here is where the trouble begun..
In the following steps I would have to open the Haskell Perspective in Eclipse. Well... guess what.. there was none! After strolling the web I found out that it might have compatibility issues with the old JDK 1.6 which was installed by default on MacOSX. No worries.. I've downloaded Java JDK 1.8, set it up in Eclipse, restarted it. And there the item "Haskell perpective" showed up in the list.
After clicking that, and thinking my troubles were over (and I could finally start coding!) nothing happend! I've searched around for a while and found the Eclipse error console which until this day gives me nothing more than:
An error occurred while automatically activating bundle net.sf.eclipsefp.haskell.ui (459).
org.eclipse.e4.core.di.InjectionException: java.lang.RuntimeException: org.eclipse.core.runtime.CoreException: Plug-in net.sf.eclipsefp.haskell.ui was unable to load class net.sf.eclipsefp.haskell.ui.HaskellPerspective.
Of course I have tried solving this issue and came across some dependencies which needed to be installed using cabal (BuildWrapper, Scion-Browser and some other essentials). After doing so I still have the same problem and I have no idea where to look for. The only information I can really find are topics which are more than 3/4 years old which share 0 relevance to my exact problem.
I could paste the Java stacktrace here as well which came with the error message, but it doesn't show much useful information anyway other than just basic crashing.
I hope someone can help me because I would really like to start coding now for a change instead of wasting hours on getting my basic development framework/IDE set up.
Long story short; I'd like to code some Haskell in Eclipse but the development tools just won't install and/or work properly without any notable errors or directions to look for.

Installing JDK on OSX Lion for Scala

I just signed up for the Coursera class on Scala and one of the requirements is Java Virtual Machine JDK 1.6 or higher.
I'm actually a PHP/Py/Ruby developer and haven't touched Java in 10 years.
What do I actually need to install on my Mac (10.7.5 Lion)?
javac -version gives me 1.6.0_15
is this all I need other than the Scala install, or do I need to download specific developer tools? I plan on developing Scala with SublimeText2, there's an sbt plugin for it now.
Scala is a popular enough of a language for there to be plenty of information on how to get started from scratch. For example, googling for "scala installation" gave me (amongst other stuff) http://www.tutorialspoint.com/scala/scala_environment_setup.htm —they talk about JVM versions, how to install Scala, etc; i.e. all you need. If that page won't do, I'm sure you'll find many more.
If you are doing the coursera course, you can check out the first chapter, it explains how to install scala with a comprehensive step-by-step video.
It is in the first chapter Getting started --> Tools setup for Mac OS X.
If your course hasn't started yet, you can look up it in the archive (previous sessions of the course).
Otherwise, one way to install Scala is :
Download Scala on http://scala-lang.org/download/
Extract it in your favorite folder, let's call it ~/installations/scala-X.Y.Z
Open the file ~/.bashrc (~/.zshrc if you are using zsh...)
Write :
export SCALA_HOME=~/installations/scala-X.Y.Z/
export PATH=$PATH:$SCALA_HOME/bin
Type in your terminal : source ~/.bashrc
There you go, you can now access scala by typing scala in your terminal

Attaching GDB to Eclipse to debug JNI C++ code

I'm having problems debugging a JNI application. I've read several threads in StackOverflow, like this one, this one or this one. I've also tried to start gdb in a separated shell and attach it to the running java process. In both cases, the problem is the same: GDB can't find the sources to debug. Things tried
Add "dir" line to gdbinit, pointing to C++ sources folder
Adding the C++ sources folder to the GDB debbuging configuration in Eclipse, in the "Sources" tab.
Adding set environment LD_LIBRARY_PATH=/path/to/library.so, being library.so the library file built from C++ source files
Attach ddd to the java process, but then I get an error because pthread_join.c is not found in the working directory. I don't have this file in my hard disk. I don't know what is this about.
Nothing worked. I've spent several days on this. I know my bug is in the C++ code called by the JNI wrapper, but I can't debug it. Any hints? If helps, I'm running Eclipse Juno in Debian 7 under a Parallels VM on Mac OS.
Many thanks in advance,
You need to have debug information in your native library. You should pass -g to your compiler and linker to have this information in the executable. You may also want to add -O0.
As an alternative to attaching to the Java process, you can create a C++ app and debug it directly. You just need to link in the functions you want to test. In the main function, create the VM, register the functions with RegisterNatives, and kick off a Java test class the uses them.
Hopefully, the debugger has no problem finding the sources since it is just part of the normal compile/link/debug loop of a C++ app.
I would suggest to start with the latest ADT bundle. You can even download the Mac version, so you will not even need Parallels (see a detailed instructions). Then, choose Debug Android Native Application in launch menu.

Launching an arbitrary executable over a file on Netbeans

We want to add command-line support to Netbeans, as in being able to run any program (using the full path of the current file as the argument) directly from the IDE. The same way you can do it already on Notepad++ with the Run tool.
Apparently there is a plugin called VCS Generic Command-Line Support that offers this functionality, but when we try to install it we get this error message:
Some plugins require Master Filesystem to be installed
The plugin Master Filesystem is
requested in version >= 1.1 but only
2.15.2 was found.
Any ideas?
EDIT
I Did some googling as you got me interested pretty much everything i found was in refernce to NetBeans 5.x or below... Im thinking maybe its not compatible with 6 - but thats just a guess.
Looks like a version incompatability with "Master Filesystem". Maybe they are checking the version improperly or perhaps they really mean it needs to be 1.x >= 1.1. Do you have the newest version of VCS Plugin?
As an aside if Im going to have to chek this out... ive been dying for external tool support like in my beloved Eclipse :-)