GraalVM

GraalVM Quarkus Locale in native mode

假如想象 提交于 2020-05-16 05:53:06
问题 I have an unexpected behavior with available locales when native build. I have only one locale available in native mode. My application is very simple : @ApplicationPath("/api") public class ApplicationPathConfiguration extends Application { } @Path("/locales") public class LocaleController { @GET @Produces(MediaType.APPLICATION_JSON) public Locale[] get() { return Locale.getAvailableLocales(); } } After checkout if I launch the application in dev mode : mvn quarkus:dev You can call the

五年过去了,再看 Java 缺失的特性

假如想象 提交于 2020-04-23 07:22:36
本文要点: 在过去的五年中,Java 语言发生了显著的变化 正在实现这一变化的有两个主要的项目:Valhalla 和 Amber,它们仍在进行中 Java 继续保持其向后兼容的核心价值 尽管已经 25 岁了,但 Java 在语言和平台上仍然具有很强的生命力 诸如 Graal 之类的新技术正在帮助 Java 继续保持在编程语言的前沿上 大约是五年前,我写了一篇 文章 ,概述了其他语言的一些特性思想,我认为这些思想可能会对 Java 有好处。从那以后发生了很多事情:那时,Java 8 是最新的发布版本,而现在,最新的版本是 Java 14。 让我们依次查看下每个特性,看看它的当前状态是什么:它是已经被添加到 Java 中了,还是正在开发中,亦或是当前尚没有将其纳入 Java 的计划。 具体化泛型 我最初的预测排除了具体化泛型(reified generics)。我没有预见到 Valhalla 项目对从头开始重构 JVM 的雄心壮志。 Valhalla 项目的主要目标是: 使 JVM 内存布局行为与现代硬件的成本模型保持一致; 扩展泛型,以允许对所有类型(包括原语、值、甚至 void)进行抽象;以及 使现有的库(尤其是 JDK)能够兼容地演变,以充分利用这些特性。 在此描述中隐藏的是已加载的单词“values”,它已经演变成我们今天称之为内联类的特性。 因此

Quarkus框架入门之一:Quarkus框架介绍及简单示例

元气小坏坏 提交于 2020-03-13 00:34:54
开篇 最近几年,Spring全家桶横扫其它Java框架,已然成为事实标准,单体应用使用Spring Framework+Spring Boot,服务治理Spring Cloud,生态完善,各种组件层出不穷。曾经还玩过JFinal和Nutz等国内的开发框架,但是仅仅是私下玩玩,实际工作过程中,还是Spring的天下,很少会选择其它小众的框架(谁知道会不会有填不完的大坑)。 最近在社区闲逛的时候,发现一个Red Hat开源的Java框架Quarkus,定位为GraalVM和OpenJDK HotSpot量身定制的一个Kurbernetes Native Java框架。虽然开源时间较短,但是生态方面也已经达到可用的状态,自身包含扩展框架,已经支持像Netty、Undertow、Hibernate、JWT等框架,足以用于开发企业级应用,用户也可以基于扩展框架自行扩展。 术语简介 **Cloud Native Application:**即云原生应用,是由 Pivotal 的Matt Stine在2013年提出的,个人认为所谓云原生应用也是SAAS服务的一种,针对近年来云计算平台的发展,SAAS服务进一步发展的产物。 **Graalvm:**Oracle在2018年开源的一个通用型虚拟机,可以用来构建多语言应用,也可以简单地用来编译和构建Java应用,甚至可以将Java应用构建成Native

Could someone please explain the differences between Graal, GraalVM, Truffle & SubstrateVM?

拟墨画扇 提交于 2020-02-21 04:56:30
问题 I know these technologies are all related but could someone please explain what each one is used for and how they fit together? 回答1: Oversimplification: Graal - Java bytecode compiler. Can be used just in time (as part of a JVM) or ahead of time. SubstrateVM - other things (runtime) needed to actually run ahead-of-time compiled Java bytecode without a JVM. This powers the "native-image" command of GraalVM. Truffle - framework for implementing languages as AST interpreters which can be just-in

Exception chains in GraalVM

◇◆丶佛笑我妖孽 提交于 2020-01-06 04:47:06
问题 I'm using GraalVM to execute JavaScript files, but i'm having trouble with exception handling. My JS code makes calls back into Java, and if an exception is thrown from one of those Java methods then i lose the cause-chain. public class Example { public static void doSomething() { throw new RuntimeException("Example", new RuntimeException("Some nested exception")); } } // -------------- var Example = Java.type("ex.Example"); function f() { Example.doSomething(); } // ------------- String src

Injected members from the host language to arrive to guest language as guest language types

泄露秘密 提交于 2020-01-02 17:50:38
问题 This question is somewhat related to: GraalVM - Using Polyglot Value without a context In my application, the code snippets run in the guest languages should not need to know that the arguments injected (through members of the bindings) are Java arguments. Instead, for people developing in the guest language, arguments should look like just another argument of the guest language itself. For example, I would like for an array injected from my Java host language to a JS guest script, in this

像go一样将编译js/node编译为单文件独立运行exe

自古美人都是妖i 提交于 2019-12-27 21:53:28
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 如下两个模块: pkg https://github.com/zeit/pkg nexe https://github.com/nexe/nexe 编译出来,比go尺寸大一点,但存储不值钱。 java的新jvm(graalvm)这块还没搞好 .net core 的单文件编译,差不多 觉得有意思? 一起聊聊, 大前端俱乐部微信群: 来源: oschina 链接: https://my.oschina.net/xiaoyan787/blog/3148387

Use graalvm via the standard JDK 11

前提是你 提交于 2019-12-21 02:42:38
问题 I have project used Nashorn Javascript engine. I'm trying to migrate to java11 and also migrate from Nashorn to Graal. I've read here that I can use graal via the standard JDK installation starting from JDK 11. Also I've read there that Graal-SDK are uploaded to Maven central, and that there is Java flag polyglot.js.nashorn-compat for easy migration. So I've used jdk11, add maven dependency to pom.xml and used java flag but when I'm trying to get engine by name "graal.js", I've got null here:

How to get Graal SDK packages to work without Maven?

浪子不回头ぞ 提交于 2019-12-21 02:26:34
问题 I am developing a Java application that needs to execute JavaScript. Nashorn JS engine is about to get deprecated and the replacement is the set of APIs provided by Graal SDK which makes use of GraalVM. The virtual machine that essentially executes a number of languages. At least that is what I think. So I spent a day trying to get it working. I downloaded GraalVM rc6 that uses JDK 8. I use IntelliJ IDEA and I added GraalVM as a new JDK. I found it strange that I am supposed to add a virtual

GraalVM and Spring Applications

若如初见. 提交于 2019-12-20 12:06:46
问题 The GraalVM system apparently cannot compile a Spring application into a native image. Can we compile a subset of the Spring application -- say, as a separate library -- and then use that with the remainder compiled using the usual javac compiler? Or maybe if we leave out some Spring features from our application? Any other possibilities? 回答1: The opening statement of this question is a bit vague so it's hard to address it properly. GraalVM absolutely can compile Spring applications. GraalVM