Jimfs path to ceylon Directory - java

I'm trying to create a directory (using ceylon's file module) in the Jimfs file system but I'm having problems with the Jimfs provider not being installed when accessing the filesystem from ceylon.
This is my test program:
// File: test.se.gustavkarlsson.autogit.file.watcher.run
import ceylon.file {
Nil,
parseURI
}
import com.google.common.jimfs {
Jimfs {
jimFs=newFileSystem
}
}
shared void run() {
value fs = jimFs();
value jPath = fs.getPath("directory");
value uri = jPath.toUri().string;
value path = parseURI(uri);
value resource = path.resource;
assert (is Nil resource);
resource.createDirectory();
}
When run, prints the following stacktrace:
ceylon run: Provider "jimfs" not found
java.nio.file.ProviderNotFoundException: Provider "jimfs" not found
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:341)
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:276)
at ceylon.file.internal.createSystem_.createSystem(ConcreteSystem.ceylon:64)
at ceylon.file.createSystem_.createSystem(System.ceylon:43)
at test.se.gustavkarlsson.autogit.file.watcher.run_.run(run.ceylon:17)
at test.se.gustavkarlsson.autogit.file.watcher.run_.main(run.ceylon)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at ceylon.modules.api.runtime.SecurityActions.invokeRunInternal(SecurityActions.java:57)
at ceylon.modules.api.runtime.SecurityActions.invokeRun(SecurityActions.java:48)
at ceylon.modules.api.runtime.AbstractRuntime.invokeRun(AbstractRuntime.java:75)
at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:122)
at ceylon.modules.api.runtime.AbstractRuntime.execute(AbstractRuntime.java:106)
at ceylon.modules.Main.execute(Main.java:69)
at ceylon.modules.Main.main(Main.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.modules.Module.run(Module.java:312)
at org.jboss.modules.Main.main(Main.java:460)
at ceylon.modules.bootstrap.CeylonRunTool.run(CeylonRunTool.java:244)
at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:491)
at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:380)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:114)
at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:41)
at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:34)
at com.redhat.ceylon.launcher.Launcher.main(Launcher.java:27)
Any ideas on how to install that provider?
I'm running Ceylon 1.2.0 on Linux, with JimFs 1.0 (also tested 1.1-rc1) and working with Jimfs the "intended" way (pure java nio) works fine.

This is related to module visibility, where we need to add a "read" (using Jigsaw terminology) from the JDK to the jimFs module.
I've opened https://github.com/ceylon/ceylon/issues/5995 to investigate.

Related

How do I import singleton object from Scala package in Java?

I am trying to use ARIMA object (Scala), which is imported from a package, in my Java program. Although the compilation succeeds, meaning that ARIMA class is recognized during compilation, there is NoClassDefFoundError for the ARIMA object in runtime. ARIMAModel class has no problem with importing since it is a class.
Is there any way to use the Scala object from my Java program?
Here is the source code for the object in Scala package.
File: .../com/cloudera/sparkts/models/ARIMA.scala
package com.cloudera.sparkts.models
object ARIMA {
def autoFit(ts: Vector, maxP: Int = 5, maxD: Int = 2, maxQ: Int = 5): ARIMAModel = {
...
}
}
class ARIMAModel(...) {
...
}
Here is my Java code.
File: src/main/java/SingleSeriesARIMA.java
import com.cloudera.sparkts.models.ARIMA;
import com.cloudera.sparkts.models.ARIMAModel;
public class SingleSeriesARIMA {
public static void main(String[] args) {
...
ARIMAModel arimaModel = ARIMA.autoFit(tsVector, 1, 0, 1);
...
}
}
Here is the error.
Exception in thread "main" java.lang.NoClassDefFoundError: com/cloudera/sparkts/models/ARIMA
at SingleSeriesARIMA.main(SingleSeriesARIMA.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:729)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:185)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:210)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:124)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: com.cloudera.sparkts.models.ARIMA
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more
I am using Scala version 2.11.8 and Java 1.8
You need to supply the dependency having Arima object present to the spark cluster using --jars option as below-
spark-submit --jars <path>/<to>/sparkts-0.4.1.jar --class SingleSeriesARIMA target/simple-project-1.0.jar
This will pass the other dependency along with the application jar to be available at spark-runtime.
TO call ARIMA object from java use-
ARIMA$.MODULE$.autoFit(tsVector, 1, 0, 1);

