[FIXED] Cannot use JIntellitype with double-clickable jar

Feature Requests, Comments, Bugs, and Suggestions on the JIntellitype Java API.

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby xixixao » Fri Apr 22, 2011 8:17 am

Hi,

thank you for the great library, it was really easy to set up.

But, I have spent 4 hours now trying to get it work with double-clickable jar, with no luck. I have read through this whole thread. I am using Windows 7 64-bit and I just want to run the program by clicking the Jar. If I include the line JIntellitype.getInstance();, the program doesn't run. I tried JIntellitype.setLibraryLocation() with an absolute path, but that didn't have any effect. I'm out of ideas, the program just doesn't get over the getInstance() call.

Any ideas what could be wrong? What can I do to get more information about the problem?

The program runs fine through shell and NetBeans IDE...

Thank you,
xixixao
xixixao
 
Posts: 6
Joined: Fri Apr 22, 2011 7:48 am

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby Melloware » Fri Apr 22, 2011 8:24 am

Well all I can tell you is it is failing on the call to the LoadLibrary.

Double clickable JAR's need a perfect manifest file in the JAR including the correct classpath etc. My guess is something is wrong with your manifest?
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11045
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby xixixao » Fri Apr 22, 2011 11:29 am

Thank you for the quick reply!

Is it a problem with the Java or the native library? This is how the manifest file looks like:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 14.3-b01 (Sun Microsystems Inc.)
Main-Class: launcher.Main
Class-Path: lib/jintellitype.jar
X-COMMENT: Main-Class will be added automatically by build

If I delete the Class-Path, running the Jar throws a fatal error (which seems appropriate). Should I do anything else for the JIntellitype.dll?
xixixao
 
Posts: 6
Joined: Fri Apr 22, 2011 7:48 am

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby Melloware » Fri Apr 22, 2011 11:40 am

xixixao wrote:Thank you for the quick reply!

Is it a problem with the Java or the native library? This is how the manifest file looks like:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.1
Created-By: 14.3-b01 (Sun Microsystems Inc.)
Main-Class: launcher.Main
Class-Path: lib/jintellitype.jar
X-COMMENT: Main-Class will be added automatically by build

If I delete the Class-Path, running the Jar throws a fatal error (which seems appropriate). Should I do anything else for the JIntellitype.dll?


Is the DLL in the same directory as the double clickable JAR? I see you have it referenced as /lib/ etc but try removing that and putting the DLL in the same directory as the JAR.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11045
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby xixixao » Fri Apr 22, 2011 11:55 am

If you mean the JAR file, than it doesnt make any difference. I have actually found out now that if I delete the Class-Path leading to it from the manifest, it also does nothing. Is it possible that when double-clicking, the JAR is ignoring the class-path? But when run through the console, it does not...
xixixao
 
Posts: 6
Joined: Fri Apr 22, 2011 7:48 am

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby xixixao » Fri Apr 22, 2011 12:40 pm

OK, I take that back, there is no problem with the inclusion of jintellitype.jar file, the problem does occur inside of the .getInstance() call. But that can't be connected to Class-Path in the manifest. I placed the JIntelliType.dll in my Win32 directory as instructed and as I said, it works fine with console or netbean's ant script...
xixixao
 
Posts: 6
Joined: Fri Apr 22, 2011 7:48 am

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby Melloware » Fri Apr 22, 2011 1:06 pm

xixixao wrote:OK, I take that back, there is no problem with the inclusion of jintellitype.jar file, the problem does occur inside of the .getInstance() call. But that can't be connected to Class-Path in the manifest. I placed the JIntelliType.dll in my Win32 directory as instructed and as I said, it works fine with console or netbean's ant script...


So its a path issue. The getInstance looks for a DLL in the current running directory or the System path (win32 path). So your problem was when it is in /lib/ it is not being found even with the classpath entry.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11045
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby xixixao » Fri Apr 22, 2011 1:26 pm

But I DO have the dll inside both the local directory and Win32... the program wouldn't run at all otherwise... How exactly does the setLibraryLocation work?
xixixao
 
Posts: 6
Joined: Fri Apr 22, 2011 7:48 am

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby Melloware » Fri Apr 22, 2011 1:48 pm

xixixao wrote:But I DO have the dll inside both the local directory and Win32... the program wouldn't run at all otherwise... How exactly does the setLibraryLocation work?


http://code.google.com/p/jintellitype/source/browse/trunk/src/main/java/com/melloware/jintellitype/JIntellitype.java

Code: Select all
/**
    * Sets the libraryLocation.
    * <p>
    * @param libraryLocation The libraryLocation to set.
    */
   public static void setLibraryLocation(String libraryLocation) {
      final File dll = new File(libraryLocation);
      if (!dll.isAbsolute()) {
         JIntellitype.libraryLocation = dll.getAbsolutePath();
      } else {
         // absolute path, no further calculation needed
         JIntellitype.libraryLocation = libraryLocation;
      }
   }
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11045
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby xixixao » Fri Apr 22, 2011 1:55 pm

Yeah, I checked the whole source code and finally solved it. And I have to apologize for wasting your time.

So: the problem is simple, when double-clicking the JAR, 32bit jawaw.exe is run, and therefore, the 32bit version of the dll has to be included in the local directory.

Then it works! So much for for the most of my today :) Thanks again for help.
xixixao
 
Posts: 6
Joined: Fri Apr 22, 2011 7:48 am

Re: [FIXED] Cannot use JIntellitype with double-clickable jar

Postby Melloware » Fri Apr 22, 2011 1:59 pm

Excellent!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Melloware Inc.
http://www.melloware.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-
User avatar
Melloware
Site Admin
 
Posts: 11045
Joined: Thu Dec 01, 2005 10:24 pm
Location: Philadelphia, Pennsylvania USA

Previous

Return to JIntellitype

Who is online

Users browsing this forum: No registered users and 1 guest

cron