Run jython with a jar dependency - jar

I installed jython 2.5.3 and I am trying to execute my script, which has a dependency with jsch.jar, using the command line. Then I tried something like this:
c:\myScriptLocation\> c:\jython2.5.3\jython.bat script.py
But it returns:
ImportError: No module named jcraft
If I execute the jython script with Eclipse, it works, because I can add the dependency in the System PYTHONPATH of the Jython Interpreter. But I cannot use eclipse to execute the script, I have to do it with the command line.
I tried to copy the jar file to the lib path of the jre jython is using, but doesn't work.
Any idea of the command I have to use?

You can just do ...
c:\myScriptLocation\> c:\jython2.5.3\jython.bat -Dpython.path=\myJarLocation\jsch.jar script.py

Related

install jar file in dbfs and mvn packages using init script

I have few Jar files/packages in the DBFS and I want an init script (so that I can place that in the automated cluster) to install the Jar package everytime the cluster starts.
I also want to install maven packages from maven using an init script.
I can do all of these using databricks UI. But the requirement is to install libraries using an init script.
To install jar files, just put files onto DBFS, in some location, and in the init script do:
cp /dbfs/<some-location>/*.jar /databricks/jars/
Installation of the maven dependencies is more tricky, because you also will need to fetch dependencies. But it's doable - from the init script:
Download and unpack Maven
Execute:
mvn dependency:get -Dartifact=<maven_coordinates>
move downloaded jars:
find ~/.m2/repository/ -name \*.jar -print0|xargs -0 mv -t /databricks/jars/
(optional) remove not necessary directory:
rm -rf ~/.m2/
P.S. But really, I recommend to automate such stuff via Databricks Terraform Provider.

How to create the corda.jar?

When I build the corda project locally, I find a corda-4.1-corda.jar. Is that basically the same as the corda.jar file produced when node directories are generated by the cordformation plugin? Can I replace the latter by the former, after renaming it, in a deployment?
Once your dependencies are set correctly, you can build your CorDapp JAR(s) using the Gradle jar task
Unix/Mac OSX: ./gradlew jar
Windows: gradlew.bat jar
Run ./gradlew clean build -x test from the root directory. Once the process finishes, the jar is produced in the corda/node/capsule/build/libs/ directory as corda-<version>.jar.

Compiling nginx using CLion (via CMake)

I'm trying to compile nginx 1.9.5 via CLion for debugging purposes.
Because CLion doesn't currently support vanilla Makefiles/Autoconf I ran the autoconf auto/configure script to generate a valid Makefile, opened the project in CLion, then made a very simple CMakeLists.txt to delegate the CLion build to the autoconf generated Makefile (as advised by Using local makefile for CLion instead of CMake).
Unfortunately, my simple CMakeLists.txt seems to have a flaw, as when I reload and run CLion's build command, CMake seems to generate yet a new Makefile and run this empty Make task instead of running the one in ${nginx_SOURCE_DIR}.
How can I change the CMakeLists.txt file below to delegate to the nginx Makefile instead of regenerating a new one?
cmake_minimum_required(VERSION 2.8.4)
project(nginx)
add_custom_target(nginx ALL COMMAND make -C ${nginx_SOURCE_DIR} CLION_EXE_DIR=${PROJECT_BINARY_DIR})

packaging jruby gems in self contained jar

I'm trying to package compass/sass into a self-contained jar so that I can use compass without installing jruby.
I installed jruby and warbler on a Windows7 machine, running Java 1.6.0_37
I created a folder, named it jrcompass, then installed compass into it, i.e.
jruby -S gem install compass -i .
then I ran in it:
jruby -S warble
which created a file named jrcompass.jar of about ~20MB in size. so far so good.
problem is that when I try to execute the jar I get an error message (below). it seemed from the error that jruby.home was not set, so I passed it as a property in the command line and that worked, but it defeats the purpose of having a self-contained jar.
if I try to pass . as jruby.home then I get an error that it can't find rubygems
any help would be appreciated. TIA.
C:\Apps\test\jrcompass>java -jar jrcompass.jar
Gem::LoadError: Could not find compass (>= 0) amongst [rake-0.9.2.2]
to_specs at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb:247
to_spec at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/dependency.rb:256
gem at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems.rb:1231
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/jrcompass/bin/compass:22
load at org/jruby/RubyKernel.java:1046
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/META-INF/main.rb:1
require at org/jruby/RubyKernel.java:1027
(root) at file:/C:/Apps/test/jrcompass/jrcompass.jar!/META-INF/main.rb:1
(root) at jar:file:/C:/Users/Admin/AppData/Local/Temp/jruby9093955264697226808extract/jruby-stdlib-1.7.1.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/custom_require.rb:1

cannot seem to run my jar file in command promtp

I have created a project within NetBeans with includes a form and a class that serves as a database connection layer. When i try to run this project through the IDE everything launches just fine. The problem occurs when i try to launch the jar file created by the ide on the commmand prompt terminal. nothing happens? it just moves to the next line. i have a manifest file with a class path and main class specified and it looks like so
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Created-By: 1.6.0_22-b04 (Sun Microsystems Inc.)
Class-Path: lib/mysql-connector-java-5.1.13-bin.jar lib/mylib.jar
X-COMMENT: Main-Class will be added automatically by build
Main-Class: eopprototype.EOPPrototype
when i look at what the compiler says is says To run this application from the command line without Ant, try:
java -jar "/h/USERS/local/pagola/NetBeansProjects/EOPPrototype/dist/EOPPrototype.jar"
when i try to type that command it just goes to the second line without anything happening. Not evena ny errors. I am supposed to distribute this jar file to a shared folder and have it run but i cant do it and i dont know whats wrong. I have NOT added any JAVA_HOME path as my jdk 1,6 is isntalled in usr/bin so it should find it there but i have NOT added any classpath (ide shows two runtime and bootable classpaths) somebody please assist me as i am new to the whole java virtual machine environment
I guess you meant the standard outputs, or other things you printed to the command prompt from your java program. To get that printed on the command propmt, you need to run java in debug mode.
Use
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar myJar.jar
to run java in debug mode and get all standard outputs, exceptions etc. on the command prompt.

Resources