Jython 2.2 - java.lang.ExceptionInInitializerError when accessing class .getPackage()

I have a Java class myObj with a static block as shown:
static{
Class<myObj> klass = myObj.class;
log.info("\nClientAPIVersion : "+ klass.getPackage().getImplementationVersion());
}
I'm creating an instance of this class in jython 2.2.
When I run my python script using :
java -Dlog4j.configuration=file://${CLASSPATH}/log4j.xml -jar ~/jython_2.2/jython.jar test.py
I get an exception as shown:
File "test.py", line 42, in ?
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError
I found online that java.lang.ExceptionInInitializerError occurs due to a crash in the static block.
When I remove the log.info, the python code executes correctly.
I think that klass.getPackage() might be null, but if so, it should simply print 'null' in the log. Why the exception ?
What is the source of the problem and how may I fix it ? Thanks

Not able to run jpf command :JPF exception, terminating: error reading class java.lang.reflect.AnnotatedElement

I am getting the below error when I try to run the jpf basset program. I was able to build jpf-core and jpf-actor successfully. Did anyone encounter this before? Am I missing out something? Appreciate your response/comments. Thanks.
~/b/p/j/jpf-core  bin/jpf gov.nasa.jpf.actor.Basset pi.Driver 3
[SEVERE] JPF exception, terminating: error reading class java.lang.reflect.AnnotatedElement
gov.nasa.jpf.classfile.ClassFileException: illegal constpool tag
at gov.nasa.jpf.classfile.ClassFile.error(ClassFile.java:168)
at gov.nasa.jpf.classfile.ClassFile.parseCp(ClassFile.java:1009)
at gov.nasa.jpf.classfile.ClassFile.parse(ClassFile.java:827)
at gov.nasa.jpf.jvm.ClassInfo.<init>(ClassInfo.java:803)
at gov.nasa.jpf.jvm.ClassInfo.loadClass(ClassInfo.java:1221)
at gov.nasa.jpf.jvm.ClassInfo.getResolvedClassInfo(ClassInfo.java:1207)
at gov.nasa.jpf.jvm.ClassInfo.loadInterfaceRec(ClassInfo.java:1994)
at gov.nasa.jpf.jvm.ClassInfo.loadInterfaceRec(ClassInfo.java:2000)
at gov.nasa.jpf.jvm.ClassInfo.getAllInterfaces(ClassInfo.java:2150)
at gov.nasa.jpf.jvm.JVM.registerStartupClass(JVM.java:531)
at gov.nasa.jpf.jvm.JVM.registerStartupClasses(JVM.java:510)
at gov.nasa.jpf.jvm.JVM.initialize(JVM.java:301)
at gov.nasa.jpf.JPF.run(JPF.java:616)
at gov.nasa.jpf.JPF.start(JPF.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at gov.nasa.jpf.tool.Run.call(Run.java:76)
at gov.nasa.jpf.tool.RunJPF.main(RunJPF.java:100)
---------------------- JPF error stack trace ---------------------
gov.nasa.jpf.JPFException: error reading class java.lang.reflect.AnnotatedElement
at gov.nasa.jpf.jvm.ClassInfo.loadClass(ClassInfo.java:1231)
at gov.nasa.jpf.jvm.ClassInfo.getResolvedClassInfo(ClassInfo.java:1207)
at gov.nasa.jpf.jvm.ClassInfo.loadInterfaceRec(ClassInfo.java:1994)
at gov.nasa.jpf.jvm.ClassInfo.loadInterfaceRec(ClassInfo.java:2000)
at gov.nasa.jpf.jvm.ClassInfo.getAllInterfaces(ClassInfo.java:2150)
at gov.nasa.jpf.jvm.JVM.registerStartupClass(JVM.java:531)
at gov.nasa.jpf.jvm.JVM.registerStartupClasses(JVM.java:510)
at gov.nasa.jpf.jvm.JVM.initialize(JVM.java:301)
at gov.nasa.jpf.JPF.run(JPF.java:616)
at gov.nasa.jpf.JPF.start(JPF.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at gov.nasa.jpf.tool.Run.call(Run.java:76)
at gov.nasa.jpf.tool.RunJPF.main(RunJPF.java:100)
Caused by: gov.nasa.jpf.classfile.ClassFileException: illegal constpool tag
at gov.nasa.jpf.classfile.ClassFile.error(ClassFile.java:168)
at gov.nasa.jpf.classfile.ClassFile.parseCp(ClassFile.java:1009)
at gov.nasa.jpf.classfile.ClassFile.parse(ClassFile.java:827)
at gov.nasa.jpf.jvm.ClassInfo.<init>(ClassInfo.java:803)
at gov.nasa.jpf.jvm.ClassInfo.loadClass(ClassInfo.java:1221)
... 15 more
~/b/p/j/jpf-core 
Don't know if it's worth but mine turn out to be a problem with the Java version. JPF library was compiled with Java 8 while I was trying to use it in Java 7. Matching the java version worked out for me.

Azureus fails with NoClassDefFoundError: Could not initialize class org.eclipse.swt.internal.cairo.Cairo

After recent Linux Mint update, namely to libservlet3.0-java, starting Azureus produces this output (and Azureus fails to start):
file:/usr/lib/jni/ ; file:/usr/lib/java/ ; file:/usr/share/java/Azureus2.jar ; file:/usr/share/java/log4j-1.2-1.2.17.jar ; file:/usr/share/java/commons-cli-1.2.jar ; file:/usr/lib/java/swt-gtk-3.8.2.jar ; file:/home/saran/
changeLocale: *Default Language* != English (United States). Searching without country..
changeLocale: Searching for language English in *any* country..
changeLocale: no message properties for Locale 'English (United States)' (en_US), using 'English (default)'
UIFunctions/ImageLoad took 25ms
ImageRepository:loadImage:: Resource not found: org/gudy/azureus2/ui/icons/a16.png
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-cairo-gtk-3836 in java.library.path
no swt-cairo-gtk in java.library.path
Can't load library: /usr/lib/jni/libswt-cairo-gtk-3836.so
Can't load library: /usr/lib/jni/libswt-cairo-gtk.so
Can't load library: /home/saran/.swt/lib/linux/x86_64/libswt-cairo-gtk-3836.so
Can't load library: /home/saran/.swt/lib/linux/x86_64/libswt-cairo-gtk.so
ImageRepository:loadImage:: Resource not found: org/gudy/azureus2/ui/icons/a16.png
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.swt.internal.cairo.Cairo
DEBUG::Wed Jul 08 18:25:54 CEST 2015::com.aelitis.azureus.ui.swt.shells.main.MainWindowImpl::createWindow::802:
MainWindowImpl::access$000::117, MainWindowImpl$4::runSupport::273, AERunnable::run::35, Utils::execSWTThread::749, Utils::execSWTThread::873, MainWindowImpl::<init>::269, MainWindowFactory::createAsync::63, Initializer::runInSWTThread::270, SWTThread::<init>::281, SWTThread::createInstance::61, Initializer::<init>::158, NativeConstructorAccessorImpl::newInstance0::-2, NativeConstructorAccessorImpl::newInstance::57, DelegatingConstructorAccessorImpl::newInstance::45, Constructor::newInstance::526, Main::<init>::111, Main::main::328, NativeMethodAccessorImpl::invoke0::-2, NativeMethodAccessorImpl::invoke::57, DelegatingMethodAccessorImpl::invoke::43, Method::invoke::606, Main::directLaunch::226, Main::main::129, NativeMethodAccessorImpl::invoke0::-2, NativeMethodAccessorImpl::invoke::57, DelegatingMethodAccessorImpl::invoke::43, Method::invoke::606, MainExecutor$1::run::34, Thread::run::745
java.lang.NoClassDefFoundError: Could not initialize class org.eclipse.swt.internal.cairo.Cairo
at org.eclipse.swt.graphics.Image.init(Image.java:1285)
at org.eclipse.swt.graphics.Image.<init>(Image.java:200)
at com.aelitis.azureus.ui.swt.imageloader.ImageLoader.getNoImage(ImageLoader.java:856)
at com.aelitis.azureus.ui.swt.imageloader.ImageLoader.parseValuesString(ImageLoader.java:253)
at com.aelitis.azureus.ui.swt.imageloader.ImageLoader.getImages(ImageLoader.java:704)
at com.aelitis.azureus.ui.swt.imageloader.ImageLoader.getImage(ImageLoader.java:717)
at org.gudy.azureus2.ui.swt.Utils.setShellIcon(Utils.java:641)
at com.aelitis.azureus.ui.swt.shells.main.MainWindowImpl.createWindow(MainWindowImpl.java:530)
at com.aelitis.azureus.ui.swt.shells.main.MainWindowImpl.access$000(MainWindowImpl.java:117)
at com.aelitis.azureus.ui.swt.shells.main.MainWindowImpl$4.runSupport(MainWindowImpl.java:273)
at org.gudy.azureus2.core3.util.AERunnable.run(AERunnable.java:35)
at org.gudy.azureus2.ui.swt.Utils.execSWTThread(Utils.java:749)
at org.gudy.azureus2.ui.swt.Utils.execSWTThread(Utils.java:873)
at com.aelitis.azureus.ui.swt.shells.main.MainWindowImpl.<init>(MainWindowImpl.java:269)
at com.aelitis.azureus.ui.swt.shells.main.MainWindowFactory.createAsync(MainWindowFactory.java:63)
at com.aelitis.azureus.ui.swt.Initializer.runInSWTThread(Initializer.java:270)
at org.gudy.azureus2.ui.swt.mainwindow.SWTThread.<init>(SWTThread.java:281)
at org.gudy.azureus2.ui.swt.mainwindow.SWTThread.createInstance(SWTThread.java:61)
at com.aelitis.azureus.ui.swt.Initializer.<init>(Initializer.java:158)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.gudy.azureus2.ui.swt.Main.<init>(Main.java:111)
at org.gudy.azureus2.ui.swt.Main.main(Main.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gudy.azureus2.ui.common.Main.directLaunch(Main.java:226)
at org.gudy.azureus2.ui.common.Main.main(Main.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.aelitis.azureus.launcher.MainExecutor$1.run(MainExecutor.java:34)
at java.lang.Thread.run(Thread.java:745)
[alert] Alert:3:Error Initialize MainWindow
How to solve this?
Based on an old bug (from 2008) I have been able to get Azureus to work again.
Solution: install libswt-cairo-gtk-3-jni package.
Versions on my machine:
Azureus: 5.6.1.2-1~getdeb1,
libservlet3.0-java: 7.0.52-1ubuntu0.3,
libswt-cairo-gtk-3-jni: 3.8.2-3

LWJGL Controllers in IntelliJ

Every time I try to build a basic example program for using LWJGL controllers, it crashes. Here's the code:
package com.czipperz.blogspot.tests.controllers;
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Controller;
import org.lwjgl.input.Controllers;
/**
* Created by Chris on 10/23/2014.
*/
public class Main {
//left joystick x and y
private float x, y,
//right joystick x and y. Like the commas?
rx, ry;
//This Controller object MUST BE org.lwjgl.input.Controller NOT net.java.games.input.Controller
private Controller c;
private boolean start;
public static final int BUTTON_A = 1, BUTTON_B = 2, BUTTON_X = 3, BUTTON_Y = 4,
BUTTON_LEFT_BUMPER = 5, BUTTON_RIGHT_BUMPER = 6, BUTTON_SELECT = 7, BUTTON_START = 8,
//When you PRESS the joysticks (click)
BUTTON_LEFT_JOYSTICK = 9, BUTTON_RIGHT_JOYSTICK = 10;
public static void main(String[] args) {
new Main();
}
public Main() {
//Says, find controllers and store them in the Controllers class to JInput. Dont worry bout it.
try {
Controllers.create();
} catch (LWJGLException e) {
e.printStackTrace();
}
// Gets you a shiny "new" controller instance.
// Think of index like you would think of an array.
c = Controllers.getController(0);
//Sets "deadband"
float dead = .06f;
c.setXAxisDeadZone(dead);
c.setYAxisDeadZone(dead);
c.setRXAxisDeadZone(dead);
c.setRYAxisDeadZone(dead);
//Using the controller requires you to call the poll() function to receive new data.
c.poll();
x = c.getXAxisValue();
y = c.getYAxisValue();
rx = c.getRXAxisValue();
ry = c.getRYAxisDeadZone();
//NOTE: getZAxisValue(), getRZAxisValue(), getZAxisDeadZone(), getRZAxisDeadZone() DO NOT WORK
//DPAD = POV
float povx = c.getPovX();
float povy = c.getPovY();
boolean lbumper = c.isButtonPressed(BUTTON_LEFT_BUMPER);
}
}
The problem is that every time I build, this is the log: (Sorry I just can't hit space that many times)
"C:\Program Files\Java\jdk1.8.0_25\bin\java" -Didea.launcher.port=7533 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains IntelliJ IDEA Community Edition 13.1.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_25\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_25\jre\lib\ext\zipfs.jar;C:\Users\Chris\workspace\Controllers\out\production\Controllers;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lzma.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\jinput.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl_test.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl_util.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl-debug.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\asm-debug-all.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\lwjgl_util_applet.jar;C:\Users\Chris\workspace\lwjgl-2.9.1\jar\AppleJavaExtensions.jar;C:\Program Files (x86)\JetBrains IntelliJ IDEA Community Edition 13.1.5\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.czipperz.blogspot.tests.controllers.Main
WARNING: Found unknown Windows version: Windows 8.1
Attempting to use default windows plug-in.
Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
java.lang.UnsatisfiedLinkError: no jinput-dx8_64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at net.java.games.input.DirectInputEnvironmentPlugin$1.run(DirectInputEnvironmentPlugin.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.input.DirectInputEnvironmentPlugin.loadLibrary(DirectInputEnvironmentPlugin.java:67)
at net.java.games.input.DirectInputEnvironmentPlugin.<clinit>(DirectInputEnvironmentPlugin.java:109)
at net.java.games.input.DirectAndRawInputEnvironmentPlugin.<init>(DirectAndRawInputEnvironmentPlugin.java:45)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at java.lang.Class.newInstance(Class.java:438)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:157)
at org.lwjgl.input.Controllers.create(Controllers.java:71)
at com.czipperz.blogspot.tests.controllers.Main.<init>(Main.java:32)
at com.czipperz.blogspot.tests.controllers.Main.main(Main.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
java.lang.UnsatisfiedLinkError: no jinput-raw_64 in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at net.java.games.input.RawInputEnvironmentPlugin$1.run(RawInputEnvironmentPlugin.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at net.java.games.input.RawInputEnvironmentPlugin.loadLibrary(RawInputEnvironmentPlugin.java:67)
at net.java.games.input.RawInputEnvironmentPlugin.<clinit>(RawInputEnvironmentPlugin.java:109)
at net.java.games.input.DirectAndRawInputEnvironmentPlugin.<init> (DirectAndRawInputEnvironmentPlugin.java:46)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at java.lang.Class.newInstance(Class.java:438)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:157)
at org.lwjgl.input.Controllers.create(Controllers.java:71)
at com.czipperz.blogspot.tests.controllers.Main.<init>(Main.java:32)
at com.czipperz.blogspot.tests.controllers.Main.main(Main.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.lwjgl.input.Controllers.getController(Controllers.java:116)
at com.czipperz.blogspot.tests.controllers.Main.<init>(Main.java:38)
at com.czipperz.blogspot.tests.controllers.Main.main(Main.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
net.java.games.input.DirectAndRawInputEnvironmentPlugin is not supported
Process finished with exit code 1
I know this thread is old, but for people who are searching for the solution.
The answer is, you have to include the native libs to your project. For the use of jinput.jar you have to include following libs:
jinput-dx8.dll
jinput-dx8_64.dll
jinput-raw.dll
jinput-raw_64.dll
You can download the natives here DOWNLOAD.
You will get a jar-file. Unzip the file with winrar to get the dll-files.
Now go to project and open the context menu with a click on the right mouse button -> Build Path -> Configure Build Path -> Choose the Libraries tab -> Click on the little arrow next to the jinput.jar to expand the view -> Make a double click with the left mouse button on Native library location -> Choose the directory of the dll-files.
Confirm the dialogs and try to run your program again.
In LWJGL there is a "native/" folder containing the respective native libraries for each platform/OS. Just choose your platform and set java.library.path to that directory.
This is your problem.
First Step:
Create a folder and rename it to LWGJL_New then in that folder create two other folders and rename the first on libs and the second one natives.
Now go to the LWGJL library that you have downloaded. Copy the jar files to LWGJL_New/libs. Then go to the LWGJL library that you have downloaded, in it, there is a folder containing respective native libraries for each platform/OS.
Choose one of them that you need and copy it to LWGJL_New/natives.
Second step:
Go to the module settings of your project(F4) then click library.Click add sign(+).Click on java. Now find the LWGJL_New folder and in it click on the jar folder and click ok. Then Click on Apply and ok.
Third step:
Now if you run your project you will occur that problem, So go to the Edit Configuration part
Then in VM options write this:
-Djava.library.path="***"
Instead of star signs write the address of the native folder that we have just created.
For example ->
D:\LWGJL_New\natives\windwos
D:\LWGJL_New\natives\linux
Then click on OK.
Then run your project.

Categories