error: could not find or load main class Hello.class - compilation

Trying simplest kotlin hello world possible:
thufir#dur:~/kotlin$
thufir#dur:~/kotlin$ ll
total 32
drwxr-xr-x 2 thufir thufir 4096 Oct 27 07:28 ./
drwx------ 46 thufir thufir 16384 Oct 27 06:47 ../
-rw-r--r-- 1 thufir thufir 104 Oct 27 07:27 Hello.kt
thufir#dur:~/kotlin$
thufir#dur:~/kotlin$ kotlinc Hello.kt
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.text.StringFactory to constructor java.lang.String(char[],boolean)
WARNING: Please consider reporting this to the maintainers of com.intellij.util.text.StringFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
thufir#dur:~/kotlin$
thufir#dur:~/kotlin$ kotlin Hello.class
error: could not find or load main class Hello.class
thufir#dur:~/kotlin$
thufir#dur:~/kotlin$ cat Hello.kt
class Hello {
fun main(args: Array<String>) {
println("Hello, world!" + args[0])
}
}
thufir#dur:~/kotlin$
thufir#dur:~/kotlin$ kotlinc -version
info: kotlinc-jvm 1.1.51 (JRE 9.0.0.15+181)
thufir#dur:~/kotlin$
How do I run that from the CLI?
desired output:
thufir#dur:~/kotlin$
thufir#dur:~/kotlin$ kotlinc
Welcome to Kotlin version 1.1.51 (JRE 9.0.0.15+181)
Type :help for help, :quit for quit
>>>
>>> println("hello world");
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.text.StringFactory to constructor java.lang.String(char[],boolean)
WARNING: Please consider reporting this to the maintainers of com.intellij.util.text.StringFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
hello world
>>>
>>> :quit
thufir#dur:~/kotlin$

First of all, that Hello may not work as you expect, because it's main function is not static. In Kotlin, you don't need a class to define a main method. Just use functions:
fun main(args: Array<String>) {
println("Hello, world!" + args[0])
}
Then, after compiling, you should not call it like kotlin <File>.class, but just kotlin <File>, the .class suffix is redundant:
$ ./compiler/kotlinc/bin/kotlin HelloKt test
Hello, world!test

Related

Liquibase can not find file containing H2 bin

When trying to generate a liquibase diff I get the following:
Starting Liquibase at 00:18:57 (version 4.1.1 #10 built at 2020-10-12 19:24+0000)
Unexpected error running Liquibase: '/usr/local/apps/h2/h2-1.3.176.jar' does not exist
For more information, please use the --logLevel flag
[2022-10-02 00:18:57] SEVERE [liquibase.integration] Unexpected error running Liquibase: '/usr/local/apps/h2/h2-1.3.176.jar' does not exist
liquibase.exception.CommandLineParsingException: '/usr/local/apps/h2/h2-1.3.176.jar' does not exist
at liquibase.integration.commandline.Main.configureClassLoader(Main.java:1278)
at liquibase.integration.commandline.Main$1.run(Main.java:360)
at liquibase.integration.commandline.Main$1.run(Main.java:193)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:145)
at liquibase.integration.commandline.Main.run(Main.java:193)
at liquibase.integration.commandline.Main.main(Main.java:156)
The problem is, the java binary does exist at in that directory.
(base) user#userpad:/usr/local/apps/h2$ ls -la
total 1632
drwxr-xr-x 2 root root 4096 okt 2 00:12 .
drwxr-xr-x 3 root root 4096 okt 2 00:12 ..
-rw-rw-r-- 1 user user 1659879 okt 2 00:07 h2-1.3.176.jar
(base) user#userpad:/usr/local/apps/h2$ pwd
/usr/local/apps/h2
(base) user#userpad:/usr/local/apps/h2$
Any help would be appreciated.

(rauc:350): rauc-WARNING **: 07:50:14.624: Failed getting primary slot: Failed getting primary slot: fw_printenv failed with exit code: 234

