SEVERE: class not found error with cmd - agents-jade

I am using Intellij Idea to run a jade program. I have the ".jar" files in the environment variable "classpath". When I run the program from the IDE it works fine and finds the classes defined by me. But when I run the program from CMD it says
class not found.
The java files are in package name "msg". I am giving the following command:
java jade.Boot -gui f1:msg.first

You should specify -classpath attribute for java (and ofc you should compile your java files before).
For example:
java -classpath jade-4.4.0.jar jade.Boot -gui f1:msg.first

Related

After building a Kotlin program in IntelliJ, how do I execute it directly from the terminal? [duplicate]

I have installed IntelliJ IDEA on my mac and wrote the simplest Kotlin program
fun main(args : Array<String>){
println("Hello")
}
I can run it from the IDE environment. (It prints Hello of course)
My question: How can you run this from the console?
What I have done:
I tried to call
java simplekt.class
but I got
Error: could not find or load main class simplekt.class
I tried java simplekt but then I got an exception in thread main java.lang.NoClassDefFoundError
I tried to use kotlin or kotlinc but the command was not found. (where is the compiler installed?)
In this resource they use kotlinc and they produce a jar file but IDEA only output a class file.
Not really sure how to proceed from here.
When you run your application from the IDE, in the Run window the very first line is the command that the IDE executes to start your program. In my case it's something like:
/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 <a lot more omitted>
You can execute the same command in your terminal and that will execute the application. Reading that line will also (indirectly) tell you where the kotlinc command is installed, and in my case – using MacOS – it's at /Applications/IntelliJ\ IDEA.app/Contents/plugins/Kotlin/kotlinc/bin/kotlinc
However, you can always decide to entirely stop using the IDE and compile/run your program from the command line by following instructions here: https://kotlinlang.org/docs/tutorials/command-line.html
The above answer by #user2340612 is mostly right, but maybe due to software changing or some differences in what i did, it did not work for me. Following did:
to avoid repetition, i'll be using the short name: $(ideac) = "IntelliJ IDEA Community Edition 2022.2" in place of the full name
the path to the kotlinc is this one: $(ideac)\plugins\Kotlin\kotlinc\bin
much similar to the one told above, but slightly different
i have verified it to work in the command given in the command-line doc linked above or compiler-reference too: kotlinc hello.kt -include-runtime -d hello.jar
running the resultant .jar file via java -jar ./hello.jar shows the expected output
there's no kotlin-native in that folder, so, couldn't verify this native-command-line-compiler kotlin doc
Backstory/What did not work
the command under the run tab in $(ideac) no longer shows the kotlinc path
I had created the Kotlin "project" by using "new project" (intelliJ) or by "Kotlin multiplatform > JVM" (gradle)
The run command for either of these did not contain any kotlinc in them
I tried creating a new > "scratch" file; and it showed this: $(ideac)\plugins\Kotlin\bin\windows\LLDBFrontend.exe but i tried using that on CLI and it did not work either

Unable to use read('classpath:') when running tests with standalone karate.jar

I am attempting to execute my tests using the karate stand-alone jar. Throughout my project, I use the read('classpath:') when locating files.
However, when I attempt to execute my tests from the CLI, I receive the following error:
src.test.java.Users.getUser: -unknown-:6 - javascript evaluation failed: read('classpath:commonUtils.feature'), java.io.FileNotFoundException: commonUtils.feature (The system cannot find the file specified)
Command: java -jar -Dkarate.config.dir="src/test/java" karate.jar -e DEV -t #tests src/test
It seems that I will have to declare the classpath on execution, would you be able to provide some insight on how to do this please? I'm not sure whether my issue is linked to [karate][standalone] Error : could not find or read file
Can you try the ZIP release and if you open the karate batch file you will see this:
java -cp karate.jar:. com.intuit.karate.Main $*
So the trick to setting a custom classpath is to use the com.intuit.karate.Main entry point and in the above example the current dir is also added to the classpath.
It would be great if you try the current RC version (0.9.5.RC3) to ensure we have everything working as expected.
For more information, see this part of the docs: https://github.com/intuit/karate/tree/develop/karate-netty#custom-classpath

Running a simple hello world from the console after installing IntelliJ IDEA

