Exporting .jar Applet in Eclipse
Asked Answered
M

1

5

I have an applet and I can't export it to a runnable jar because it doesn't have a main class( public static void main(String args[]) ) I need a runnable jar because I have a program that has many classes and packages. How do I make this work. If the answer is adding a main method what do I put in the main method?

Update I tried to use a normal .jar but still nothing. Here is a reply i sent to better describe what is happening

"I still get the class not found error. I have a .jar that has a "main" folder. Then in the "main" folder I have all my classes. My main class is Render.class so in html i use this code to open the applet: "

Multistage answered 6/7, 2012 at 0:42 Comment(3)
No, you don't need a runnable jar, if it is meant to just contain a JApplet/Applet. You just need a jar.Budd
Just to verify: You have a Java applet that you want also to be usable just by running the jar?Smearcase
no, I was going to call it from html using... <applet archive="MyJar.jar" code="mainpackage.MainClass" width="800" height="600"> </applet>Multistage
M
7

If it's an applet it isn't a 'runnable jar'. Luckily, you don't need one. You just need an ordinary jar. Eclipse will make one of those.

Moynihan answered 6/7, 2012 at 0:47 Comment(7)
Thank you I'll try that. but can I use the code <applet archive="MyJar.jar" code="mainpackage.MainClass" width="800" height="600"> </applet>Multistage
I still get the class not found error. I have a .jar that has a "main" folder. Then in the "main" folder I have all my classes. My main class is Render.class so in html i use this code to open the applet: <applet archive="superminer.jar" code="main.Render.class" width="800" height="600"></applet>Multistage
classes don't belong in a 'main' folder. They belong in the directory corresponding to their package name, or in the very top if they have no package.Moynihan
Why 'main.Render.class' and not 'main.Render'?Moynihan
idk I'll try that and see if it works. Sorry to keep you busy :PMultistage
let us continue this discussion in chatMultistage
Can you update your answer to include where the jar file will be located?Appropriate

© 2022 - 2024 — McMap. All rights reserved.