I am using yocto to build my image, am trying to integrate RAUC(system update solution). RAUC now is installed in my image but it's not working correctly.
rauc status gives :
(rauc:350): rauc-WARNING **: 07:50:14.624: Failed getting primary slot: Failed getting primary slot: fw_printenv failed with exit code: 234
=== System Info ===
Compatible: tx6q-1036
Variant:
Booted from: (null) (/dev/mmcblk3p2)
=== Bootloader ===
Activated: (null) ((null))
=== Slot States ===
o [rootfs.1] (/dev/mmcblk0p3, ext4, inactive)
bootname: B
boot status: bad
o [rootfs.0] (/dev/mmcblk0p2, ext4, inactive)
bootname: A
boot status: bad
systemctl status rauc gives :
rauc.service - Rauc Update Service
Loaded: loaded (/lib/systemd/system/rauc.service; static)
Active: active (running) since Tue 2021-03-23 07:49:41 UTC; 8min ago
Docs: https://rauc.readthedocs.io
Main PID: 292 (rauc)
Memory: 1.4M
CGroup: /system.slice/rauc.service
`-292 /usr/bin/rauc --mount=/run/rauc service
Mar 23 07:49:41 AMR83FA51 rauc[292]: mounting slot /dev/mmcblk0p2
Mar 23 07:49:41 AMR83FA51 rauc[292]: Failed to mount slot /dev/mmcblk0p2: Slot >
Mar 23 07:49:41 AMR83FA51 rauc[292]: Failed to resolve realpath for '/dev/mmcbl>
Mar 23 07:49:41 AMR83FA51 rauc[292]: Failed to resolve realpath for '/dev/mmcbl>
Mar 23 07:49:41 AMR83FA51 rauc[292]: rauc mark: Failed to determine slot states>
Mar 23 07:50:14 AMR83FA51 rauc[353]: Configuration file wrong or corrupted
Mar 23 07:50:14 AMR83FA51 rauc[292]: Failed getting primary slot: Failed gettin>
Mar 23 07:50:14 AMR83FA51 rauc[292]: Failed to resolve realpath for '/dev/mmcbl>
Mar 23 07:50:14 AMR83FA51 rauc[292]: Failed to resolve realpath for '/dev/mmcbl>
Mar 23 07:50:14 AMR83FA51 rauc[355]: Configuration file wrong or corrupted
The /etc/fw_env.config content is : /boot/uboot.env 0x0000 0x20000
I'm a beginner with u_boot and I don't know much about u-boot environment, could someone help to better understand this step and how to fix it.

Spark - How to colourise terminal output from spark-submit

When I run spark-submit it works successfully, but the output is not colourised.
(/Users/me/bai/conda-envs/spark-mllib-kmeans) me#my-mbp spark-mllib-kmeans % spark-submit spark-helloWorld.py
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.spark.unsafe.Platform (file:/usr/local/Cellar/apache-spark/3.0.1/libexec/jars/spark-unsafe_2.12-3.0.1.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of org.apache.spark.unsafe.Platform
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
20/12/22 12:18:33 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
20/12/22 12:18:34 INFO SparkContext: Running Spark version 3.0.1
20/12/22 12:18:34 INFO ResourceUtils: ==============================================================
20/12/22 12:18:34 INFO ResourceUtils: Resources for spark.driver:
20/12/22 12:18:34 INFO ResourceUtils: ==============================================================
20/12/22 12:18:34 INFO SparkContext: Submitted application: Simple App
...
I am using Spark version 3.0.1:
(base) me#my-mbp spark-mllib-kmeans % spark-shell --version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.spark.unsafe.Platform (file:/usr/local/Cellar/apache-spark/3.0.1/libexec/jars/spark-unsafe_2.12-3.0.1.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of org.apache.spark.unsafe.Platform
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 3.0.1
/_/
Using Scala version 2.12.10, OpenJDK 64-Bit Server VM, 14.0.1
Branch HEAD
Compiled by user ubuntu on 2020-08-28T08:58:35Z
Revision 2b147c4cd50da32fe2b4167f97c8142102a0510d
Url https://gitbox.apache.org/repos/asf/spark.git
Type --help for more information.
I am using the default Mac terminal program on latest Mac OS:
% uname -a
Darwin my-mbp.lan 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64
I would like to see the different log statement levels (WARN/INFO/ERROR) in different colours. Perhaps other use of colours to differentiate the output from spark framework and the output from my application.
Given there is so much framework level output and there is noise of WARNINGS due to framework issues, I was hoping better use of colour could help me to scan my output quicker.
Is there a simple solution for this?
I see this behaviour in both native Mac Terminal and MS VSC integrated terminal.
I saw the output line:
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
I see I can create then edit the log4j config file here, so perhaps I just need the config for the log4j config file to colourise all output.
% cd $SPARK_HOME/conf
% cp log4j.properties.template log4j.properties
I got the same warning but it works properly without errors.

Why would this clojurescript build profile work locally but not on Heroku?

Here is the prod configuration used locally and in the uberjar for Heroku deployment:
{:source-paths ["src/cljs"]
:compiler {:output-to "resources/public/js/main.js"
:optimizations :advanced
:cache-analysis true
:static-fns true
:elide-asserts true
:pretty-print false
:externs ["jquery/jquery-externs.js" "public/vendor/js/bootstrap.min.js"]
:preamble ["jquery/jquery-2.1.1.min.js"
"public/vendor/js/bootstrap.min.js"
"reagent/react.js"]}}
But with the externs directive enabled for Heroku deployment, I get this error:
Jan 14, 2015 12:24:24 PM com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: ERROR - Duplicate extern input: /tmp/build_a17563dbd2ef7be695204764be886d91/resources/jquery/jquery-externs.js
Jan 14, 2015 12:24:24 PM com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: ERROR - Duplicate extern input: /tmp/build_a17563dbd2ef7be695204764be886d91/resources/public/vendor/js/bootstrap.min.js
Jan 14, 2015 12:24:24 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 2 error(s), 0 warning(s)
ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: /tmp/build_a17563dbd2ef7be695204764be886d91/resources/jquery/jquery-externs.js at (unknown source) line (unknown line) : (unknown column)
ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: /tmp/build_a17563dbd2ef7be695204764be886d91/resources/public/vendor/js/bootstrap.min.js at (unknown source) line (unknown line) : (unknown column)
Successfully compiled "resources/public/js/main.js" in 38.526 seconds.
Any suggestions?
I don't believe this is an issue in lein 2.5.1. In any case, try :externs ^:replace ["jquery/jquery-externs.js" "public/vendor/js/bootstrap.min.js"] to mitigate.
I had a similar error, the problem was solved by adding some :exclusions.
In my case, I was using React with Addons and Reagent (which depends on React), hence the collision.
Wrong:
:dependencies [[cljsjs/react-with-addons "0.13.3-0"]
[reagent "0.5.0"]
Right:
:dependencies [[cljsjs/react-with-addons "0.13.3-0"]
[reagent "0.5.0" :exclusions [cljsjs/react]]

Subclipse not recognizing my JavaHL

I keep getting the following error:
Failed to load JavaHL Library.
These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
no svnjavahl-1 in java.library.path
no svnjavahl in java.library.path
java.library.path = "/usr/lib/x86_64-linux-gnu/jni"
Although the library path is correct:
user#localhost /usr/lib/x86_64-linux-gnu/jni $ ls -l
total 336
lrwxrwxrwx 1 root root 24 Apr 6 02:06 libatk-wrapper.so -> libatk-wrapper.so.0.0.18
lrwxrwxrwx 1 root root 24 Apr 6 02:06 libatk-wrapper.so.0 -> libatk-wrapper.so.0.0.18
-rw-r--r-- 1 root root 85168 Sep 20 2012 libatk-wrapper.so.0.0.18
lrwxrwxrwx 1 root root 23 Sep 28 2012 libsvnjavahl-1.so -> libsvnjavahl-1.so.0.0.0
lrwxrwxrwx 1 root root 23 Sep 28 2012 libsvnjavahl-1.so.0 -> libsvnjavahl-1.so.0.0.0
-rw-r--r-- 1 root root 256104 Sep 28 2012 libsvnjavahl-1.so.0.0.0
The above was installed with apt-get install libsvn-java on ubuntu 12.10. Basically this package here.
The installed version of svn is 1.7.5.
The installed version of subclipse is 1.8.19.
I understand that the required svn version for subclipse 1.8.x to work is 1.7.x.
How can I make subclipse recognize my installed JavaHL library?
Okay I have found it...
The problem was in my eclipse.ini file, which looked like this:
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20120913-144807
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-Xms40m
-Xmx512m
-vmargs
-Djava.library.path="/usr/lib/x86_64-linux-gnu/jni"
I had to remove the extra quotes: -Djava.library.path="/usr/lib/x86_64-linux-gnu/jni" to -Djava.library.path=/usr/lib/x86_64-linux-gnu/jni.
That fixed it.

Resources