Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Java applets

 
Greenhorn
Posts: 24
Android Safari Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
We started at school learning java applets... and the teacher gave us a simple excercise but.... it doesn't run... I wonder what it could be wrong...
In java applets we need 2 files is that correct? 1 java file and 1 html file.. isn't it?
Here are the codes....
This is the java file

And the html file is:


So what it would be wrong?
 
Marshal
Posts: 69785
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And how are you executing that code? What instructions are you giving at the command line? We need more information than “it doesn't run”.
 
Penny Papa
Greenhorn
Posts: 24
Android Safari Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:And how are you executing that code? What instructions are you giving at the command line? We need more information than “it doesn't run”.



Oh have to run it in a browser but all the browsers I used are blocking my java..
I tried to run the program in command line, but my teacher said he wants to run it in a browser..
 
Campbell Ritchie
Marshal
Posts: 69785
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by running it from the command line. And tell us the instructions you are using.

There are a lot of security issues relating to applets, so many people regard them as obsolete. You would have to alter the options on your browser to permit Java applets temporarily.
 
Rancher
Posts: 4614
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Start by running it from the command line. And tell us the instructions you are using.

There are a lot of security issues relating to applets, so many people regard them as obsolete. You would have to alter the options on your browser to permit Java applets temporarily.



Applets in general may or may not be obsolete, by I would think Applets most definitely are...
 
Penny Papa
Greenhorn
Posts: 24
Android Safari Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Start by running it from the command line. And tell us the instructions you are using.

There are a lot of security issues relating to applets, so many people regard them as obsolete. You would have to alter the options on your browser to permit Java applets temporarily.



First I'm typing in command line the order:
javac HelloApplet.java

and it's just what I need, and it works fine to this stage.
But when I'm opening any, any browser I receive an error that my java is blocked by the browser. Really I tried this again at school and didn't work... maybe I have to put some java plugins to my browsers?
So anytime I'm making java I won't see it to my browser I'm afraid...
 
Bartender
Posts: 3995
156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Penny,

just ask your teacher how to get an applet running in todays browsers. That is not
something you should be able to do.

And secondly it is not so easy to adapt the code of an applet so that you can
run it from the command line and seeing something on your screen.. Well,
not unless you know something about jframes and jpanels.

So, go to your teacher, is my advice.

Greetz,
Piet
 
Penny Papa
Greenhorn
Posts: 24
Android Safari Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Piet Souris wrote:Hi Penny,

just ask your teacher how to get an applet running in todays browsers. That is not
something you should be able to do.

And secondly it is not so easy to adapt the code of an applet so that you can
run it from the command line and seeing something on your screen.. Well,
not unless you know something about jframes and jpanels.

So, go to your teacher, is my advice.

Greetz,
Piet



Thank you Piet! ;)
 
Greenhorn
Posts: 14
Eclipse IDE Firefox Browser Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try



without .class extension
 
When you have exhausted all possibilities, remember this: you haven't - Edison. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic