NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Running a JavaScript (JS) file

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    NetBeans Forums -> Ajax Users
View previous topic :: View next topic  
Author Message
marcusadamski



Joined: 12 Jul 2010
Posts: 5

PostPosted: Mon Oct 18, 2010 11:01 pm    Post subject: Running a JavaScript (JS) file Reply with quote

Hi all;

I've been using Netbeans for Java developement, but now want to learn some JavaScript.
My intention is to develop some JavaScripts to do some utility work outside a web browser (I.e. use Rhino in Java 6, and jrunscript)

Could somebody please tell me how I can create a basic project witin Netbeans, and run a simple JS file, and preferably debug it ? Is this even possible?

I saw an article suggesting it's possible to right-click on the file, and select "run file" - but I don't have that option.

Many thanks for any help,
Marc
Back to top
fortruth



Joined: 26 Aug 2008
Posts: 77

PostPosted: Mon Nov 22, 2010 7:46 am    Post subject: Reply with quote

Yeah. I also have the same question.

Is there any way can make javascript file from netbeans like run php as script?
Back to top
roger_onslow



Joined: 06 Dec 2010
Posts: 2

PostPosted: Mon Dec 06, 2010 9:41 pm    Post subject: Reply with quote

[ ASIDE: I had replied to this before, but apparently my account was deleted without no contact from admins, no warnings, no notificationsm and my posts and replies removed. I find that quite rude of them, actually. This was because when someone replied with an answer that didn't address my question (( I wanted to run html+javascript in browser from NetBeans without a server, and they posted how PHP needs an interpreter and I had to install EasyPHP to get a server )) i said I know you're trying to help but you should read what I actually asked. They spat the dummy and put me on their black-list and last night my account disappeared. That's the only reason I can think of for my account disappearing as no-one told me anything. As someone who provides product support and is involved in running similar forums, I know that's a huge overreaction by the moderators .. they should have at least contacted me first, given a warning (ie moderated). It looks like they're very touchy here. So be warned and don't let it happen to you Smile ]

I'm not sure if I can remember what I said here before, but basically was that on my Netbeans there is no run in the right-click on editor or in navigator. BUT .. there is a Run File in the Run menu and a hot key for that (Shift-F6). That will (on my installation at least) start up your borwser with a localhost/ URL for a JS or HTML file. I tried changing the project URL to be a file:// url in the run customisation (so I don't need to install a server), but that doesn't work.

Although its not running the JDK engine, it may be at least let you do something that you want. [see my second reply below]

Someone else may know how to configure NetBeans to run the JDK engine or have a better answer for you.


Last edited by roger_onslow on Tue Dec 07, 2010 12:23 am; edited 1 time in total
Back to top
roger_onslow



Joined: 06 Dec 2010
Posts: 2

PostPosted: Tue Dec 07, 2010 12:20 am    Post subject: Reply with quote

Actually .. on further thought and a quick try .. that probably won't help, as passing the .js file URL to the browser only displays the JS source in the browser window as text, rather than running it.. Bugger.

So if one can't get the JDK engine to work with/from NetBeans, about all else I can think of is making an html file that runs your script, or directly running the JDK Javascript engine (if that is possible - I've not used it as yet).

I think the NetBeans really needs to add support for Javascript (and JavaScript+HTML) projects. I've read elsewhere that to do a client side javaScript project the best type of project to start with is PHP (but without any PHP script in it). I'm not sure if there are any alternative that might work better.

I'd like to be able to set up that a (client-side) Javascript project that can launch a browser for the project direct from NetBeans .. but NetBeans gets in the way by not letting my specify the project URL that would do that, unless I have a localhost serer. And being able to start up the JDK engine, or start a browser to execute the JS code directly (without having to have html code for it) would be very helpful as well.

Perhaps this can be suggested via a bug/feature request?
Back to top
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    NetBeans Forums -> Ajax Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo