Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to launch appletviewer in jcreator and zip files using winzip

 
Lucia Gonzales
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there!
I have a problem executing my applets after I have zipped them
with winzip. My applets run perfectly in the IDE but not as zipped files in winzip. My process for creating applets in jcreator is as follows: 1)New project --> Basic Java applet 2)
New File --> Java File. My applet then runs with the appletviewer after hitting the execute project button. I don't create an html file since jcreator automatically creates one. When I zip up my files w/ winzip, I don't get the excute project button , only the execute file so I cannot follow the same process as in the IDE for executing my applet. Even when I excute file on the html file, I still can't get my applet to run.
Is there something wrong with my process of creating applets ? Is there a better way? I'm sorry if my explanations are not very
concise, but I am new to java.
Thanks,
Lucia
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're preparing applications for general use, I don't know that AppletViewer is going to be installed on their machines, and it's probably not the best way to go anyway. For standalone use, what you really want is a Java application, not an applet. Applets are intended to be run from within a user's web browser, where they have much less freedom to access local system resources than applications do.
Trying to make an applet or application an executable ZIP file is also a problem, since you need the Java Runtime Environment, which is often many times larger than your application itself.
Finally, ZIP isn't even the best way to package the application. The Java JAR file format is an extended ZIP format. The file extension is .jar instead of .ZIP, and it contains a manifest file that describes its contents. Among other things, you can specify the main class for an executable JAR.
You can do magic with the OS (Windows Registry or whatever) that will make JARs executable when clicked or specified from the command prompt, or you can just make up a quick batchfile, such as:
REM Sample to execute a jar
java -jar myjavaprogram.jar com.mydomain.MainClass
Which can be reduced in many cases to:
REM Sample to execute a jar
java -jar myjavaprogram.jar
By supplying the main class name in the META-INF/MANIFEST.MF file.
Possibly you could make an executable ZIP that would run the batch command and stand in for the JAR, but I haven't tried it, so I can make no promises.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic