artouiros
artouiros

Reputation: 3987

Java .jar not running on windows

I am developing using Eclipse under Fedora 15. I exported a runnable jar. It works fine in Fedora. But I can't run it on windows. I have installed a JRE. I even tried installing JDK. There are no error logs, app just didn't start.

Here's the output

Microsoft Windows [Version 6.1.7601]
(c) Корпорация Майкрософт (Microsoft Corp.), 2009. Все права защищены.

C:\Users\Артоюрос>java -jar C:\Lib.Ru2Epub.jar
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:

        no swt-gtk-3735 in java.library.path
        no swt-gtk in java.library.path
        Can't load library: C:\Users\└ЁЄю■Ёюё\.swt\lib\win32\x86\swt-gtk-3735.dl
l
        Can't load library: C:\Users\└ЁЄю■Ёюё\.swt\lib\win32\x86\swt-gtk.dll

        at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)
        at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
        at org.eclipse.swt.internal.C.<clinit>(C.java:21)
        at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
        at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
        at org.eclipse.swt.widgets.Display.<clinit>(Display.java:132)
        at ru.lib.epub.MainWindow.main(MainWindow.java:28)
        ... 5 more

C:\Users\Артоюрос>

Upvotes: 1

Views: 1752

Answers (4)

zacheusz
zacheusz

Reputation: 8842

There is a problem with swt dlls.

  1. check if the file C:\Users\└ЁЄю■Ёюё.swt\lib\win32\x86\swt-gtk.dll exists
  2. maybe you can't load it coz u don't have admin privileges? Then Goto Eclipse installation path, right click on eclipse.exe and select "Properites". From the eclipse.exe Properties pop-up select "Compatibility" tab and at the bottom of the tab check the following check box "Run this program as administrator" in "Previlege Level" category. This should solve the problem.
  3. Sometimes simply adding dlls into lib folder helps

Upvotes: 1

Anantha Sharma
Anantha Sharma

Reputation: 10108

you may be referencing a resource using absolute path.. since you say you developed the app on Linux. you might have said new File("/etc/fstab");.. this would fail on windows as it does not have a file system like this.

this would usually be the case.

Upvotes: 1

AlexR
AlexR

Reputation: 115388

As @a_horse_with_no_name said "open command prompt and run java -jar your.jar". If it works you have to map extension *.jar to program named "java". This is how windows works. The same mechanism is working when double click on *.txt file starts Notepad.

Since I am on linux now I cannot tell you how to map the extension to program but it is somewhere in menus of file explorer.

Upvotes: 2

dan
dan

Reputation: 74

it should be a runnable jar , so you can run it on windows using double click.

Upvotes: 1

Related Questions