Running deeplearning4j intellij program from command line interface - intellij-idea

i want to run my deeplearning4j program that i created as IntelliJ project from server with command line input and i don't have any clue how to do it, any suggestion?

In our examples you'll see the maven-shade-plugin:
https://github.com/deeplearning4j/dl4j-examples/blob/master/dl4j-examples/pom.xml
Use this as a base.
That creates an uber jar already. Just use java -cp on the uber jar and you're set.

Related

"NoClassDefFoundError" when the jar file built by Intellij Idea artifacts was executed in command line

I have a problem with running my jar execution file built by Intellij Idea Artifacts in command line. Error message is
NoClassDefFoundError: io.mattmoore.kotlin.playground.cinterop.Greeter
But it worked when I use the IDE to execute "RUN".
Do you have any Idea why is that happening?
Highly appreciated if someone could give me a hint about how to fix it.
Harrison
IDE knows better where to find dependencies, but once you export .jar file, you need to manually ensure that no dependency is missing
(and that all get loaded).
Example:
To run MyProgram.jar, place all your dependencies inside of libs directory (which you need to create beside it), then use command like:
java -cp 'MyProgram.jar:libs/*' my_package.MyMainClass
OR for Windows (use semicolon)
java -cp 'MyProgram.jar;libs/*' my_package.MyMainClass
Note that dependency means other .jar files, for example, the one that defines io.mattmoore.kotlin.playground.cinterop.Greeter class.
See also How to call ".jar” with additional classpath option?

JavaFX application fail to launch with native exe bundle created with intellij ide

I have build a JavaFX application which can be executed by its jar file. However if i try to run it using the native exe bundle i am receiving two popups:
Error Invoking method
Failed to launch JVM
and the application fails to start.
The Javafx application is build with intellij ide.
The project structure looks as follows;
when launching the application following popup shows..
The config file looks as follows:-
The packaged jar file is executing properly...
the problem occurs when starting application with launching exe file.
kindly tell me what could went wrong?
UPDATE:
It seems that the build output runtime/bin directory does not contain java.exe file therefore i think the application does not launches.
the output when try to run the application is as follows:
i have build the application with intellij idea, i think there is a problem with that. Kindly look into this matter.
UPDATED:-
Run it from the command line using the runtime that was bundled for you:
If you made an executable Jar (with a proper manifest specifying the classpath and main class)
cd firecap
runtime\bin\java -jar app\libs\your-main.jar
If you don't have an executable jar use something like
cd firecap
runtime\bin\java -cp app\libs\*.* your.main.class.name
Since java.exe is a console program you should be able to see the full error output to get a better idea of what is going wrong.
You very likely have missed including a needed module in the runtime.
It is also possible you ran into a bug that I discovered recently: https://bugs.openjdk.java.net/browse/JDK-8254920
I created my runtime image with this command:
"C:\Program Files\BellSoft\LibericaJDK-15-Full\bin\jlink.exe" --no-header-files --no-man-page, --compress=1 --add-modules java.management,java.logging,javafx.controls,java.xml,java.desktop --output C:\MyProject\build\image\runtime
But yours may be different depending on what modules you need. Note also that I used a JDK from BellSoft that included the JavaFX modules to make it easier.

[karate][standalone] how to add sikulixapi.jar to classpath by default using karate-config.js?

Karate version: 0.9.5.RC3
IDE : Visual Studio Code 1.38.1
OS: Windows 10 Ent
I have downloaded the zip and was running Native Automation example with SikuliX using the karate standalone jar.
Now to execute the tests I need to use below command
java -cp karate.jar;sikulixapi.jar com.intuit.karate.Main %*
Instead of this, I want to use the karate-config.js file to specify the classpath in which sikulixapi.jar plus some other jar is already present.
Also, one should be able to run tests directly using the below command.
java -jar karate.jar calc.feature
or using the Karate Runner plugin in Visual Studio Code.
BTW a great thanks to the creators of KarateDSL
Unfortunately that is not possible. Setting the classpath is such a fundamental operation that it has to be done when the JVM is started. The recommended approach is you edit a batch file to do this, see this answer for details: https://stackoverflow.com/a/58398958/143475
There are some hacks you can try such as this one: https://stackoverflow.com/a/252967/143475

Getting error Could not find or load main class org.testng.TestNG

I'm trying to run TestNG from command line, but it's giving me error.
Can someone tell me where am I going wrong?
java -cp C:/TestNG directory/testng-6.2.jar;C:\project directory\src\com\suites\suite\shop org.testng.TestNG testng.xml
Error: Could not find or load main class org.testng.TestNG
My scripts runs fine when I ran them from eclipse testng plugin.
Copy the below commands in a text file.
Edit the location.
Save it as yourtext.bat
Now, double click on the batch file created.
cd C:\Workspace\projectname
java -cp C:\Workspace\projectname\lib*;C:\Workspace\projectname\bin org.testng.TestNG testng.xml
Path of TestNG.jar file was not set up.
Follow instructions of following site to set up. It worked for me:
http://qtp-automate.blogspot.com/2011/10/running-selenium-testng-test-from.html
Try above answers.
If still not work, then you might have downloaded the wrong version of testng.jar. From link testng.org, please click "here for ant users" to download a full testng.jar(11 mega bytes), not a "Maven Central" version(no more than 100k).
I have tested those two versions on centos following testng tutorial point
Possibly your testng.jar file is not in the lib folder that C:\Workspace\projectname\lib.
You should find testng.jar first in your computer and move it manually to C:\Workspace\projectname\lib. Then it will work
Check that the lib folder contains testng-6.8.jar(or any other version) file because testng.xml even executes successfully without testng-6.8.jar (or any other version) with the jars that gets added when we add TestNG library.
My Assumptions:
You are trying to run test file from command prompt
libs folder generated under Project/tagret upon using "mvn clean package -DskipTests"
class file generated under Project/target/test-classes/package-name
With above assumptions in mind, you can follow below process.
Setting class path in command prompt:
1. Open project location in command prompt
2. set classpath=C:\User\SeleniumTestProject\target\test-classes;C:\User\SeleniumTestProject\target\libs\*
3. java org.testng.TestNG C:\User\SeleniumTestProject\testng.xml

Can you run jar files in Pentaho spoon tool?

I want to run a jar file that has java code, inside the Pentaho spoon tool. This run is a single step by accepting an input, running the java class on top of this data and then providing the output somewhere. Is this possible with Pentaho Spoon?
This is very easy. Just pop the jar file into the lib directory with the other jars, and call it from the modified javascript step. ( Or maybe even the java class step if thats more suitable for what you're trying to do )
I've done this several times - most recently for some custom decoding which had to be done in java, and couldnt be done in the java step because janino didnt support it.
A different approach:
leave the jar in your project directly, no copying necessary
create a simple bash script "run.sh" in your project folder with
"java -jar yourjar.jar" in it. you can also add that line directly
within spoon and skip this step
to your job, add a "execute shell script" and point to run.sh
done, the result code of the script determines success or not
why this way? I hate the way the api is documented, no code completion in spoon, Java or Javascript, this way you can write your code outside and rely on working systems