Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
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  
  Stupid JAR Question  (Read 1596 times)
0 Members and 1 Guest are viewing this topic.
Offline stefanha

Senior Newbie




I love YaBB 1G - SP1!


« Posted 2003-03-15 15:40:36 »

I can't get JAR files to work with my (applet) game.  I have compiled my game.  The class belong to two packages: com.stefanha.games.boom and com.stefanha.games.util.  Now I want to make one JAR file containing all of the classes (from both packages) plus a directory with graphics (GIF images).

I have managed to make a JAR file, but the paths were absolute paths (as in "C:\My Documents\Boom\").  Can someone explain the process of creating one JAR file containing all my classes and images, and then making an HTML file that starts the applet from the JAR file?

Thanks, Stefan
Offline augusto

Senior Newbie





« Reply #1 - Posted 2003-03-15 20:20:56 »

http://java.sun.com/j2se/1.4/docs/tooldocs/windows/jar.html

How are you creating the jar file?

Anyways, sounds like you need to use the -C option, make it go to the top directory (above your com hirarchy) and then the path should be relative from there.
Offline stefanha

Senior Newbie




I love YaBB 1G - SP1!


« Reply #2 - Posted 2003-03-18 08:23:18 »

Okay, what I've done now, after checking out the -C option, is to just copy all my class files to the same location, and to JAR that.  It works, BUT I'm having trouble accessing the applet.

My HTML file looks like this:
1  
2  
3  
4  
5  
<html>
<body>
<applet archive="Boom.jar" code="Boom.class" width=320 height=200></applet>
</body>
</html>


I get an error - the VM can't load/find the class.  So I guess that means I need to use its full packaged name, com.stefanha.boom.Boom, but that doesn't work either.

What is the correct way to run an applet from a JAR file when it is in a package?

from, Stefan
Games published by our own members! Check 'em out!
Try the Free Demo of Revenge of the Titans
Offline stefanha

Senior Newbie




I love YaBB 1G - SP1!


« Reply #3 - Posted 2003-03-20 14:09:26 »

Somebody please answer: it's so frustrating to have a game ready, but not be able to release it on the internet!

Anyway, if anyone can just describe in general how you can JAR an applet whose class is in a package, and run it from a browser, please answer...

from, Stefan
Offline zparticle

Senior Member




Thick As A Brick


« Reply #4 - Posted 2003-03-20 14:29:39 »

Use a tag simlar to the one below.

1  
2  
3  
4  
5  
6  
7  
                 <APPLET 
                       CODE=scottshaver.menu.GrowMenu
                       codebase="http://www.scottshaver2000.com/files"
                       ARCHIVE=growmenu.jar
                       WIDTH=200
                       HEIGHT=125
                 >


Make sure your classes are in the correct directories inside of the jar. You can do that by opening the jar with WinZip or "jar -t jarfile" I think.

Take a look at the jar file that uses the above tag:

http://www.scottshaver2000.com/files/growmenu.jar

Offline wiesi

Senior Newbie




Java rulez!


« Reply #5 - Posted 2003-05-21 16:48:37 »

or if you don't use the java-plugin you should try "javac -target 1.1 myJavaFile.java"

mfg
wiesi
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #6 - Posted 2003-05-23 15:26:30 »

You didn't specify the package in the code= part of the applet tag.  You said you were using a package so it should read something like code="com.stefanha.games.boom.Boom" I assume.  Note that you don't add the ".class"

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (42 views)
2013-05-17 21:29:12

alaslipknot (51 views)
2013-05-16 21:24:48

gouessej (79 views)
2013-05-16 00:53:38

gouessej (79 views)
2013-05-16 00:17:58

theagentd (87 views)
2013-05-15 15:01:13

theagentd (81 views)
2013-05-15 15:00:54

StreetDoggy (123 views)
2013-05-14 15:56:26

kutucuk (147 views)
2013-05-12 17:10:36

kutucuk (147 views)
2013-05-12 15:36:09

UnluckyDevil (157 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.128 seconds with 22 queries.