sigh

Can you post your Manifest?

Looks something like this right now, note that main is located in Test2D.java

Manifest-Version: 1.0
Class-Path: …lwjgl.jar
Main-Class: Test2D


Manifest-Version: 1.0
Class-Path: ..lwjgl.jar
Main-Class: Test2D

Hmm… messy. Are you trying to get the lwjgl in the current directory or the parent directory? If it’s the later, you need “…/lwjgl.jar” otherwise “lwjgl.jar” will work fine. Try this:


Main-Class: Test2D
Class-Path: lwjgl.jar

Remember to have an extra blank line at the end of the manifest file and no extra spaces in front of the manifest entries.

…already tried that, it looks like that because i was copying someone elses to see if it worked.

I tried it again just for fun and it still didnt work.

Edit: all the files are in the same directory

Edit: do you use eclipse jbanes?

Tell you what, generate a JAR using the manifest I gave you, then email the JAR to jbanes@techie.com. I’ll take a look at it and see what I find.

This is really sad, I know it’s something freaking STUPID too. I could prolly figure this out if I wasn’t being pulled in 8 different directions in rl atm.

Sorry if I break out laughing at some point, but I think you need to stop using Eclipse to make JAR files. I got the file through email and proceded to attempt running it. As expected, it didn’t run. So I’m thinking “I’ll check out what’s in the manifest”. I do “jar -xvf Test2D.jar META-INF” and open the META-INF/MANIFEST.MF. Man was I in for a shock. It was blank! I do a double take and then type “jar -tvf Test2D.jar”. This is what I see:


     2 Wed May 14 15:28:58 CDT 2003 META-INF/MANIFEST.MF
   311 Tue May 13 14:09:02 CDT 2003 .classpath
   382 Tue May 13 14:07:50 CDT 2003 .project
    43 Wed May 14 15:28:50 CDT 2003 Manifest.mf
  4487 Wed May 14 10:08:58 CDT 2003 Test2D.class
 34169 Sat Nov 18 05:55:34 CST 2000 nehe.png

Hmm… That’s not right. The manifest was included as a normal file. Here’s what you need to do to make this work:

  1. Open a command line window
  2. Go to the directory with your files
  3. Type “jar -cvmf Manifest.mf Test2D.jar Test2D.class nehe.png”

This will tell the “jar” command to “[c]reate” a new JAR, be “[v}erbose” about what’s going on, use the “[m]anifest” Manifest.mf, and operate on the jar “[f]ile” named Test2D.jar. All other parameters are the files to pack. Note that the order of the parameters matter. If you specify “-cvmf” you must then have “Manifest.mf Test2D.jar”. If you instead specify “-cvfm”, you must then have “Test2D.jar Manifest.mf”. There you go. That should solve your headaches.

Blank?

So, this is basically broken in eclipse? Why would they ask for a custom manifest and then not use it? Must be a feature.

Edit: I freaking hate command line tools. Yes CVS, that means YOU. :stuck_out_tongue:

It never ends. Now it can’t find my frickin .png. (->javax.imageio.IIOException: Can’t read input file!)Excuse me while I do perforate my chest with a fork. I’m sure I can figure that one out though, god knows I need to do something for myself at least once today.

At least the manifest works. :stuck_out_tongue: I’m gonna have rediculous batch files full of command line operations just like when I use to code with TextPad! woo! Thinking back, that’s probably where my hatred comes from.

In hindsight I should have prolly just done what you said origionally, especially since you were trying to help me, but I made the mistake of trusting someone elses software. :stuck_out_tongue:

Anyways, thanks for the help guys.

I freaking hate command line tools. Yes CVS, that means YOU.

Hmm… I think you need to get out more. ;D

I’m just bitching cause yesterday I wanted to look at someones (i wont name names) code on sourceforge and i just wanted to get on and grab it as fast as possible.

If I was going to use it more then once then I would peek around. I should just use it anyways, just to learn some amount of source control, interesting thought. Mabey when I can get a Jar file to work properly I’ll look into it.

coughcascoughspglcough

:slight_smile:

Sourceforge, eh? Yeah, they’re loads of fun when you’re working on a project. For quick and easy checkout tho, it really isn’t too bad. Let me show you some voodoo:

  1. Go to http://www.cygwin.com, download cygwin and install.

  2. Run cygwin

  3. If you don’t have a c:\temp folder, create it with the following command at the “bash$” prompt:

bash$ mkdir /cygdrive/c/temp

  1. Create c:\temp\spgl and change to that directory::

bash$ mkdir /cygdrive/c/temp/spgl
bash$ cd /cygdrive/c/temp/spgl

  1. Now for the fun part. Perform the following commands. These are the ones from the sf pages, more or less verbatim:

bash$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/spgl login
password: (press enter without entering anything)
bash$ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/spgl co .

You’ll note the “.” after the co (short for checkout). This means “get me everything”. Literally it means “the current directory” as in “cd .”. So replacing “.” with “spgl-tools” would get you only the spgl tools.

BTW, if you find yourself working with SF a lot, I highly recommend getting TortoiseCVS.

Oh, I should have implied I got it working.

It’s just I wanted it 5 minutes ago and I had to read text files and webpages to figure out how to install (my install.txt seemed to be MIA on the version I dwnloaded) and get the code. SF acually had a nice explaination of the login portion you just mentioned.

To d/l, install, and grab the code, it took me about 20 minutes. But I was highly annoyed at the time. :stuck_out_tongue:

Ok I don’t get it.

This is what I’m doing now. I have a batch file that looks like this:

jar -cvmf MANIFEST.MF Test2D.jar Test2D.class nehe.png
del c:\Test2D\Test2D.jar
move Test2D.jar c:\Test2D\

and a manifest file that looks like this:

Main-Class: Test2D
Class-Path: lwjgl.jar

and my program can’t find the nehe.png when I tried to new File( “nehe.png” ); So now it’s finding the jar, yay, but why can’t it find an image in the current directory?

For fun I checked the eclipse page and there was a new version. Telling eclipse to use a custom manifest from the workspace and giving it

Manifest-Version: 1.0
Main-Class: Test2D
Class-Path: lwjgl.jar
(newline)
(newline)

seems to work like doing it by the commandline. Now, I dunno if this would have worked in the old version or not, it might do something silly (which now it acually looks like thats what it was) like require that first line with the version etc otherwise it generates one with JUST the version.

It still doesn’t find my .png though. :slight_smile:

This is how I load my images in an jar file


         URL url = YOURCLASSNAME.class.getResource("nehe.png");

         Image tempImage = null;
         if (url == null)
                  // Load image from file.
                  tempImage = new ImageIcon(filename).getImage();
            else
                  // Load image from URL
                  tempImage = new ImageIcon(url).getImage();


Change YOURCLASSNAME to the name of the class you are using this code in.

I wasn’t aware that using a URL would matter.

URL url = Test2D.class.getResource( path );
Image image = ImageIO.read( url );

These 2 lines appear to work just fine, thanks.

Now I need to find a way to kill this thread, it’s embarassing. :stuck_out_tongue:

LOL… well it starting to get quite large… ;D

Psiegel: what’s wrong with -Djava.librarypath= on linux?

  • elias

Hmm, I had to go back and reread my original post on this very issue:

http://www.java-gaming.org/cgi-bin/JGOForums/YaBB.cgi?board=LWJGL;action=display;num=1051537039;start=0

It looks like the only problem with that was that I was using 0.5. I’ll have to go back and re-test with 0.6. Unfortunately right now other work is keeping me stuck in Windows land.

By the by, call me Paul.

-Paul