Jump to content

Eclipse PHP

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
xXAlphaXx

xXAlphaXx

    Learning Programmer

  • Members
  • PipPipPip
  • 85 posts
So I use Eclipse for both PHP and Java as it highlights the errors that you would otherwise would never know were there

Anyways, I believe I am having some sort of issue with switching from the JDK too what ever is needed for PHP. They are two new languages I am learning at once.

Anyways: Heres the code and error list:


<html>

<head>

<title>

If...Loop etc.

</title>

</head>

<body>

<?php

$number = 5;


if ($number < 10)

{

	echo "5 is lesser than 10";

}


?>

<br><br>


<?php echo "The following statemnet is based on your time, it will either greet you with good morning, good afternoon, or good evening"; ?>

<br><br>


<?php


$hour = date("H");


if ($hour < 12)

	echo "Good Morning!";

else ($hour < 17)

	echo "Good afternoon!";

elseif

	echo "zZz! Good night!";


?>


<br><br><br><br>


<?php


if ($number <= 5 and >= 10)

	echo = "Number is between 5 and 10";

else

	echo = "Number is not between 5 and 10";

	

?>


</body>

</html>

	





The project cannot be built until build path errors are resolved	Ex4_10		Unknown	Java Problem


Unbound classpath container: 'JRE System Library [JavaSE-1.6]' in project 'Ex4_1'	Ex4_1		Build path	Build Path Problem


Unbound classpath container: 'JRE System Library [JavaSE-1.6]' in project 'Ex4_10'	Ex4_10		Build path	Build Path Problem




#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
Try going into Eclipses project properties -> Java Build Path -> Libraries, Remove and Add Library. remove the default JDK (Or javaSE in this case I believe) path and add the correct path to your JDK/JSE library. I had read around and this only seems to be a problem when you import a project with a different library, or configure the execution enviornment to another version than what you have.

Also a humble suggestion, try to always bracket IF/ELSE statements, I had seen too many errors caused by people confusing themselves in larger projects!
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
xXAlphaXx

xXAlphaXx

    Learning Programmer

  • Members
  • PipPipPip
  • 85 posts
I don't have a Java build path in my project properties, I do have a PHP Build path.

This is on Mac OSX so I am a little clueless as too where the, I guess, "PHP SDK" is at.

#4
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
PHP only requires an interpreter (no library or SDK) which should be provided by you, or included with Eclipse, I had not used PHP Eclipse and I cannot find anything on the web on the problem so I am not sure. Go ahead an create a new project, make one hundred percent sure your project settings have nothing to do with JDK/JavaSE, it may be an underlaying problem in your configuration, that is all I can think of.

Your IDE is just complaining the path to JavaSE cannot be found, you're not using that so I'm not sure where it would come from.

Another suggestion, if you cannot fix it then why not just use Eclipse to edit your file, and view the output in another console/or browser under XAMPP? PHP was not really meant to be run only under command line, you can't "compile it", so you may as well not do anything other than edit with the IDE.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#5
xXAlphaXx

xXAlphaXx

    Learning Programmer

  • Members
  • PipPipPip
  • 85 posts
I am using Eclipse too edit and save the file, I was using Eclipse because it is the only PHP capable program that highlights my errors as I am still learning.

Anyways, I have fixed it now where it is now working in "PHP mode" I guess and it's not giving me the JRE error anymore. But, now my Java projects cannot find JRE.

Hit and a miss or what?