Problems creating an executable jar

Started by Melssj5, May 17, 2007, 05:38:05 PM

Previous topic - Next topic

Melssj5

Hi, this is more a java than a jpct problem. Anyway please help, I cant create an executable jar. I am using Eclipse, exporting the jar, setting the main class and when trying to execute it just nothing happends. It seems it began to process something for the mouse icon, but after a few seconds nothing happens.

I have tried to do it manually but its the same. Y¡The MANIFEST file has only 2 entries. The version and the main class options set.

Please am I missing something?
Nada por ahora

Melssj5

Well, I notice that when executing the jar there seems to be running because a javaw process is added to the process list, but the aplication is not being shown. Any clue!
Nada por ahora

ToddMcF2002

I just tried Launch4J which creates a windows executable.  If platform is Windows only it might be an option for you.  Just to note though I only tried software mode since here at work I don't have OpenGL support.  I'm a bit worried about that -Djava.library.path=%LIB% thing.  Not sure how that is going to take exactly unless the configuration tool supports relative paths on that.

Also - I had to keep the classpath Jar references outside of the executable in a "3rdParty" directory.  I'm sure I could have exploded out all the underlying class files in my jar root though.  That wont help the JNI situation though.




ToddMcF2002

OK so I tried launch4j soup to nuts with an embedded JRE and it worked.  I have an old IBM T42 laptop I stripped of all Java to test the deployment and all is well.

So - you just do this:

Point the launch4j GUI at your JAR that contains all your code, textures, models etc.  I created a "3rdParty" directory and put all the dependency jars and LWJGL dll's lumped in.  I also copied the JRE directory out of my JDK install location and put it right next to "3rdParty".  Then I just zipped it all up with the EXE that launch4j created.

Here is the XML config I used.  You can see the 3rdParty, JRE, Heap sizes and java.library.path stuff in there.  I hope this helps.  I have been wanting to test this thing anyway so your thread gave me the excuse ;)
 


<launch4jConfig>
  <dontWrapJar>false</dontWrapJar>
  <headerType>gui</headerType>
  <jar>C:\jpct\run_test\move.jar</jar>
  <outfile>C:\jpct\run_test\move_test.exe</outfile>
  <errTitle></errTitle>
  <cmdLine>width=1024 height=768 refresh=0 mipmap</cmdLine>
  <chdir>.</chdir>
  <priority>normal</priority>
  <downloadUrl>http://java.com/download</downloadUrl>
  <supportUrl></supportUrl>
  <customProcName>false</customProcName>
  <stayAlive>false</stayAlive>
  <icon>C:\jpct\Launch4j\demo\SimpleApp\l4j\SimpleApp.ico</icon>
  <classPath>
    <mainClass>MoveTest</mainClass>
    <cp>3rdParty/*.jar</cp>
  </classPath>
  <jre>
    <path>jre</path>
    <minVersion>1.5.0</minVersion>
    <maxVersion></maxVersion>
    <dontUsePrivateJres>false</dontUsePrivateJres>
    <initialHeapSize>256</initialHeapSize>
    <maxHeapSize>256</maxHeapSize>
    <opt>-Djava.library.path=3rdParty</opt>
  </jre>
</launch4jConfig>

hytparadisee

JARMaker is another good option, if you want to distribute jar without a native launcher. If has more than that also (Im not advertising), such as webstart JNLP, applet, and JAR signer, so it's a kind of one-stop solution. I use it to jar third party components that is only distributed in .class files. So hope this helps.

The link

http://www.download.com/JAR-Maker/3000-2417_4-10588877.html

A shot from the internet

Today I finally found a problem to my soluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuution

EgonOlsen

On some setups, the jar-extension isn't correctly linked with javaw. I had this problem myself in the past and i had to edit the properties of the linkage somehow...i just can't remember how. But it's out there somewhere...google knows it.

Melssj5

Thanks a lot. Now I am using JARMAKER and seems to be quite easy but I have problems with the resources as images or another files. The app is being launched but exceptions are thrown (File not found) and things like that? Does the images hace to be outside the jar? The getResource method is always returning null when the app is inside the jar.
Nada por ahora

Melssj5

Solved. I just needed to put ./ as the classpath. now works perfectly, thanks a lot to everyone.
Nada por ahora