Why I can't run sbt after I installed it? - sbt

I followed the instruction "brew install sbt" and tried to run it using sbt. But I got this. I don't know why. Should I do some extra steps?
java.io.IOException: Not a directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at xsbt.boot.Locks$.apply0(Locks.scala:34)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at xsbt.boot.Launch.locked(Launch.scala:238)
at xsbt.boot.Launch.app(Launch.scala:147)
at xsbt.boot.Launch.app(Launch.scala:145)
at xsbt.boot.Launch$.run(Launch.scala:102)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:18)
at xsbt.boot.Boot$.runImpl(Boot.scala:41)
at xsbt.boot.Boot$.main(Boot.scala:17)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.io.IOException: Not a directory

First off, make sure the directory you're running sbt from contains a build definition, like build.scala or build.sbt.
It looks like sbt is trying to create a file and is being denied. Try running sbt with sudo. If that works, your problem lies with the run permissions and you should use chown to fix them.

Related

sbt runmain does not find class

I have a function that I'm running with sbt runMain. I was able to get this working previously, but some changes in the project means it's no longer working, but I can't quite understand it.
When I run
sbt "runMain com.example.projects.data.CallMe" I get:
[error] (Compile / runMain) java.lang.NoSuchMethodException:
com.example.projects.data.CallMe.main([Ljava.lang.String;)
But in the SBT console, this works:
import com.example.projects.data.*
CallMe.main(List())
This succeeds. How would I be able to debug this?
Versions:
Scala 3.1.2
Sbt: 1.6.2

Error when trying to package native image with javapackager in java 9-ea?

I'm trying out java 9-ea (jdk-9+180) and the new javapackager to create a native image from a simple module but I get a nullpointer exception. Anyone know if I'm just too early or if I'm not using the right command switches in order to get it to work? The jlink command works fine but the javapackager does not. I'm using the latest jdk-9+180 at the time of writing. I have tried both with the -native exe and -native image switches but the same type of error occurs. I have also tried this on my Mac creating a native dmg with the -native dmg switch, but the same error occurs on that platform. I'm really after using the javapackager here to be able to bundle the build in exe/dmg.
Edit 1:
I have filed a bug report regarding this issue and it can now be visible at the following url: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8186661
My module-info.java:
module my.module {
requires javafx.graphics;
requires javafx.fxml;
exports sample;
}
First I'm creating a jar with javapackager which works fine:
C:\Java9Test\target>javapackager -createjar -appclass sample.Main -srcdir classes -outdir . -outfile myjar -v
I have verified the resulting jar structure looks okay with the correct compiled module-info.class and the other two classes in it.
The following jlink command works and produces a runnable reduced runtime image:
C:\Java9Test\target>jlink --output release\MyTestApp --compress=2 --module-path "myjar.jar;C:\Program Files\Java\jdk-9\jmods" --add-modules my.module
However, when trying the following command in order to create the native image using javapackager fails:
C:\Java9Test\target>javapackager -deploy -v -outdir packages -name MyTestApp -native image --module-path "myjar.jar;C:\Program Files\Java\jdk-9\jmods" --add-modules my.module --module my.module/sample.Main
outputs:
Running [C:\Program Files\Java\jdk-9\bin\java.exe, -version] Creating app bundle: MyTestApp in C:\Java9Test\target\packages Exception: java.lang.NullPointerException Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: Bundler "Windows Application Image" (windows.app) failed to produce a bundle. at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:374) at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348) at jdk.packager/com.sun.javafx.tools.packager.Main.main(Main.java:496)
Edit 2:
Output from -native exe flag (on Windows)
Running [C:\Program Files\Java\jdk-9\bin\java.exe, -version]
Running [C:\Program Files (x86)\Inno Setup 5\iscc.exe, /?]
Detected [C:\Program Files (x86)\Inno Setup 5\iscc.exe] version [5]
At least one type of shortcut is required. Enabling menu shortcut.
Exception: java.lang.NullPointerException
Config files are saved to C:\Users\Username\AppData\Local\Temp\fxbundler17330843784617821035\windows. Use them to customize package.
Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: Bundler "EXE Installer" (exe) failed to produce a bundle.
at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:374)
at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348)
at jdk.packager/com.sun.javafx.tools.packager.Main.main(Main.java:496)
Edit 3:
Output from -native dmg flag (on MacOSX)
Building DMG package for MyTestApp
Exception: java.lang.NullPointerException
Config files are saved to /var/folders/qs/nk3vxsx90q9_pbjs0ypg74r40000gn/T/fxbundler3765252041328710759/macosx. Use them to customize package.
Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: Bundler "DMG Installer" (dmg) failed to produce a bundle.
at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:374)
at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348)
at jdk.packager/com.sun.javafx.tools.packager.Main.main(Main.java:496)
Output from -native deb flag (on Linux Mint)
Running [dpkg-deb, --version]
Debian packages should specify a license. The absence of a license will cause some linux distributions to complain about the quality of the application.
Exception: java.lang.NullPointerException
Config files are saved to /tmp/fxbundler2941553392593775128/linux. Use them to customize package.
Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: Bundler "DEB Installer" (deb) failed to produce a bundle.
at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:374)
at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348)
at jdk.packager/com.sun.javafx.tools.packager.Main.main(Main.java:496)
Output from -native rpm flag (on Linux Mint)
Running [rpmbuild, --version]
At least one type of shortcut is required. Enabling menu shortcut.
Exception: java.lang.NullPointerException
Config files are saved to /tmp/fxbundler2278571164448075269/linux. Use them to customize package.
Exception in thread "main" com.sun.javafx.tools.packager.PackagerException: Error: Bundler "RPM Bundle" (rpm) failed to produce a bundle.
at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:374)
at jdk.packager/com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:348)
at jdk.packager/com.sun.javafx.tools.packager.Main.main(Main.java:496)
Answering my own question here (after having received a reply on the bug-report):
It turns out that the module-path must contain only directory names, not file names, hence you can not specify the jar in the path as you can with the jlink command. The javapackager works with the module-path if set to the compiled module-classes like below, also you don't need to put in the module-path to the jmods directory because it is picked up automatically.
C:\Java9Test\target>javapackager -deploy -v -outdir packages -name MyTestApp -native image --module-path C:\Java9Test\target\classes --module my.module/sample.Main
However, the resulting build's executable MyTestApp.exe did not work for me, nothing happened when invoked (double-clicked). Also the build is quite bulky and it seems you can not use the --compress=2 and --strip-debug flags yet as you can with jlink. However, I discovered that you can actually replace the content of the runtime folder produced with the javapackager with the output from the jlink command giving the build a much smaller footprint and the MyTestApp.exe works when invoked! I could also delete the java.exe and javaw.exe from the replaced runtime\bin folder as well as the msvcp120.dll and msvcr120.dll from the main MyTestApp-folder since those dll:s are already in the MyTestApp\runtime\bin folder.
MyTestApp-folder structure:
.

