Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (577)
games submitted by our members
Games in WIP (498)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  How to make a batch file for my app?  (Read 2571 times)
0 Members and 1 Guest are viewing this topic.
Offline preshel

Senior Newbie





« Posted 2007-02-10 21:32:20 »

Ok, I've made my java LWJGL application, its all in some .java files, and all is compiled and working.

What to do next?
How can i send it to my friends, and make it work at their home? (i just want them to run it , not compile it or anything...).
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #1 - Posted 2007-02-11 10:38:15 »

The nicest option would be webstart. Check this basic tutorial:
http://www.cokeandcode.com/webstarthowto

Other than that... well, you could throw everything into one zip, with the native libs at the root with a bat file like:
java -classpath .;jinput.jar;lwjgl.jar;[etc];bla.jar your.main.Thingy
pause

Or with the native libs in a sub dir and -Djava.library.path="whatever". But it's Windows only then and less comfy then webstart.

弾幕 ☆ @mahonnaiseblog
Offline Kova

Senior Member





« Reply #2 - Posted 2007-02-11 11:40:26 »

If they have Java installed, you only need to make a .jar file and they can run it like executable. When they double click on it, it will run. How to make a .jar file, you'll have to find out for yourself, it isn't hard.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2007-02-11 16:16:39 »

Don't rely on that, several compression-apps are know to hijack *.jar

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline preshel

Senior Newbie





« Reply #4 - Posted 2007-02-11 17:07:46 »

The nicest option would be webstart. Check this basic tutorial:
http://www.cokeandcode.com/webstarthowto

Other than that... well, you could throw everything into one zip, with the native libs at the root with a bat file like:
java -classpath .;jinput.jar;lwjgl.jar;[etc];bla.jar your.main.Thingy
pause

Or with the native libs in a sub dir and -Djava.library.path="whatever". But it's Windows only then and less comfy then webstart.

"java -classpath .;jinput.jar;lwjgl.jar;[etc];bla.jar your.main.Thingy" - I dont understand that.
lets say I have the following project:
the main java file "project1.java" (LWJGL based) in  "c:\java project\project1\"
and one jpg file in "c:\java project\project1\data\"

how would the batch file look like?...
thanks.
Offline Kova

Senior Member





« Reply #5 - Posted 2007-02-11 18:59:24 »

Don't rely on that, several compression-apps are know to hijack *.jar

And I hate them all...
.jar file is meant to be a executable as I figured out, you should use it as such. Zip thing is only way of storage. If another application hijacks .jar extension, I would uninstall / blame it for that. Even if some app hijackes .jar, in windows you can always right click > open with > JRE, and in the process make JRE default for opening .jaf files, (but that requires open with > choose program > select JRE and check checkbox at the bottom).
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #6 - Posted 2007-02-11 20:01:12 »

The extension hijacking thing is a right pain. Webstart sometimes suffers from the same issue, as browsers may or may not prompt the user to save the .jnlp instead of open it directly (although this is less bad, as the saved jnlp is double-click-able).

Personally I quite like JSmooth for getting around the issue. Makes it dead easy to create a tiny little exe (complete with icon) that is gurantteed to be double-click-able and looks just like a native app. (Mac users don't usually get the zip extension hijacked, and webstart seems to work fine out of the box. Likewise for linux people).

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline preshel

Senior Newbie





« Reply #7 - Posted 2007-02-11 20:08:15 »

ok, i thanks all, i have 2 more questions -

1) according to what i specified before, how can i create a jar file from my app?
2) does JSmooth works flawlessly with LWJGL apps? does it make it slower in any way?
Offline Kova

Senior Member





« Reply #8 - Posted 2007-02-11 20:56:53 »

http://java.sun.com/docs/books/tutorial/deployment/jar/
Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #9 - Posted 2007-02-11 22:50:39 »

I've used JSmooth fine with LWJGL, all you have to remember to do is set the java.library.path argument in the JVM configuration section. Performance is unaffected, all it does is provide a handy way of launching the app.

Probably best to get it working with jars and the command line first though, then it'll be easier to do a webstart / JSmooth version.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline preshel

Senior Newbie





« Reply #10 - Posted 2007-02-12 12:11:52 »


I, i tired it, but i got a "noclassdeffounderror" on all my LWJGL libraries.

they are stored in "C:\Java Libraries\lwjgl-1.0-rc1\"

how can i add them to my jar file?
Offline Kova

Senior Member





« Reply #11 - Posted 2007-02-12 12:50:06 »

ah the pain...  use a manifest file, it's nicer way to create jars with manifest. Put your LWJGL jar into your jar file like any other file.
Then you need to add class path argument into manifest file to your LWJGL jar file.

This is example how I did it when I worked with jdbc driver:


------------------------------------------------------------
manifest.mf:
Main-Class: viktorije.Viktorije
Class-Path: mysql-connector-java-3.1.12-bin.jar
... I think you need new line after last entery for it to work, check jar tutorial
------------------------------------------------------------
command line:
jar -cfmv viktorije.jar manifest.mf "mysql-connector-java-3.1.12-bin.jar" "viktorije" "images"
.... this uses manifest.mf file, adds msyql... .jar, adds viktorije dir and adds images dir, all into newly created viktorije.jar
about -cfmv you can all read in jar tutorial

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 605
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #12 - Posted 2007-02-12 14:34:57 »

