Comments (4)
@pritip123 thanks for asking. Until now I've always been compiling my simple Java application with javac
directly. Let me play a little with mvn
, I'll let you know when it works on OSv.
BTW, if you can, it would help if you could share your maven application with us so that we can play with it directly. If this is not possible, then no problem, we will create our own small application.
from capstan-packages.
Thanks a lot @gasper-vrhovsek and @miha-plesko . I was not adding jvm_args as jar file and so its always looking for the main class instead of jar file .Its working fine now.
from capstan-packages.
@pritip123 did you perhaps package the jar with dependencies? Check if your maven build configuration looks something like this:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.example.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
from capstan-packages.
Hello @pritip123, we've been playing with following Java application that makes use of some external dependencies:
package org.xlab;
import org.apache.commons.io.output.StringBuilderWriter;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
StringBuilderWriter sbw = new StringBuilderWriter();
sbw.append("Hello");
sbw.append(" ");
sbw.append("world");
System.out.println(sbw.toString());
}
}
We then used Maven to build a fat jar by using the snippet that @gasper-vrhovsek kindly provided in the comment above. The result was a target/osv_sample-1.0-SNAPSHOT-jar-with-dependencies.jar
file that we've copied into a new directory with following structure:
demo/
├── meta/
│ ├── package.yaml
│ └── run.yaml
└── osv_sample-1.0-SNAPSHOT-jar-with-dependencies.jar
The content of the two meta files was as follows:
# meta/package.yaml
name: demo
title: Maven Demo
author: me
# meta/run.yaml
runtime: java
config_set:
hello:
jvm_args:
- "-jar"
main: /osv_sample-1.0-SNAPSHOT-jar-with-dependencies.jar
classpath:
- /
config_set_default: hello
Then I cd
into the demo/
directory and execute:
$ cd demo
$ capstan package compose demo --pull-missing
$ capstan run demo --boot hello
Command line will be set based on --boot parameter
Created instance: demo
Setting cmdline: runscript /run/hello
OSv v0.24-434-gf4d1dfb
eth0: 192.168.122.15
java.so: Starting JVM app using: io/osv/nonisolated/RunNonIsolatedJvmApp
java.so: Setting Java system classloader to NonIsolatingOsvSystemClassLoader
Hello world
Most probably you were using the incorrect parameters inside meta/run.yaml
since we haven't documented how one is to run .jar
files yet. I will update README on Capstan to make this clear, thanks for noticing!
from capstan-packages.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capstan-packages.