Scala Netbeans 8.1 installation configuration - scala

I was able to make some progress in getting Scala running on the Netbeans IDE. I am stuck with what looks like an error finding file sh.exe. I have found this file in my git directory but I have no idea where it should be in a Scala configuration. Here is the beginning of the error message, is this familiar to someone?
SBT -Completion: -Exit: exit -Help: help.
sbt-launch=C:\Users\William\AppData\Roaming\NetBeans\8.0\modules\ext\org.netbeans.libs.sbt\1\org-scala-sbt\sbt-launch.jar
[ERROR] Failed to construct terminal; falling back to unsupported
java.io.IOException: Cannot run program "sh": CreateProcess error=2,
The system cannot find the file specified at
java.lang.ProcessBuilder.start(ProcessBuilder.java:1042)

I had this problem with the newest version of NetBeans Plugin for Scala within Windows OS during use of the Scala SBT plugin. Cygwin should solve the problem (after instalation don't forget to set the path/to/cygwin/bin in the Windows path variable).

When I down load the small installation program and start the install I am presented with a large category of files without one being Scala. Do you know which packages need to be installed or a link to a document?
By continuing the install without adding any additional package and then adding the path as was suggested I was able to compile a scala project in the Netbeans 8.0.2 IDE.

Related

Keep Getting Error When Trying to Run Javafx on Eclipse with Mac

So I keep getting this error when trying to run my program:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found
I'm using a mac with eclipse, and my VM argument is:
--module-path /Users/myname/Desktop/javafx-sdk-11.0.2_3/lib --add-modules javafx.controls,javafx.fxml
I've tried everything, javafx.controls.jar and the other .jar file are in my lib folder. I've reinstalled the javafx program, changed my file path around hundreds of times, and I've tried to install plugins. Does anyone have any idea as too what can be happening? JavaFX is also an added library in my project, and all the .jar files assocated with it are added to it. Please let me know if anyone has an idea. Best!
I had success with the following additional step.
In the Run Configuration->Dependencies tab, click the "ModulePath" and then add the JavaFX JDK's jars (or the /lib folder that holds the jars) to the list.
You can inspect the generated command line, and check that these are included in the -p option.
IDK why this step should be needed. I would think Eclipse should be smart enough to include something on the dependency module path if it were in the project's Build Path Library list.
I have questions about this at eclipse.org and gluon. Maybe there will be an explanation, or fix so that this step isn't needed, or an edit to the documentation to let us know we need to do this.

Can't run java when trying to download Scala

I'm working with a Scala project and am trying to get IntelliJ to work with it. (If it makes a difference, I've gotten it to work before. But my machine died and had to be replaced, and this is the first time I've tried to use Scala since reinstalling IntelliJ on the new machine.) The machine is running Linux.
I've gotten the banner that says "No Scala SDK in module", and I selected "Setup Scala SDK"; Create; Download; Version 2.11.11; OK. But I get the message
Cannot run program "java" (in directory "/tmp/sbt-project"): error=2,
No such file or directory
Why is it looking in that directory (which does not exist on my machine)? It's possible there are some settings that got copied over from my previous machine. If so, where would I find and fix the setting?
How do I get past this problem?
Note: In a desperate attempt to work around the error, I created /tmp/sbt-project and symlinked the Java binaries into it. When I tried again, I got the same error except it said in directory "/tmp/sbt-project1". I tried creating /tmp/sbt-project1 as a symlink, and when I retried, it said in directory "/tmp/sbt-project2". What's going on?
In short: I have no idea why you and I both experienced this problem, but these steps remedied the situation for my particular case (no guarantees but maybe it will help you too)
Close Intellij
Likely in your home directory, backup and remove the .Idea* directory containing your personal settings
Open Intellij and at the welcome screen choose Do not import settings
Using the guided installation, ensure the "Featured" plugin, Scala, is installed
Reopen your project and when you setup the Scala SDK, miraculously a pre-existing version of Scala SDK should exist from the "Ivy" repository (I tested this on a fresh VM of Lubuntu)
After selecting the (likely outdated) Scala SDK, again go to Project Settings and under Global Libraries click the + symbol to add the latest Scala SDK.
Miraculously once again, you will see now both the SDK version from before and the latest version of Scala - choose that one and done!
Notes:
Before running those above steps, I tried the same things you did on the VM, possibly caching install versions I wasn't even aware of that later became available once I resetup Intellij.
The reason I suspect this worked is because I thought I would save myself time by copying the .Idea* directory from a different machine and using that - many paths were different! So likely I just disabled features with broken paths from my other machine
Even though I never needed to press the "Download" button, if I do I still get that same error! So I guess all this did was bypass manually downloading the SDK like you had to do...
My setup:
OS: Lubuntu-16.04.3-lts
Intellij Version:
IntelliJ IDEA 2018.1.4 (Community Edition)
Build #IC-181.5087.20, built on May 16, 2018
JRE: 1.8.0_152-release-1136-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.13.0-43-generic
echo $PATH
/home/e/tools/jdk1.8.0_121/bin:/home/e/bin:/home/e/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
I met the same problem when installing Scala by IntelliJ.
You can choose to install Scala mannually.
For example, install Scala follow this tutorial: https://www.vultr.com/docs/how-to-install-scala-on-centos-7
Then use Browse when selecting Scala SDK. Choose your directory, e.g. /usr/share/scala/
You can use Scala in IntelliJ now.

Leap Motion Java SDK, java.library.path

I'm using LeapJava.jar to write a simple JDK program to interface with the Leap. I've roughly followed this article: Developing for the Leap Motion controller in Scala and in theory it's all very simple. However, when I try to run the program it fails with a RuntimeException when it tries to connect to the Leap device:
Native code library failed to load.
java.lang.UnsatisfiedLinkError: no LeapJava in java.library.path
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
I've followed the steps in the Leap documentation but since I'm using Ubuntu (and sbt) there aren't clear instructions that relate directly to this situation. I've tried various different parameters for the java.library.path argument:
pointing at the ./lib dir in the project (which contains LeapJava.jar)
using the Leap SDK's lib directory
absolute path to the Leap SDK's lib directory
the x86 dir within the LeapSDK's lib directory
symlinking the LeapJava.jar file into the x86 directory and using that
I get the same problem running it in IntelliJ (set up as described in the Leap docs linked above) or from the command line. e.g.
sbt -Djava.library.path=.:/<path to LeapSDK>/lib run
I've added the LeapJava.jar to the classpath in sbt (it's in the lib directory) and the project compiles fine.
Any advice (particularly as I'm on Linux, which is poorly documented) would be most welcome.
Copy the .dll files in the the project(your current working directory) folder since it looks for the native libraries in that particular folder.
From the Readme in the Leap Motion Linux package:
Q. ...Sample.java compiles, but when
attempting to run, I get an error about unable to load
libLeapJava.so
A. Java seems to have trouble searching for native
libraries without some guidance. Try:
LD_LIBRARY_PATH=. java -classpath .:LeapJava.jar Sample
which looks like it assumes the jar file and native libraries are in the same folder as your application.
I got things rolling in eclipse on Ubuntu by doing the following.
1)Select your project in the Package Explorer area and press a right click on it.
2) Select Build Path → Configure Build Path... option.
3) In the appearing window, select the Libraries tab.
4) Then, expand the JRE System library option and select the Native library location.
5) Click on the Edit button at the right panel
6) click external folder.
7) navigate to your download of the sdk .../LeapSDK/lib/x64
if you are on a 32 bit system use x86
You should now be able to use LeapJava.jar without error.