And I hate them all...
.jar file is meant to be a executable as I figured out, you should use it as such. Zip thing is only way of storage. If another application hijacks .jar extension, I would uninstall / blame it for that. Even if some app hijackes .jar, in windows you can always right click > open with > JRE, and in the process make JRE default for opening .jaf files, (but that requires open with > choose program > select JRE and check checkbox at the bottom).

Would you explain that to your users? Guess not. If you did, they wouldn't understand. Users are ignorant.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline preshel

Senior Newbie





« Reply #13 - Posted 2007-02-12 19:00:59 »

ah the pain...  use a manifest file, it's nicer way to create jars with manifest. Put your LWJGL jar into your jar file like any other file.
Then you need to add class path argument into manifest file to your LWJGL jar file.

This is example how I did it when I worked with jdbc driver:

Ok, I did something else, and it worked , but now i have a totally new bug
i have a "java.lang.NoClassDefFoundError" on one of my package classes.
the package is defined as a class path in my manifest file as:

Class-Path: myUtilities

the app crashes when i try to call one of myUtilities classes from my main class.

what can it be?

Offline Kova

Senior Member





« Reply #14 - Posted 2007-02-12 19:25:50 »

Would you explain that to your users? Guess not. If you did, they wouldn't understand. Users are ignorant.

Actually yes I would, It's only a sentence or two in FAQ:
Q: My app dosen't run when I click on it but WinZip/WinRar/some_other_compression_app opens it and displays it's contents
A: Uninstall that compression app OR right click on .jar, go to open with, choose program, select Java Runtime SE, check "I want always to open this with...", click ok.
Explanation: Who's fault is it? The compression app becouse...

Anyway I would stick to standards instead of letting other application pushing me around... On the other hand I didn't released anything serious yet so I'm yet about to see hell Smiley

Ok, I did something else, and it worked , but now i have a totally new bug
i have a "java.lang.NoClassDefFoundError" on one of my package classes.
the package is defined as a class path in my manifest file as:

Class-Path: myUtilities

the app crashes when i try to call one of myUtilities classes from my main class.

what can it be?


so myUtilities is a package? According to java tutorial, you can only point to classes or jar files, guess that doesn't include packages:
Quote from: java tutorial
The Class-Path header points to classes or JAR files on the local network...
So you can create a myUtilities.jar with myUtilities package and put it into your .jar file, then add myUtilities.jar to Class-Path.

Offline preshel

Senior Newbie





« Reply #15 - Posted 2007-02-12 23:26:17 »

Isn't jar a package?

anyway, i pushed all the class files of myUtilities package into a jar file, and i've included it in the main jar file.
still doesn't work.

im TOTALLY lost.

my app is very light weight... maybe i can send it to someone who is ready to make a batch file?
i guess that i'll learn the rest by myself...

I can also describe the structure of my files etc., if it will do any good.

Offline Orangy Tang

JGO Kernel


Medals: 51
Projects: 11


Monkey for a head


« Reply #16 - Posted 2007-02-12 23:34:25 »

Actually yes I would, It's only a sentence or two in FAQ:

Yeah, but your players won't read your faq. As soon as they see a game without anything obvious to start it they'll already have dismissed it as broken and wandered off.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Kova

Senior Member





« Reply #17 - Posted 2007-02-13 00:53:52 »

Yeah, but your players won't read your faq. As soon as they see a game without anything obvious to start it they'll already have dismissed it as broken and wandered off.

too bad for them... I wont try to fix the world because of this. Anyway If I ever make a serious game that I want to sell, I guess it will come with an installer, and then installer could restore .jar association to JRE if needed. Or even .exe that would run that .jar. ... No point of discussing it now since I'm not even close to selling anything.
Offline Kova

Senior Member





« Reply #18 - Posted 2007-02-13 01:04:16 »

Isn't jar a package?

honestly ... I don't know Smiley

anyway, i pushed all the class files of myUtilities package into a jar file, and i've included it in the main jar file.
still doesn't work.

im TOTALLY lost.

my app is very light weight... maybe i can send it to someone who is ready to make a batch file?
i guess that i'll learn the rest by myself...

I can also describe the structure of my files etc., if it will do any good.

structure would be very good. I'm interested why this thing doesn't work so if you want you can send your app to me and I will try to make a jar file. kova1337(funnyA)gmail.com
Offline preshel

Senior Newbie





« Reply #19 - Posted 2007-02-13 20:58:57 »

honestly ... I don't know Smiley

structure would be very good. I'm interested why this thing doesn't work so if you want you can send your app to me and I will try to make a jar file. kova1337(funnyA)gmail.com

Thanks. I mailed u all the info needed, and all the files.

BTW - i tried to use JSMOOTH, but i could not get it to work anyway.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (22 views)
2014-04-15 18:08:23

BurntPizza (17 views)
2014-04-15 03:46:01

UprightPath (31 views)
2014-04-14 17:39:50

UprightPath (15 views)
2014-04-14 17:35:47

Porlus (31 views)
2014-04-14 15:48:38

tom_mai78101 (57 views)
2014-04-10 04:04:31

BurntPizza (114 views)
2014-04-08 23:06:04

tom_mai78101 (214 views)
2014-04-05 13:34:39

trollwarrior1 (182 views)
2014-04-04 12:06:45

CJLetsGame (189 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!