gruntjs-SBT run portXX - Scala on Intellij Windows

Can anyone help on issue below?
Not able to SBT run portXX using Scala on Windows
java.io.IOException: Cannot run program "grunt" (in directory "C:\Prashan
t\projects\project-frontend"): CreateProcess error=2, The system cannot find the file specified
Please go to Intellij file "Grunt.scala" file in Project-Build folder and you can change file name "grunt" to "grunt.cmd" and it worked for me.

When running "Grunt" in the terminal errors in local

When running grunt in my terminal I keep having the issue of the below.
Loading "Gruntfile.js" tasks...ERROR
Error: Unable to read "environments-local.yaml" file (Error code: ENOENT).
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
I have run npm install and sudo npm install with no success.
Has anyone else had the same problem? And if so how did you overcome it?
Please let me know if you need to know any more information
Many thanks
I had to set up a local environment and it works fine

I'm running into this issue when trying to grunt serve. Could anyone help me solve this issue

roys-mbp:gucci Filthy$ grunt serve
Running "serve" task
Running "clean:server" (clean) task
Running "concurrent:server" (concurrent) task
Warning: Running "sass:server" (sass) task
Warning: /Users/Filthy/Documents/gucci/app/styles/main.scss:4: error: file to import not found or unreadable: '../../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap.scss'
Use --force to continue.
Aborted due to warnings.
Execution Time (2014-05-07 07:06:54 UTC)
loading tasks 3ms ▇▇▇▇▇▇▇▇▇▇▇▇▇ 27%
sass:server 7ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 64%
Total 11ms Use --force to continue.
Aborted due to warnings.
Try running 'bower install' to install your dependencies.
I had the same problem, the path to bootstrap.scss was wrong.
Did you use the webapp generator?
Change the line 4 in main.scss from
'../../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap.scss'
to
'../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap.scss'
or to whatever the path to the bootstrap.scss may be.
I had the same problem. I was thinking npm and bower dependencies was installed, but the installation didn't end.
To fix it:
npm install
bower install
That fixed my problem.
There is a problem in your sass file, use this source
#import "bootstrap-sass-official/assets/stylesheets/_bootstrap.scss";
Open cmd promt
go to the project folder
type -> bower install and enter
it will install bower components
and show option to which version need to be installed
then the problem solved
Its working fine for me try it.....

Resources