• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem running a .jar file

 
karl neumann
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello java ranchers. I developed a java applet in eclipse for the first time which I plan on uploading to my website. The applet runs great within eclipse. However, when I export this project to a jar file and try to run the jar file from a command prompt I get: "no main manifest attribute, in myClass.jar" . After searching many sites for an answer I added the following line to my MANIFEST.MF file: Main-Class: org.eclipse.jdt.myClass .When I run the jar file again I get the same message as before. I am not sure if org.eclipse.jdt is correct. I got this from the .classpath file and it's a guess. When I run the jar file again I get the same message as before. Other observations: the myClass.java source file has no main() or int() method. I don't know if that's relevant or not. I am at my wits end trying to figure this out. Please help!
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello karl and welcome to the Ranch! You need to go through the tutorial trail on Developing and Deploying Java Applets.

Briefly, Applets can't be run with the java -jar command. They normally run in a browser, and can be run in the applet viewer, usually from an IDE.
 
karl neumann
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the advice. I have read the tutorial and I am making progress. I have rewritten much of the source code in eclipse. Once again, the applet runs in eclipse. After having exported the project to a jar file, and creating some html code, I am now running the applet from a .htm file. When running the applet I am getting an AccessControlException: access denied("java.io.FilePermission""myPic.jpg""read"). The .jpg file is included in the jar file.
What now?
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm guessing that your applet tries to read files from the client's system. Applets aren't allowed to do that -- for security reasons -- unless they are signed.

But let me ask: is there a particular reason you are writing an applet, rather than an ordinary Java application? If you're a beginner then it would be better to write an application.
 
karl neumann
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The applet is for my website. Thanks for the sales pitch.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. Then why is your applet trying to read files from the client machine?
 
karl neumann
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my applet: besteartraining.com
spare me the advice please.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. Then do you still have a question? If so, then what is it?
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, as a moderator I'm required to give you advice about certain topics. So I would just like to remind you that this forum has a rule, and that rule is "Be Nice".
 
karl neumann
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your advice to beginners is to refer them to the java api, then don't bother. We can find it on own. If you are the moderator, I don't need your worthless forum. You know what you can do with yourself!
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the best Karl
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic