简体   繁体   English

有没有办法在Aptana Studio 3 IDE中运行JavaScript代码?

[英]Is there a way to run JavaScript code inside Aptana Studio 3 IDE?

I created a Test.js file and wrote two lines of JS code in it: 我创建了一个Test.js文件,并在其中编写了两行JS代码:

var a = 5;
console.log("The result is = " + a);

The output should be: 输出应该是:

"The result is = 5"

Is there a way I can see this in Aptana Scripting console, instead of integrating the JS code in a HTML file and saving/refreshing it? 有没有办法在Aptana Scripting控制台中看到这个,而不是将JS代码集成到HTML文件中并保存/刷新它?

Can any other IDE, say Netbeans help, if not Aptana? 如果不是Aptana,Netbeans可以帮助任何其他IDE吗?

Any advise would be highly appreciated. 任何建议将受到高度赞赏。

Regards 问候

Roy 罗伊

I think that it would be best if you give Node.js a try. 我认为如果你试试Node.js会是最好的。 This way, you get to call node test.js on a console window and see the result. 这样,您可以在控制台窗口上调用node test.js并查看结果。

I'm pretty sure that console is meant for viewing the output of Aptana's Ruby-based commands (installed under the Commands menu). 我很确定控制台是用来查看Aptana基于Ruby的命令的输出(安装在Commands菜单下)。 It might be possible to follow the instructions here: http://www.chromium.org/for-testers/enable-logging and then tail the resulting log file in a Terminal panel (not the same as a console window). 可以按照此处的说明进行操作: http//www.chromium.org/for-testers/enable-logging ,然后在终端面板中将生成的日志文件拖尾(与控制台窗口不同)。

I'm afraid it is not possible. 我担心这是不可能的。

But What I did was to setup a simple workbench.html file, where in the header I put 但我所做的是设置一个简单的workbench.html文件,在我放的标题中

[...]
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="js/myJsFile.js"></script>

and then modified the myJsFile.js and saved it. 然后修改了myJsFile.js并保存了它。

Another very intersting possibility is given by http://www.developer.nokia.com/Community/Wiki/Aptana_WRT_Plugin:_Displaying_log_messages_in_Output_console 另一个非常有趣的可能性是http://www.developer.nokia.com/Community/Wiki/Aptana_WRT_Plugin:_Displaying_log_messages_in_Output_console

just check it 检查一下

It's not exactly what you asked, but it might point you in the right direction. 这不完全是你提出的问题,但它可能会指出你正确的方向。 There's a project called EclipseMonkey ... I'm not sure the status. 有一个名为EclipseMonkey的项目......我不确定状态。 Here's a working (?) example. 这是一个工作(?)的例子。 Your mileage will vary. 你的里程会有所不同。 http://blogs.edgehill.ac.uk/webservices/2008/10/16/aptana-outline-auto-expansion-monkeyed/ http://blogs.edgehill.ac.uk/webservices/2008/10/16/aptana-outline-auto-expansion-monkeyed/

What you can do is you can download node.js from node.js, download the package and follow the installation instructions on the screen. 你可以做的是你可以从node.js下载node.js,下载软件包并按照屏幕上的安装说明进行操作。

If using a Windows, the node.js package comes with its own interactive command prompt which you can open. 如果使用Windows,node.js包附带了自己的交互式命令提示符,您可以打开它。 To run a js file on windows, open the windows command prompt, type in node, then the name of your file eg test.js. 要在Windows上运行js文件,请打开Windows命令提示符,键入node,然后输入文件名,例如test.js. Node.js should run your file. Node.js应该运行你的文件。

If using a Mac, the node.js package runs through the terminal application on the mac. 如果使用Mac,则node.js包将通过mac上的终端应用程序运行。 To run a file, type in node, then the name of your file eg test.js, node.js should run the file. 要运行文件,请键入node,然后输入文件的名称,例如test.js,node.js应该运行该文件。

Aptana Studio 3 has the ability to open the terminal inside the IDE itself. Aptana Studio 3能够在IDE内部打开终端。 Save your file in Aptana Studio and follow the instructions to run a file on the mac. 将文件保存在Aptana Studio中,然后按照说明在Mac上运行文件。

By the way, keep your files labelled in lowercase letters, I tried using Uppercase for the first letter and it did not work. 顺便说一句,保持你的文件用小写字母标记,我尝试使用大写字母作为第一个字母,但它不起作用。

Hope that helps. 希望有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM