OpenJDK for JamVM - jamvm

I got system with installed jamvm onboard. Output of jamvm -version command :
java version "1.5.0"
JamVM version 2.0.0
Copyright (C) 2003-2014 Robert Lougher <rob#jamvm.org.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2,
or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Build information:
Execution Engine: direct-threaded interpreter with stack-caching
Compiled with: gcc 4.8.5
Boot Library Path: /usr/lib/classpath
Boot Class Path: /usr/share/jamvm/classes.zip:/usr/share/classpath/glibj.zip
Unfortunately I can't run code below:
package m;
import java.nio.file.Path;
import java.nio.file.Paths;
public class main1 {
public static void main(String[] args)
{
Path path = Paths.get("c:\\data\\myfile.txt");
System.out.println("*** start ***");
}
}
Command:
jamvm -cp . m.main1
Error:
Exception in thread "main" java.lang.NoClassDefFoundError: java/nio/file/Paths
at m.main1.main(main1.java:10)
Caused by: java.lang.ClassNotFoundException: java.nio.file.Paths not found in java.lang.ClassLoader$1{urls=[file:/opt/aaa/./], parent=null}
at java.net.URLClassLoader.findClass(URLClassLoader.java:531)
at java.lang.ClassLoader.loadClass(ClassLoader.java:341)
at java.lang.ClassLoader$1.loadClass(ClassLoader.java:1112)
at java.lang.ClassLoader.loadClass(ClassLoader.java:293)
at m.main1.main(main1.java:10)
Class java.nio.file.Path was created in java 1.7
I learn I can somehow compile OpenJDK class path. I hope it might help, but how to do that? How to setup jamvm to use OpenJDK class path?

Related

Error creating Groovy class with latest release of IntelliJ Idea