I have installed IntelliJ IDEA on my mac and wrote the simplest Kotlin program
fun main(args : Array<String>){
println("Hello")
}
I can run it from the IDE environment. (It prints Hello of course)
My question: How can you run this from the console?
What I have done:
I tried to call
java simplekt.class
but I got
Error: could not find or load main class simplekt.class
I tried java simplekt but then I got an exception in thread main java.lang.NoClassDefFoundError
I tried to use kotlin or kotlinc but the command was not found. (where is the compiler installed?)
In this resource they use kotlinc and they produce a jar file but IDEA only output a class file.
Not really sure how to proceed from here.
When you run your application from the IDE, in the Run window the very first line is the command that the IDE executes to start your program. In my case it's something like:
/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 <a lot more omitted>
You can execute the same command in your terminal and that will execute the application. Reading that line will also (indirectly) tell you where the kotlinc command is installed, and in my case – using MacOS – it's at /Applications/IntelliJ\ IDEA.app/Contents/plugins/Kotlin/kotlinc/bin/kotlinc
However, you can always decide to entirely stop using the IDE and compile/run your program from the command line by following instructions here: https://kotlinlang.org/docs/tutorials/command-line.html
The above answer by #user2340612 is mostly right, but maybe due to software changing or some differences in what i did, it did not work for me. Following did:
to avoid repetition, i'll be using the short name: $(ideac) = "IntelliJ IDEA Community Edition 2022.2" in place of the full name
the path to the kotlinc is this one: $(ideac)\plugins\Kotlin\kotlinc\bin
much similar to the one told above, but slightly different
i have verified it to work in the command given in the command-line doc linked above or compiler-reference too: kotlinc hello.kt -include-runtime -d hello.jar
running the resultant .jar file via java -jar ./hello.jar shows the expected output
there's no kotlin-native in that folder, so, couldn't verify this native-command-line-compiler kotlin doc
Backstory/What did not work
the command under the run tab in $(ideac) no longer shows the kotlinc path
I had created the Kotlin "project" by using "new project" (intelliJ) or by "Kotlin multiplatform > JVM" (gradle)
The run command for either of these did not contain any kotlinc in them
I tried creating a new > "scratch" file; and it showed this: $(ideac)\plugins\Kotlin\bin\windows\LLDBFrontend.exe but i tried using that on CLI and it did not work either

JavaFX: No window is showing after using javapackager

So I have created a JavaFX8 project in IntelliJ and everything worked fine in there. I ran it with the same arguments outside IntelliJ, everything worked too. However, when I use javapackager to create an executable with the same arguments and run the created executable, no window is showing. Does anyone know why it is? Thanks a lot!
The following are the commands I used ([very-long-list-of-class-paths] are the same in all three commands):
Running in IntelliJ:
"C:\Program Files\Java\jdk1.8.0_40\bin\java" -Didea.launcher.port=7540
"-Didea.launcher.bin.path=F:\IntelliJ IDEA 14.1\bin"
-Dfile.encoding=GBK -classpath [very-long-list-of-class-paths] com.intellij.rt.execution.application.AppMain danIDE.Main
Running in cmd:
java -classpath [very-long-list-of-class-paths] danIDE.Main
Using javapackager:
javapackager -makeall -v -classpath [very-long-list-of-class-paths] -appclass danIDE.Main -name DanIDE

How can I use Lucene in cmd

I am trying to use lucene on the Windows' command line as given in this link.
I have created the CLASSPATH variable for all four mentioned .jar files, but after that, when I run the command:
java org.apache.lucene.demo.IndexFiles -docs C:/lucene/src
it returns the following error:
could not find or load main class org.apache.lucene.demo.IndexFiles
I dont know what's wrong with it... Can anybody help me out?
I am a student and just a beginner.
Thanks
I ran into a similar issue, you need to include the CLASSPATHs in your command (if its not in environment vars). So it should be:
java -classpath C:\lucene\lucene-5.1.0\core\lucene-core-5.1.0.jar;C:\lucene\lucene-5.1.0\queryparser\lucene-queryparser-5.1.0.jar;C:\lucene\lucene-5.1.0\analysis\common\lucene-analyzers-common-5.1.0.jar;C:\lucene\lucene-5.1.0\demo\lucene-demo-5.1.0.jar org.apache.lucene.demo.IndexFiles -docs C:\lucene\lucene-5.1.0
And to search, you'd do:
java -classpath C:\lucene\lucene-5.1.0\core\lucene-core-5.1.0.jar;C:\lucene\lucene-5.1.0\queryparser\lucene-queryparser-5.1.0.jar;C:\lucene\lucene-5.1.0\analysis\common\lucene-analyzers-common-5.1.0.jar;C:\lucene\lucene-5.1.0\demo\lucene-demo-5.1.0.jar org.apache.lucene.demo.SearchFiles
It would be nice if Lucene would have a start scripts packaged to play araonud with ... I've created an indexfiles.cmd in my installation root directory with this content:
java -classpath core\lucene-core-7.4.0.jar;queryparser\lucene-queryparser-7.4.0.jar;analysis\common\lucene-analyzers-common-7.4.0.jar;demo\lucene-demo-7.4.0.jar org.apache.lucene.demo.IndexFiles %*
and another one called searchfiles.cmd:
java -classpath core\lucene-core-7.4.0.jar;queryparser\lucene-queryparser-7.4.0.jar;analysis\common\lucene-analyzers-common-7.4.0.jar;demo\lucene-demo-7.4.0.jar org.apache.lucene.demo.SearchFiles %*