Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem when creating / running a jar file  RSS feed

 
Nicolas Stern
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'really don't see it... thanks for helping me !

I'm trying to create a runnable jar file with a simple Swing application.

Jar creation and running works fine... except when the main methods instanciate the class itself. In this case, I can't run the jar file.

Sample code:
this is my test class code:
// ----------------------
package myPackage;
import javax.swing.JFrame;
public class Test extends JFrame {
public static void main (String [] args ){
Test te = new Test();
}
}
// ----------------------

...
This is the content of my manifest file:

Main-Class: myPackage.Test

...
This is the command line to create the jar file:

jar cmf mymanifest.txt test.jar -C classes myPackage/Test.class

...

... and I call my jar file from the command line:
java -jar test.jar

--------------------
If the main method tries to instanciate the Class as mentionned above, I get the following error when running the jar file:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no JavaAccessBridge in java.library.path

When the class is not being instanciated, then everything works fine.

I really don't see it. Thanks for any input

Nicolas
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, my first question is whether this app works on this machine when you run it outside of the JAR file? The "Java Access Bridge" is a special library that lets visually impaired users make use of GUI apps. It sounds like it's improperly installed on this machine.
 
Nicolas Stern
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ernst,

Thank you for your input - you pointed me into the right direction.

I was not suspecting that my class did not run correctly. Running it from my IDE (Eclipse), the class was running fine, but not from the command line. So I'm missing some library (dll or jar). Just have to find which one.

BTW I think things have gotten rotten when I installed an Oracle on my machine. The Oracle installer installs several java runtime environments (one for the client, one for the installer, one for the server internal VM), so of course I possibly don't have the correct environment.

Best regards - Nicolas
 
Nicolas Stern
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally (topic can be closed) : The library JavaAccessBridge.dll (and other) were missing from C:\WINDOWS\system32. I just re-installed the Java Access Bridge, and everything works great.

Cheers - Nic
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!