sbt cannot resolve ensime-sbt-cmd in a Play2-Scala project

I'm trying to configure Sublime Text 2 to better support working with Scala and Play! 2 Framework by following instructions from http://engineering.panaxiom.co.uk/post/34631917299/sublime-text-2-with-sbt-and-play-2. (I made just one change: I updated the plugin version to 0.1.1.)
I was able to almost complete the steps given in the tutorial but the second one always fails (generate ensime config file) simply because sbt is unable to resolve ensime-sbt-cmd plugin (when I enter a project directory and execute play command). I'm not able to find the cause of the problem but sbt gives me an error like:
[error] Server access Error: connect: Address is invalid on local machine, or port is
not valid on remote machine url=http://repo1.maven.org/maven2/org/ensime/
ensime-sbt-cmd_2.9.2_012/0.1.1/ensime-sbt-cmd-0.1.1.pom
(The command output shows other urls to: scalasbt.artifactoryonline.com and repo.typesafe.com, but the maven repo url exists). After that, some warnings are displayed, again with urls of repositories.
sbt is able to resolve all other plugins or dependencies that the project has (I just finished create the project, so there are no other extra plugins or dependencies except from ensime-sbt-cmd).
I tried to change scalaVersion (on project_dir/build.sbt) but it make no difference. sbt version is 0.12, scala version is 2.9.2.
Someone knows what I can do to solve this problem? Is it possible to be something related to Java 7 on Windows 8 64 bits machine and Kaspersky Internet Security 2013? With this combination of softwares I was unable to launch Eclipse Marketplace and Netbeans plugins updates until I configured KIV exclusion rules with Java commands (java.exe, javaw.exe, javaws.exe).
Thanks and sorry because of the long text.
Make sure that your project/build.sbt file contains
sbt.version=0.12.4
According to your error message, your sbt version has been set to "012" not "0.12"

Scala plugin for netbeans

I try to run scala plugin under NetBesans 6.9.1. I install scala from arch linux repositories. Then i download netbeans-6.9.1 and scala plugin. Installed plugin. When i create scala application with hello world and try it to build i get error:
You must set SCALA_HOME or environment property and append "-J-Dscala.home=scalahomepath"
property to the end of "netbeans_default_options" in NetBeansInstallationPath/etc/netbeans.conf to point to
Scala installation directory.
How can i fix it?
I put in my netbeans.conf J-Dscala.home=/usr/bin/scala but it's not helpful. After that i get error: Could not load definitions from resource scala/tools/ant/antlib.xml. It could not be found.
Thank you.
If you don't want to mess up with the environment variables in linux while setting up scala in netbeans then:
search for "scala-library.jar"
wherever you find it, copy that location and assign "J-Dscala.home" to that
for example
"J-Dscala.home=/home/username/project/.../scala2.8.1"
that's it.
It worked out for me
try it in your case.
I do not have Arch Linux installed, but looking at scala package contents I think the proper value for SCALA_HOME is /usr/share/scala.
Isn't the error message helpful enough? Did you edit the netbeans.conf file?