java question --.jar file [Archive] - ForumsHQ

Post Reply
Raybdbomb
Posts: 0
Joined: Wed Mar 21, 2001 6:00 am

java question --.jar file [Archive] - ForumsHQ

Post by Raybdbomb »

I have a question....



I have a java file that I compiled and created a jar file with. Now I heard that if you don't have a program defined to open jar files (which winrar is) then it's supposed to open java web start or something and view the .class file within the .jar file. Does anyone know how to do this if .jar files are set to open with winrar?
Raybdbomb
Posts: 0
Joined: Wed Mar 21, 2001 6:00 am

Re: java question --.jar file [Archive] - ForumsHQ

Post by Raybdbomb »

hrmm... found somethin, i'll try this tonight



save this as a .reg file and run it to import to registry

Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\jarfile]@="Executable Jar File"[HKEY_CLASSES_ROOT\jarfile\shell][HKEY_CLASSES_ROOT\jarfile\shell\open][HKEY_CLASSES_ROOT\jarfile\shell\open\command]@="\"C:\\WINDOWS\\Java\\JRE1.4.2\\bin\\javaw.exe\" -jar \"%1\" %*"
EvanElias
Posts: 0
Joined: Mon Jul 05, 2010 12:42 am

Re: java question --.jar file [Archive] - ForumsHQ

Post by EvanElias »

Now I heard that if you don't have a program defined to open jar files (which winrar is) then it's supposed to open java web start or something and view the .class file within the .jar file.



Not sure what you mean by "view the class file"... class files are compiled code, can't really view their innards (unless you use a java decompiler... altho on an interesting note, there's some AMAZING java decompilers out there which spit out some very readable code)



AFAIK, jar files are just zips, so you can open them with winzip, winrar, etc. The only difference is that they usually always contain some files like the manifest file which helps the JVM figure out whats in the file.



Then there's also war files, that's just a jar (and hence a zip) used for java servlets.



Why all the silly extensions? Who knows, Sun is screwy with specs on stuff like that
Raybdbomb
Posts: 0
Joined: Wed Mar 21, 2001 6:00 am

Re: java question --.jar file [Archive] - ForumsHQ

Post by Raybdbomb »

yes, but with most java IDEs you can make a collection of the .class files (and there's an option to include the source as well) and put 'em into a .jar file which is normally executable, and simply locates the main .class file within the .jar file and runs it with java web start i think... i'mma try it right now
Raybdbomb
Posts: 0
Joined: Wed Mar 21, 2001 6:00 am

Re: java question --.jar file [Archive] - ForumsHQ

Post by Raybdbomb »

check this out... unzip it to a .jar file which is a simple crappy calculator i started for one of my assignments, yet didn't finish. so anyway check it out, it's executable, if you do the .reg file from above.



i tried an applet though, and there was an error, so maybe it only works for applications
EvanElias
Posts: 0
Joined: Mon Jul 05, 2010 12:42 am

Re: java question --.jar file [Archive] - ForumsHQ

Post by EvanElias »

check this out... unzip it to a .jar file which is a simple crappy calculator i started for one of my assignments, yet didn't finish. so anyway check it out, it's executable, if you do the .reg file from above.



i tried an applet though, and there was an error, so maybe it only works for applications



Well, it's executable if you already have java installed... cant really rely on that in general though, if its a program you want to distribute:P



Basically all that reg file change does is associate jar's with "javaw.exe -jar"... thats basically the non-console equivalent of doing "java.exe -jar ..." from the command line.



It won't work with applets since they need appletview to run locally (ie, without a web page). You CAN use jars in a web page though, IIRC you just specificy a jar file instead of a class file in your applet tags (or object/embed tags if you want install-on-demand for the jvm)
Raybdbomb
Posts: 0
Joined: Wed Mar 21, 2001 6:00 am

Re: java question --.jar file [Archive] - ForumsHQ

Post by Raybdbomb »

::nods::
NIN

Re: java question --.jar file [Archive] - ForumsHQ

Post by NIN »

nobody wants to see your dumb program :sucks:
Raybdbomb
Posts: 0
Joined: Wed Mar 21, 2001 6:00 am

Re: java question --.jar file [Archive] - ForumsHQ

Post by Raybdbomb »

nin where teh crap have you been, hit me up on aim you faj
Post Reply

Return to “Programming, web design & Graphics”