Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Problem Running htm With Java on Mac OSX(Unable to run htm pages)
Problem Running htm With Java on Mac OSX [message #990982] Sun, 16 December 2012 05:51 Go to next message
Andrew Adams is currently offline Andrew Adams
Messages: 2
Registered: December 2012
Junior Member
Hi everybody,

I have been attempting to enter into Java coding and just got eclipse. To start off with I have used the following code inside a .htm file:

<head>
<title>My First Page</title>
<script type = "text/javascript">

function yetAnotherAlert(textToAlert){
alert(textToAlert;
}
yetAnotherAlert("This is Chapter 2");

</script>
</head>
<body>

</body>
</html>

However, this code does not run. If I open the file in Finder it just displays the page title but no javascript runs at all!

I have set up the environment exactly as the PDF instructions lay out, but still nothing happens. However, it seems to be a wider issue because even when I try to run it out of the Eclipse workspace (ie independent file on Safari) the java doesn't run.

Is there something wrong with Java on my system? Why will this simple thing not run?

I would be really grateful for some help!
Re: Problem Running htm With Java on Mac OSX [message #991037 is a reply to message #990982] Mon, 17 December 2012 02:26 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5296
Registered: July 2009
Senior Member
What you show us here is HTML+JavaScript which has nothing todo with
Java! You can only open this HTML inside a Browser like Firefox, Safari,
Chrome, ... .

Tom

Am 16.12.12 21:00, schrieb Andrew Adams:
> Hi everybody,
>
> I have been attempting to enter into Java coding and just got eclipse.
> To start off with I have used the following code inside a .htm file:
>
> <head>
> <title>My First Page</title>
> <script type = "text/javascript">
>
> function yetAnotherAlert(textToAlert){
> alert(textToAlert;
> }
> yetAnotherAlert("This is Chapter 2");
>
> </script>
> </head>
> <body>
>
> </body>
> </html>
>
> However, this code does not run. If I open the file in Finder it just
> displays the page title but no javascript runs at all!
>
> I have set up the environment exactly as the PDF instructions lay out,
> but still nothing happens. However, it seems to be a wider issue because
> even when I try to run it out of the Eclipse workspace (ie independent
> file on Safari) the java doesn't run.
>
> Is there something wrong with Java on my system? Why will this simple
> thing not run?
>
> I would be really grateful for some help!
Re: Problem Running htm With Java on Mac OSX [message #991168 is a reply to message #990982] Mon, 17 December 2012 10:27 Go to previous messageGo to next message
Michael Rennie is currently offline Michael Rennie
Messages: 65
Registered: July 2009
Location: Canada
Member
If your code snippet is a direct copy from the file you are trying to 'run' then you are missing a ')'.

alert(textToAlert;

should be

alert(textToAlert);
Re: Problem Running htm With Java on Mac OSX [message #991244 is a reply to message #991168] Mon, 17 December 2012 20:21 Go to previous messageGo to next message
Andrew Adams is currently offline Andrew Adams
Messages: 2
Registered: December 2012
Junior Member
Ah! You're kidding!

I'm all very new to this Java thing and the one thing that gets me is the syntax. Something missing here and there that I never really notice! That solved that one!

I also found that my Mac actually did not have Java installed for some obscure reason, so that's another reason why stuff was not working in the browser.

Thanks!!
Re: Problem Running htm With Java on Mac OSX [message #991247 is a reply to message #991244] Mon, 17 December 2012 21:46 Go to previous message
David Wegener is currently offline David Wegener
Messages: 1336
Registered: July 2009
Senior Member
On 12/17/2012 07:21 PM, Andrew Adams wrote:
> Ah! You're kidding!
>
> I'm all very new to this Java thing and the one thing that gets me is
> the syntax. Something missing here and there that I never really notice!
> That solved that one!
>
> I also found that my Mac actually did not have Java installed for some
> obscure reason, so that's another reason why stuff was not working in
> the browser.
>
> Thanks!!
You still seem to be confusing Java with Java Script. They are two
completely different languages. The source code you provided is Java
Script.
Previous Topic:groovy.eclipse usage in RCP application
Next Topic:Eclipse Ant and cvs problem
Goto Forum:
  


Current Time: Mon Sep 01 10:03:08 EDT 2014

Powered by FUDForum. Page generated in 0.02217 seconds