setting the path.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
shehan31
Forum Commoner
Posts: 59
Joined: Sun Aug 29, 2010 5:24 am

setting the path.

Post by shehan31 »

Hi all;
I am thinking about to use an IDE instead of the conventional note pad for java scripts. So I have tried two. one is Code Lobster and the other one is adobe dreamweaver. After finishing the code I have saved it as .js rather .java. Then i run it by prssing f5. It gives me a message as "the path must starts with C:\wamp\www". Can any one help me how to use one of these IDE's for java. If you know about any other IDEs which can be used for java please let me know.
Regards
Shehan
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: setting the path.

Post by Jonah Bron »

First, there's a huge distinction between Javascript and Java. They are so different that it's not even funny. Never call Javascript Java script or Java. Javascript is one word. And never give a Javascript file the extension of .java. Always .js.

Second. Under normal circumstances, you cannot just run a JS file. You need to put it into an HTML file and run it there. This is reasonably because 99% of the time, that's where you're using JS. If you really want to run JS code outside of a HTML document, take a look at Node.js. Another option is to go straight to the source, and download and build v8 yourself

Third, the IDE you use is up to you. I personally use Eclipse PDT, but there are lots of options out there.
shehan31
Forum Commoner
Posts: 59
Joined: Sun Aug 29, 2010 5:24 am

Re: setting the path.

Post by shehan31 »

thank you for your reply johna.
I have tried eclipse and when i compile the programe the below eroor will be displayed.

Exception in thread "main" java.lang.Error: Unresolved compilation problem: at javafirst.First.main(First.java:10)

The code will show its out put properley when i tried the note pad.
It has to be an eclipse related problem.

Code: Select all

import static java.lang.Math.*;
class First {
public static void main(String[] args) {

	    //this program requires two arguments on the command line  
        if (args.length == 2) {
			//convert strings to numbers
            float a = (Float.valueOf(args[0]) ).floatValue();  
            float b = (Float.valueOf(args[1]) ).floatValue();

            //do some arithmetic
            System.out.println("a + b = " + (a + b) );
            System.out.println("a - b = " + (a - b) );
            System.out.println("a * b = " + (a * b) );
            System.out.println("a / b = " + (a / b) );
            System.out.println("a % b = " + (a % b) );
        } else {
           System.out.println("This program requires two command-line arguments.");
        }
    }
}


User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: setting the path.

Post by Jonah Bron »

Wait, you're writing Java? Ignore everything I said in my last post. This section is for Javascript. Java and Javascript are totally different. This is a good Java forum here though:

http://java-forums.org/
Post Reply