I am using the latest version of the Community Edition of IntelliJ Idea ( 2021.2 ) with the Groovy plugin ( 212.4746.92 ) on a Windows 10 box.
I created a very simple Groovy class:
class HWClass {
static void main(String[] args) {
// Using a simple println statement to print output to the console
println('Hello World');
}
}
When I try and run the Groovy class I get :
java.util.concurrent.ExecutionException: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
I have verified my project setup many times ...I have my Platform Settings SDK set to OpenJDK 12 and my Global Libraries references my Groovy 3.0.8 installation. Note that this is a new release of IntelliJ Idea I am using ( 2021.2 ) ...I am aware of a known bug in this release of IntelliJ ( https://youtrack.jetbrains.com/issue/IDEA-275043 ) with Groovy Scripts but am unaware of any issues with Groovy classes... any thoughts ?

Why do I have to restart Intellij for it to recognize Lombok annotations?

I am using intellij & Lombok & I have annotation processor set to enabled.
IntelliJ IDEA 2020.2 (Community Edition)
Build #IC-202.6397.94, built on July 27, 2020
Runtime version: 11.0.7+10-b944.20 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux XXXX
GC: ParNew, ConcurrentMarkSweep
Memory: XXXXM
Cores: XX
Non-Bundled Plugins: color.scheme.Gruvbox, Lombook Plugin, org.intellij.scala
Current Desktop: KDE
And using Lobmok: 0.30-EAP
When I create a class like so:
#Builder
#Getter
public class Stub {
private final int f1;
private final long f2;
}
Or if I add a field to an existing class Intellij Complains that: Variable 'f1' might not have been initialized.
If I restart Intellij the error goes away.
Build/Recompiling the class doesn't help
Maven reload proejct doesn't help
Build/Build the project doesn't help
IntelliJ IDEA 2020.2 has a known issue affecting Lombok plug-in. It's fixed in 2020.2.1 release. Please update.

Gradle build doing nothing on WSL

I'm writing a Kotlin program, and using Gradle as the build system, as is customary in that language. I usually work on Windows, but it's time to start testing on Linux, so using WSL for that. Installed Gradle, cloned a copy of my code in WSL...
(base) a#DESKTOP-4B7M920:~/ayane$ gradle -version
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/share/java/groovy-all.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
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
------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------
Build time: 2012-12-21 00:00:00 UTC
Revision: none
Groovy: 2.4.16
Ant: Apache Ant(TM) version 1.10.5 compiled on March 28 2019
JVM: 11.0.7 (Ubuntu 11.0.7+10-post-Ubuntu-2ubuntu218.04)
So far so good, that warning happens sometimes, doesn't seem to portend immediate trouble.
This is my build file, that works on Windows:
(base) a#DESKTOP-4B7M920:~/ayane$ cat build.gradle.kts
plugins {
kotlin("jvm") version "1.3.72"
}
repositories {
jcenter()
}
dependencies {
implementation(kotlin("stdlib"))
testImplementation("org.junit.jupiter:junit-jupiter:5.6.2")
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
Here goes.
(base) a#DESKTOP-4B7M920:~/ayane$ gradle build
> Task :buildEnvironment
------------------------------------------------------------
Root project
------------------------------------------------------------
classpath
No dependencies
BUILD SUCCESSFUL in 0s
1 actionable task: 1 executed
<-------------> 0% WAITING
Uh? I could understand if it threw an error because some prerequisite or other was unavailable. But no error, just nothing? What's going on?
You are using the newest version at this time of the Kotlin plugin for Gradle (1.3.72). However, you are using a really old version of Gradle (4.4.1). As you can read from the Kotlin documentation:
The Kotlin Gradle plugin 1.3.72 works with Gradle 4.9 and later.
It is unfortunate that the plugin doesn't check for this and give a more proper error message instead of just silently doing nothing. I guess you could create an issue for Jetbrains on this if you like.
Just as has been mentioned in the comment to your question, I also highly recommend using the wrapper. It ensures that the project is built with a particular declared version of Gradle that you, the build author, has decided on. Otherwise, you will have to document how to set up the environment correctly, including what version of Gradle to install.
Same thing goes for Java: be sure to clearly document which version is required or supported.
As for building in WSL, the only issue I've ever had with it was a remote build cache not working. This was because I had configured Git to checkout with POSIX line endings (LF) for source files, whereas the cache were populated on a Windows machine using CRLF line endings). It doesn't sound like you are using that feature, but other than that, everything has been working fine for me in WSL.

Pass tags via build.gradle instead thro RunCukesSpec

When I pass tags in the following manner it works perfectly.
package features
import org.junit.runner.RunWith
import cucumber.junit.Cucumber
import geb.junit4.GebReportingTest
#RunWith(Cucumber.class)
#Cucumber.Options(format = ["pretty", "html:build/cucumber", "json-pretty:build/cucumber-report.json"])
,tags = ["#login_neg"])
class RunCukesSpec extends GebReportingTest {}
But my goal is to config same thing via build.gradle & if it succeeds then pass through command line. I tried below as the initial step and hope that by running gradle test in command line to get the expected results.
test {
testLogging.showStandardStreams = true
args = ['--tags', '#login_neg',
'--format', 'html:build/cucumber',
'--format', 'json-pretty:build/cucumber-report.json',
'--format', 'pretty']
}
In this case all the tags are running though.
Tried this as well. But no luck
gradle test -DCucumber.Options="--tags #login_neg"
versions:
------------------------------------------------------------
Gradle 1.9
------------------------------------------------------------
Build time: 2013-11-19 08:20:02 UTC
Build number: none
Revision: 7970ec3503b4f5767ee1c1c69f8b4186c4763e3d
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy: 2.2.0
JVM: 1.7.0_45 (Oracle Corporation 24.45-b08)
OS: Windows 7 6.1 amd64
You can pass options as System properties by updating your build.gradle file with:
test {
systemProperty "cucumber.options", System.properties.getProperty("cucumber.options")
}
This configuration will pass the cucumber.options System property from the Gradle JVM to the JVM running the tests.
You can then run gradle test -Dcucumber.options="--help" to see the available options for that System property (replace --help with your options).

How to determine the revision from which current Mono runtime was built and installed?

I want to determine the revision (how to call properly it in Git?) from which current Mono runtime was built and installed.
$ dmcs --version
Mono C# compiler version 2.9.0.0
but it's definitely insufficient.
XSP/ASP.NET error page gives more information:
Version information: Mono Runtime Version: 2.8.1 (master/cdf1247 Sat Sep 4 01:22:04 MSD 2010); ASP.NET Version: 4.0.30319.1
but it seems to be a dirty hack to me.
How to do it properly?
If you're looking for the mono runtime version; there is an internal Mono.Runtime class in mscorlib, it has a static method GetDisplayName which should return a string with current runtime version. This method is private but still can be accessed via reflection. I wrote a small script to test this, check if would work for you:
Type type = Type.GetType("Mono.Runtime");
if (type != null)
{
MethodInfo dispalayName = type.GetMethod("GetDisplayName", BindingFlags.NonPublic | BindingFlags.Static);
if (dispalayName != null)
Console.WriteLine(dispalayName.Invoke(null, null));
}
on my system this returns:
2.6.7 (Debian 2.6.7-3ubuntu1~dhx1)
hope this helps, regards
mono -V will output the version string, including source code revision.