https://github.com/miho/vugshell
API for accessing precompiled UGShell distribution (https://github.com/UG4/ugcore) for VRL plugins and Java projects
https://github.com/miho/vugshell
Last synced: 9 months ago
JSON representation
API for accessing precompiled UGShell distribution (https://github.com/UG4/ugcore) for VRL plugins and Java projects
- Host: GitHub
- URL: https://github.com/miho/vugshell
- Owner: miho
- License: other
- Created: 2016-12-23T21:44:37.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-01-28T19:45:06.000Z (almost 7 years ago)
- Last Synced: 2025-02-15T21:20:00.502Z (11 months ago)
- Language: Java
- Homepage:
- Size: 196 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VUGShell
[  ](https://bintray.com/miho/UG/VUGShell/_latestVersion) [](https://www.javadoc.io/doc/eu.mihosoft.ugshell.vugshell/vugshell)
API for accessing precompiled UGShell/[ug4](https://github.com/UG4/ugcore) distribution via [VRL](http://vrl-studio.mihosoft.eu/) plugins and Java projects. Binary distributions of [ug4](https://github.com/UG4/ugcore) are consumed as [ugshell-dist](https://github.com/miho/ugshell-dist). See the [sample](https://github.com/miho/VUGShell-Sample) on how to declare native dependencies.
## Usage:
To execute lua code, the following method can be used:
```java
// execute code with working directory "exampleDir"
Shell.execute(exampleDir, "print(\"Hello from Java!\")");
```
To execute a specified ug *.lua script, use:
```java
// execute laplace.lua with working directory "exampleDir"
Shell.execute(exampleDir, new File(exampleDir,"laplace.lua"));
```
To print the output to given print streams, use the `print(...)` method:
```java
// execute laplace.lua with working directory "exampleDir"
Shell.execute(exampleDir, new File(exampleDir,"laplace.lua")).print(System.out,System.err);
```
To wait until the execution has finished, use the `waitFor()` method:
```java
// execute laplace.lua with working directory "exampleDir"
Shell.execute(exampleDir, new File(exampleDir,"laplace.lua")).waitFor();
```
The exit value can be accessed via:
```java
// execute laplace.lua with working directory "exampleDir"
Shell.execute(exampleDir, new File(exampleDir,"laplace.lua")).getProcess().exitValue();
```
To destroy the current process, the `destroy()`method can be used:
```java
// execute laplace.lua with working directory "exampleDir"
Shell.execute(exampleDir, new File(exampleDir,"laplace.lua")).destroy();
```
## How to Build VUGShell
### Requirements
- Java >= 1.8
- Internet connection (dependencies are downloaded automatically)
- IDE: [Gradle](http://www.gradle.org/) Plugin (not necessary for command line usage)
### IDE
Open the `VUGShell` [Gradle](http://www.gradle.org/) project in your favourite IDE (tested with NetBeans 8.2) and build it
by calling the `assemble` task.
### Command Line
Navigate to the [Gradle](http://www.gradle.org/) project (e.g., `path/to/VUGShell`) and enter the following command
#### Bash (Linux/OS X/Cygwin/other Unix-like shell)
sh gradlew assemble
#### Windows (CMD)
gradlew assemble