Author Topic: Problems creating an executable jar  (Read 3501 times)

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Problems creating an executable jar
« on: May 17, 2007, 05:38:05 pm »
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

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Re: Problems creating an executable jar
« Reply #1 on: May 17, 2007, 05:48:05 pm »
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

Offline ToddMcF2002

  • long
  • ***
  • Posts: 103
    • View Profile
Re: Problems creating an executable jar
« Reply #2 on: May 18, 2007, 12:02:31 am »
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.




Offline ToddMcF2002

  • long
  • ***
  • Posts: 103
    • View Profile
Re: Problems creating an executable jar
« Reply #3 on: May 18, 2007, 02:55:18 am »
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 ;)
 

Code: [Select]
<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>

Offline hytparadisee

  • int
  • **
  • Posts: 86
    • View Profile
    • http://peterhi.com
Re: Problems creating an executable jar
« Reply #4 on: May 18, 2007, 05:52:35 am »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Problems creating an executable jar
« Reply #5 on: May 18, 2007, 04:45:31 pm »
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.

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Re: Problems creating an executable jar
« Reply #6 on: May 18, 2007, 10:33:55 pm »
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

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Re: Problems creating an executable jar
« Reply #7 on: May 18, 2007, 10:38:22 pm »
Solved. I just needed to put ./ as the classpath. now works perfectly, thanks a lot to everyone.
Nada por ahora