Skip to main content


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 10:51 Go to next message
Andrew Adams is currently offline Andrew AdamsFriend
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 07:26 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
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 15:27 Go to previous messageGo to next message
Michael Rennie is currently offline Michael RennieFriend
Messages: 67
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] Tue, 18 December 2012 01:21 Go to previous messageGo to next message
Andrew Adams is currently offline Andrew AdamsFriend
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] Tue, 18 December 2012 02:46 Go to previous message
David Wegener is currently offline David WegenerFriend
Messages: 1445
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: Thu Apr 25 18:54:03 GMT 2024

Powered by FUDForum. Page generated in 0.03062 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top