Cannot run Scala through ProcessBuilder - eclipse

When I try to run
processBuilder = new ProcessBuilder("scala", "-classpath", CLASSPATH, CLASSNAME);
process = processBuilder.start;
process.waitFor;
within an Scala application on Eclipse Helios IDE, it yields the
java.io.IOException: Cannot run program "scala": CreateProcess error=2, The system cannot find the file specified.
I've already configured the Windows system environment variable Path and scala runs OK on Windows command line. I've also added the variable Path into Eclipse run configuration.

I suspect the problem here is that you need to pass scala.bat, not scala. To narrow down the problem, you should try running other programs, to see what you can or cannot run.

Related

How do I specify the java version to use with the Ammonite Scala shell on Windows?

I am working on an enterprise system where I can't control my system Path environment variable, and the system path points to a version of Java that is currently broken. I have another version of Java installed, and I would like to use that to run the Ammonite shell. Is this possible?
My hacky solution was to rename ammonite from amm.bat to amm-default.bat and create a new batch file called amm.bat that just adds my desired jre to the front of the session Path:
#echo off
set Path=C:\Users\bohlli\.jdks\corretto-1.8.0_292\bin;%Path%
amm_default.bat
I tried changing the path in the ammonite batch script itself, but every time I tried, something broke.

Running MALLET on Windows; could not find or load main class cc.mallet.classify.tui.Text2Vectors

I'm trying to get MALLET running on a 64-bit Windows 10 Enterprise machine from the native command prompt (cmd.exe). (I tried doing everything with Git Bash, but got stuck even earlier in the process.)
What I've done:
Installed JDK 8u281 for 64-bit Windows
Downloaded and installed MALLET 2.0.8 in my C:\
Installed Apache Ant in my C:\Program Files (per this Medium post)
Created new environmental variables
Adjusted my path
Run ant within the MALLET folder (received BUILD SUCCESSFUL)
Run ant jar within the MALLET folder (received BUILD SUCCESSFUL)
Typed bin\mallet, which displays the MALLET commands
However, when I tried to create a .mallet file, using bin\mallet import-dir, I get the error message Error: Could not find or load main class cc.mallet.classify.tui.Text2Vectors.
I (and my students) will appreciate any help in figuring out how to get this running.
This looks like a classpath issue. I'm not sure how Java on Windows handles classpath now. Try setting %MALLET_HOME% to C:\Mallet-2.0.8, not the bin directory? The classes would be in %MALLET_HOME%\class also, perhaps try adding that to %PATH% or %CLASSPATH%?

How to configure SWI-prolog with Java on Eclipse on OS X (JPL)

I am trying to get Java and Prolog to work together (on OS X 10.11.1). What I want, is just to input my Prolog Queries from Java.
When I run Java code such like
PrologProcess process = Connector.newPrologProcess();
process.queryOnce(query);
I get the following Error:
java.io.IOException: Cannot run program "swipl": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
...
First I did was adding entries to my PATH variable as I suppose that SWIProlog could not been found, but it showed no effect.
My PATH contains:
/opt/local/lib/swipl-7.2.3/
/opt/local/lib/swipl-7.2.3/bin
/opt/local/lib/swipl-7.2.3/bin/x86_64-darwin15.0.0/swipl
/opt/local/lib/swipl-7.2.3/bin/swipl.home
/Applications/SWI-Prolog.app/Contents/swipl/lib/jpl.jar
/Applications/SWI-Prolog.app/Contents/swipl/bin/x86_64- darwin15.0.0/swipl
/Applications/SWI-Prolog.app/Contents/swipl/
/Applications/SWI-Prolog.app/Contents/
Hope somebody knows whats up.
Any ideas?
Several of your PATH entries make no sense. Try on Terminal.app window:
$ which swipl
That will tell where the swipl executable is located. As it seems that you also have installed the SWI-Prolog.app GUI application, the correct path to the executable is:
/Applications/SWI-Prolog.app/Contents/MacOS/
Also note that Mac OS X GUI applications don't run on top of a shell and thus don't inherit the environment variable definitions that you use for command-line commands. But Eclipse allows in one of its preferences panel to define environment variables there.

How do I read a Linux environment variable into install4j

My application sets CLASSPATH in a shell script named shrc that sets up the environment to run java commands. Is there an easy way to pass the CLASSPATH used in an installed application to install4j so I can use it in an action? The working solution I have uses "Run executable or batch file" to run a script that does this:
. ./shrc
${APPHOME}/jre/bin/java -cp ${CLASSPATH} ...etc...
I do this within an add-on installer, so the shrc already exists, but I need to run some of the existing java code to configure the patches.
It seems to me there must be a better way to do this that would work on Windows also. Any help is appreciated.
To read environment variables, use
System.getenv("CLASSPATH")
If you would like to use it as an install4j installer variable, add a "Set a variable" action with the above line as the script.

Invoking install4j compiler from ant results in PermGen OutOfMemory errors

I've run into a situation where install4j v4.2.8 runs fine and generates installers when using the GUI and when invoking install4jc from the command line, but fails with the following message when invoked via the install4j ant task:
install4j: compilation failed. Reason: java.lang.OutOfMemoryError: PermGen space
Using visualvm, I determined that the ant task is forking a separate JVM, which appears to fail when the PermGen usage hits about 88MB. The install4j ant task docs don't say anything about being able to pass VM args (such as -XX:MaxPermSize=256MB) through to the forked JVM, but I'm wondering if that or something similar would be an option.
You can adjust the VM parameters for the command line compiler in the file [install4j installation directory]/bin/install4j.vmoptions. Just increase the -Xmx value there and add the -XX:MaxPermSize VM parameter.
Prior to install4j 5.0.7, there was a bug related to includes of relative files in .vmoptions files. For these older versions, remove the include to install4j.vmoptions in install4jc.vmoptions and add the VM parameters directly there.