Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (116)
games submitted by our members
Games in WIP (563)
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 1967 times)
0 Members and 1 Guest are viewing this topic.
Offline stefanha

Senior Newbie




I love YaBB 1G - SP1!


« Posted 2003-03-15 14: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 19: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 07: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!
Legends of Yore - The Casual Retro Roguelike
Offline stefanha

Senior Newbie




I love YaBB 1G - SP1!


« Reply #3 - Posted 2003-03-20 13: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 13: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 14: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


Exp: 12 years


Where's the Kaboom?


« Reply #6 - Posted 2003-05-23 13: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.

 

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

The first screenshot will be displayed as a thumbnail.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (20 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (28 views)
2014-09-20 20:14:06

BurntPizza (32 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!