Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Problem running a .jar file

 
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!
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • 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?
 
Marshal
Posts: 25598
69
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
Marshal
Posts: 25598
69
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
Marshal
Posts: 25598
69
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
Marshal
Posts: 25598
69
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!
 
Bartender
Posts: 1051
5
Hibernate Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the best Karl
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic