The jvm package

[Tags:benchmark, bsd3, library, test]

Please see

[Skip to Readme]


Versions 0.1, 0.1.1, 0.1.2, 0.2.0, 0.2.1, 0.2.2
Dependencies base (>=4.7 && <5), bytestring (>=0.10), choice (>=0.1), distributed-closure (>=0.3), jni (>=0.3.0), singletons (>=2.0), template-haskell (>=2.10), text (>=1.2), vector (>=0.11) [details]
License BSD3
Copyright 2015-2016 EURL Tweag.
Author Tweag I/O
Category FFI, JVM, Java
Home page
Source repository head: git clone
Uploaded Wed May 3 04:12:13 UTC 2017 by MathieuBoespflug
Distributions LTSHaskell:0.2.2, NixOS:0.2.2
Downloads 283 total (18 in the last 30 days)
0 []
Status Docs not available [build log]
All reported builds failed as of 2017-05-03 [all 3 reports]
Hackage Matrix CI


  • Language
    • Language.Java
      • Language.Java.TH


Maintainer's Corner

For package maintainers and hackage trustees

Readme for jvm

Readme for jvm-0.2.2

jvm: Call any JVM function from Haskell

jvm on Stackage LTS jvm on Stackage Nightly

This package enables calling any JVM function from Haskell. If you'd like to call JVM methods using Java syntax and hence get the Java compiler to scope check and type check all your foreign calls, see inline-java, which builds on top of this package.


Graphical Hello World using Java Swing:

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}

import Data.Text (Text)
import Language.Java

newtype JOptionPane = JOptionPane (J ('Class "javax.swing.JOptionPane"))
instance Coercible JOptionPane ('Class "javax.swing.JOptionPane")

main :: IO ()
main = withJVM [] $ do
    message <- reflect ("Hello World!" :: Text)
      (classOf (undefined :: JOptionPane))
      [JObject nullComponent, JObject (upcast message)]
    nullComponent :: J ('Class "java.awt.Component")
    nullComponent = jnull