Eclipse config for Java Script - javascript

I am new to Eclipse - inherited unfinished project after employee who left. I downloaded war file and by trial and error installed missing components till it actually built app. I can edit java files, but when I try to open java script files, I get error:
Could not open visual page editor
no more handles
could not load SWT library
no swt-xulrunner-gtk-4234 in java.library.path
Linux Fedora 17, Eclipse Juno, SWT is reported as installed by yum. ~/.swt/lib/ is empty

It looks like you do not have the proper library to load browser widgets in your Eclipse, that is what swt-xulrunner refers to. This FAQ should help you.
What it is saying is that you need to start Eclipse with the following system property:
-Dorg.eclipse.swt.browser.XULRunnerPath=<path_to_xulrunner>
There should be a xulrunner already included in your Eclipse, but if not, you will need to download a new one from here.
Also, it could be that you are using the Ubuntu pre-packaged Eclipse. I would avoid doing that. This pre-packaged eclipse often has some missing things in it. I'd instead recommend downloading directly from Eclipse.org

Related

Javascript file editing stopped working with Eclipse 2020-06

I have been working on the exact same file directory with eclipse for many years. It just worked. I am using PHP, CSS, JS, HTML files.
Occasionally, I ran an automatic upgrade as described here. This also just worked.
Now after the latest upgrade, several things just stopped working:
In PHP files, the core commands are not auto-completed anymore. I searched for a solution, to no avail.
Javascript files don't get any special editor anymore.
Now my most pressing question is:
Where do I re-enable the good old Javascript editor?
Here's my Installation details:
The Eclipse IDE for PHP Developers is made up of components from various Eclipse projects. In the Eclipse IDE 2020-06 release the JavaScript support for .js file is no longer provided by the JavaScript editor from JSDT, but by Eclipse Wild Web Developer.
Wild Web Developer does not provide a separate Editor for JavaScript, but extends the Generic Text Editor by code completion, syntax highlighting, validation, navigation, etc. for JavaScript.
To get back the JSDT JavaScript editor you have to uninstall Eclipse Wild Web Developer and install JavaScript Development Tools from the Eclipse IDE 2020-03 release (I guess the problems if you had both were solved by simply removing or disabling the JavaScript editor in the 2020-06 release):
Uninstall Eclipse Wild Web Developer: In Help > About Eclipse IDE: Installation Details, in the Installed Software tab select Eclipse Wild Web Developer and click Uninstall...
Install JavaScript Development Tools from the 2020-03 release: In Help > Install New Software... work with https://download.eclipse.org/releases/2020-03 and choose JavaScript Development Tools to install
See also Eclipse IDE 2020-06 > New & Noteworthy > Eclipse PHP Development Tools
Had the same issue, using 2020-09. I found that Wild Web Developer (in Help > Eclipse Marketplace..) was indeed installed, but then I checked more info and it said
To see it in action, open the desired file with the Generic Editor that's included by default in the Eclipse IDE.
and when I opened the javascript file in the Generic Editor, I get all the fancy I need...
go to Window -> Preferences then type file associations then select *.js on the right side list, then select "Generic Text Editor" below and click "Default" button
Yes versions above 2020-05 works with General Editor as default editor for JS files in eclipse
Window--> Preferences --> File Associations --> Select (*.js) and then select Generic Editor

node typescript client-side debug

Is is possible to debug (breakpoints, watches) client-side .ts typescript files from visual studio (2015) directly? Most of the related issues that I have found on google and stackoverflow suggest using other browser devtools such as chrome. Is it possible to do it in visual studio?
When I create a .ts script (say index.ts), it will be transpiled into a index.js which will then be referenced from the corresponding index.html file in the script tag.
How can I set breakpoints in the .ts file (although it is the .js which is referenced?)
It is possible with IE. You have to set "Browse with" to Internet Explorer and in the project properties/web unchecked all debuggers. Than you should be able to debug client-side TS in VS.
I figured out that I can debug in visual studio but launching a a new debug session from internet explorer: menu->view->external script debugger which will start a new visual studio ide with all my files (.js and .ts mapped) loaded. I just have to make sure that the .js and .ts files are in the same directory (example: ./public/js/ ). It is not a perfect solution (for example bringing the cursor over a variable does not show the variable value. You must manually open the watch window...) But it allows me to step through my .ts files thus keeping a unified development environment: typescript with node.js on the server, typescript on the client-side within the same solution
You might try with this HTML Application with TypeScript project template from Web Essentials 2015 extension, as suggested in this post from Telerik blog.
If that works, it seems just a matter of usual VS scenario "set breakpoint; hit F5".

Can I fail asp.net visual studio 2013 project builds if there's syntax errors in javascript files?

Sometimes I have syntax errors underlined in my .js files in my Asp.net MVC project. I noticed that the project still builds though, and when I build then debug I waste a few valuable seconds navigating to the place that runs that code in order for it to fail (fairly silently at that) in the browser.
Can I tell visual studio to fail the build if it detects an error in my javascript syntax?
If not, is there a command line tool out there that can detect javascript syntax errors? If so, I can call it post-build.
Thanks.
There's JSLint.NET. It's a .NET wrapper around JSLint and there is a NuGet Package which installs an MSBuild target into your project for JS validation:
https://jslintnet.codeplex.com/
Install the package into your MVC project using:
PM> Install-Package JSLintNet.MSBuild
I just tried it and it works nicely. You'll want to set up a JSLintNet.json settings file in your project to ignore third party js libraries like jQuery and Bootstrap e.g.
{
"ignore": [
"\\Scripts\\Libraries\\"
]
}

Cannot compile javascript files in NetBeans using Rhino

My goal is to create a project (don't know yet if it has to be html5 or java project) in netbeans, add js file with any line of code and then press compile it and run.
I wuld like to have my js files compile to *.class files as it can be done via js console according to rhino tutorial on mozilla page.
But as i said i would like to have it via pressing run/compile button in my netbeans
Currently i'm using netbeans 7.3(i'm honestly open to change version if necesarry) and windows
I already try to do many things but only 2 are worth describing:
-edit build.xml file to use js.jar from rhino
-just run java project with javascript files - according to some articles it should be possible but in my case in just left js files uncompiled
Please help
Aleksandra

Debug Javascript within Eclipse using Rhino

I have installed JavaScript Development Tools Plugin for Eclipse, but i am not able to run or debug a JavaScript Project.
I want to debug using the inbuilt Rhino Interpreter, not using a web browser.
I have created a JavaScript project and when I try to create a run configuration, it says "Please select a valid project" and the run button is greyed out..
Please view the attached snapshot.
Which version of eclipse are you using? Install Eclipse 3.7 Java EE Version, there you could directly right click on the javascript file (.js extension) and Debug As -> Rhino JavaScript. Please see the attached image.
The Debug configuration will look as below. There will not be any browse for project, you need to browse directly javascript file as shown in below image (you can browse all the javascript files from the entire workspace).
Apparently you didn't create a valid javascript project. Depending on your Eclipse version, this is for Juno, go to File - New - Javascript Project.
Javascript projects don't have a "nature" associated with them that let you know in the Project Explorer. Spring, Java, or even Perl projects have this in eclipse. It's a symbol assigned to a project that lets Eclipse know what type of project it is. Java projects have a "J", Spring projects have an "S".

Categories