Back in the old times, the Sun Java dev. toolkit (v2.x) used to have a stub generator tool, but no longer in 3.x versions. I can still use the old generator, but it is very picky when it comes to input WSDL files, and the errors generated do not contain any useful info to fix the WSDLs. The company that develops the SOAP WS is providing me with WSDLs not compatible with JSR-172, and I need to prove I'm using the the last official tool available to show there's no problem on our side.
I have installed the last reliable version of JavaME SDK (3.4) available at Oracle's site. These 3.x versions do not include an IDE, instead they provide plugins for Netbeans and Eclipse. I'm an Eclipse person, but I've opted for the Netbeans approach because looks easier to configure.
So I've downloaded the last Netbeans version (7.4). I've downloaded the bare-minimum JavaSE only version, then installed the mobility plugin for JavaME (Last time I needed to install Netbeans, you had to install the full JavaEE IDE plus GlashFish servers, etc. So glad to know they now offer the option not to install the full IDE).
Added the JavaME SDK v3.4 in platforms, but it does not detect it automatically. I was forced to configure a custom platform, but then the ant build failed. To solve this, I've installed the JavaME SDK v3.2 as well, which is detected by Netbeans out-of-the-box and builds fine.
You might think the stub generator tool would be available by now. Wrong!. You still have to go and install the "SOAP Web Services" netbeans plugin, which in turn installs a ton of other dependent plugins (by now the lightweight JavaSE install has become the bloated JavaEE-ready IDE that Netbeans has always been).
So then I created a basic JavaME project. Right-clicked over Source packages, then selected "New" -> "Java ME Web Services Client". The stub generator dialog is finally shown (and it looks pretty much like the old Sun Java CLDC 2.5.2 tool). I select the WSDL input file, type the client name and package name, and also ticked the "Generate databindings structures" checkbox (which I don't know what the heck it is for, but suffice to say I've tried both w/ and w/o this option selected and the result is the same).
Then I click the Finish button and only a .wsclient file (along with the imported wsdl file) is created. What is the purpose of this file? But most importantly, where are the .java or .class files? They are nowhere in the project folder!
Questions:
Is it possible to generate JSR-172 stubs using Netbeans?
If not, is it possible to do this using the Eclipse JavaME plugin?
It turns out there is a problem with the input WSDLs. They are valid but something is wrong because Netbeans does not generate any java file.
I've tested again with a known good WSDL and it works, so the procedure I followed is correct.
UPDATE:
I was using a local WSDL input file, and due to a bug in the SDK, if the file path contains whitespaces, the stub generation fails. In NetBeans no error is shown.
Related
I give a computer programming course I have written, and I recently switched to recommending Visual Studio Code in the course. We are starting out with the basics, so I just wanted a simple editor. We started learning Git, and one student's repository suddenly had all sorts of cruft in it, including:
.settings/
.vscode/
.classpath
.project
In particular the .settings directory had all sorts of Eclipse settings, such as I would expect to see in an Eclipse project.
The student explained to me that these came from VS Code after installing its Java extensions. But why are the VS Code Java extensions creating Eclipse files? And where is all this documented, so that I can update my lessons with the exact details and avoid this problem in the future?
Thanks in advance.
Simplified the Language Support for Java™ by Red Hat is the headless Eclipse Java IDE integrated into Visual Studio Code via the Language Server Protocol (LSP). See the self-description of the extension:
Provides Java™ language support via Eclipse JDT Language Server, which
utilizes Eclipse JDT, M2Eclipse and Buildship.
Except for .vscode/, the mentioned files are Eclipse Java IDE files.
Because in Eclipse these files are not intended to be edited manually, there is little or no documentation about them (the Java compiler settings in .settings/org.eclipse.jdt.core.prefs are similar to the command line arguments of the Eclipse batch compiler).
For example, the documentation of the Java extension recommends using the Eclipse Java IDE to edit the formatter settings (which are also stored in .settings/org.eclipse.jdt.core.prefs) and concludes:
No it's not an ideal solution, but it should be done only once, unless
you regularly change your formatter settings.
In the context of Java 8 and Nashorn I see two projects being regularly mentioned.
Avatar.js and Project Avatar
What is the relation of these projects?
Avatar.js has very little documentation. As far as I gathered it offers the possibility to execute node applications on the JVM.
Project Avatar seems to build on Avatar.js. However the scope seems to be to provide an alternative Web-Framework for Java EE 7. Is it also possible to execute node programs (like i.e. grunt) with Project Avatar?
Update: Project Avatar was officially halted 2015-02-12.
Avatar.js is the open-source version of what was informally called 'node.jar' (See this post from the avatar-js mailing list). In other words, it is a NodeJS-compatible API, running on Nashorn. Project Avatar appears to be Oracle's answer to the NodeJS API, offering an alternative platform which also provides compatibility with the NodeJS API and ecosystem via Avatar.js.
Therefore it is not that Project Avatar is built on Avatar.js, but rather that "Avatar.js is one component of Project Avatar. Nashorn is the JavaScript engine used to run both." (again, from this post).
The Avatar.js homepage currently has a list of modules known to run, including "grunt". It would appear that Project Avatar currently includes a build of Avatar.js as "avatar-js.jar", as found in the current latest commit, though it is 4 months old. So I think the answer is that yes, the current build of Project Avatar will allow you to run Node-compatible modules.
As you've pointed out, both of these initiatives lack documentation, and are in their infancy. Time and community engagement will show where they fit best.
Indeed there is Avatar.js included in Project Avatar.
By looking at the Maven POM files of Project Avatar, I discovered that there is a binary distribution of Avatar.js available through the java.net Maven repository.
Based on this discovery I wrote a blog post how to run simple Node.js apps with Avatar.js here:
Running Node.js applications on the JVM with Nashorn and Java 8
Steps for OSX repeated here:
Download avatar-js.jar from the java.net Maven Repo. Current version
is here:
https://maven.java.net/content/repositories/public/com/oracle/avatar-js/0.10.25-SNAPSHOT/
Example file: avatar-js-0.10.25-20140313.063039-43.jar
Download the native library avatar-js.dylib from the java.net Maven
Repo. Current version is here:
https://maven.java.net/content/repositories/public/com/oracle/libavatar-js-macosx-x64/0.10.25-SNAPSHOT/
Example file:libavatar-js-macosx-x64-0.10.25-20140312.062209-35.dylib
For Linux
you would download the corresponding .so file from ../libavatar-js-linux-x64/0.10.25-SNAPSHOT/
For Windows you would
download the corresponding .dll file from
../libavatar-js-win-x64/0.10.25-SNAPSHOT/
Rename the native library to avatar-js.dylib and rename the jar to
avatar-js.jar and put both in a directory called dist.
Create a simple Node.js app in the a file called app.js.
Run the command: java -Djava.library.path=dist -jar dist/avatar-js.jar app.js
Project Avatar does indeed layer on top of Avatar.js; the code is integrated into our build using Maven. (The jar you found, Johann, was old because we no longer use it -- I just nuked it, thanks).
And yes, we're aware that our docs need more work. For now, we are focussing on fleshing out the server-side JavaScript framework. This services layer provides a runtime tuned for easily creating REST, WebSocket and Server-Sent Event endpoints.
I do mostly google app engine coding, and a little bit of android development, and don't understand why I wouldn't want my Eclipse ide to always be at the most recent release, or version. It seems like there are some plugins that wouldn't be compatible, but couldn't you just install the missing features from an old release of Eclipse into the newest release?
I'd say that always having the most up to date version of program x really isn't necessary. I think the most important thing is having a set of tools that you know how to use well. Upgrade those tools when there is a reason to do so, not just because there is a new version of them.
By far the predominant reason for not upgrading is lack of support for the new release from the plugins that you require. You cannot just install "missing features". Most of the time, the incompatibility is due to changes in the new version of an existing feature. Plugins that ship from eclipse.org are tested together in coordinated releases. While in some cases, it may be possible to down-version a plugin and have that plugin still work in the new version of Eclipse, it is not something that you can depend on working. In fact, the odds of this working without issues are so small, that I wouldn't bother trying.
Stick with whatever version of Eclipse your required plugins support until those plugins upgrade their support. If they aren't moving fast enough, consider pestering the provider about this issue. If nothing else, knowing how big of a chunk of the community cares about support for the latest version of Eclipse will help the plugin provider prioritize their work.
You can do that. If you want to compile against an older Eclipse version, this can be done very easily.
e.g. if you want to develop with Eclipse 3.6:
download Eclipse 3.5 and extract it (e.g. c:\development\targetplatforms\eclipse3.5).
start Eclipse 3.6, choose your workspace where you want to use the Target Platform.
open the Menu Window->Preferences, type target in the search field, and add a new Target Platform (Nothing: Start with an empty target definition -> Add -> Direcotry -> choose the unzipped Eclipse 3.5)
There are some advantages of using a target platform. You have the newest IDE Features. You can build your product against older Eclipse Versions without having to port it to your newses IDE version. You can add Plugins to your Target Platform without contaminating your ide or add Plugins to your IDE withoud contaminating your Target Platform. ...
You should bundle your Target Platform with your Project, so you don't have to download it again. We have a TargetPlatform Project in our SVN Repostory. Every Project has a small readme how to setup the Workspace (targetplatform, deployment, ....).
Why wouldn't I want to use the newest version of Eclipse?
Because IntelliJ IDEA provides a Community Edition. :)
How do I find which Eclipse version I have on my Ubuntu system?
This is what "About Eclipse SDK" says.
Eclipse SDK
Version: 3.5.2
Build id: M20100211-1343
I am not sure if its the Eclipse IDE for Java Developers or the Eclipse Classic version.
What I would like to do is use Eclipse for
Java based Web Application Development
Ant Builds
Deploy using Tomcat
including HTML, CSS Editing
Please help me decide which version I should choose? I would like to upgrade my Eclipse setup from whatever version it is now to a version that supports all the above. Should I go for Eclipse IDE for Java EE Developers?
Should I download a totally new version from Eclipse site or can I just ADD necessary features/plugins to my current Eclipse setup.
Please suggest.
See Compare Eclipse Packages for a nice chart
What I would like to do is use Eclipse for (...)
The Eclipse IDE for Java EE Developers allows to do what you're asking for out of the box.
Should I download a totally new version from Eclipse site or can I just ADD necessary features/plugins to my current Eclipse setup.
Both would work, although it would be simpler to just get directly the Eclipse IDE for Java EE Developers (especially if you don't know exactly what plugin(s) you're looking for). Personally, I don't use the version you can get from the repository but download Eclipse from the official website and install it in user mode.
If you are using Eclipse for only Enterprise Development, then as everybody has recommended I would use the Eclipse Java EE version. If you plan on occasionally using it for other development purposes then I would consider downloading a separate classic version as well.
The reason for this is that everybody is well aware of eclipse's plugin capabilities. Unfortunately, Eclipse can get bogged down with too many plugins or add on tools. What I have experienced is that if you are using it for Enterprise Development(J2EE) it might be a good idea to keep that as a separate environment then your other Java Development. That way you can download the plugins,tools,libraries,etc for your enterprise development, and you can use your classic version for any other development you might need.
The downside is you will have two versions, but this is not a problem granted you do not run them simultaneously.
If you want to play with Web development, then the Eclipse java EE for Developers is for you. It is shipped with components to make Java Enterprise applications to create Enterprise Applications (and bundle it in an Enterprise ARchiver, known as EAR file or Web ARchive, known as WAR file).
The default Eclipse shipping with Ubuntu is the Classic version, and you can add more plugins.
I would recommend, however, to download th eJEE version manually and unzip it and run. Then you have a local installation outside the system files.
I have a question regarding the development of liferay portlets using the liferay plugin SDK. My question goes mainly in the setup of the development IDE. The suggested one would be to use Netbeans IDE which I also tried out, but it appears to run very slowly on my machine while Eclipse is quite performant.
The setup for Netbeans IDE is the following
Go to the directory \portlets
Run the create.bat (or sh file depending on the OS) to create a new sample portlet
Run Netbeans IDE, create a new "Java free form project" and point it to the directory of the created sample portlet
That's it, pretty simple.
For the mentioned reasons above (and because I'm a lot more familiar with Eclipse) I'd like to import the project into Eclipse the same way. Is there a way for doing it without having to change too much in the original structure of the created sample portlet and the according build.xml (ant file)?? I tried already to create a new project out of the build.xml ant file of the created sample portlet, however in this way it doesn't include me the source code.
I didn't also find great tutorials on the web...
Could someone help me with this, pointing out online tutorials or give me some hints.
Thanks
I know your pain. Starting to work with Liferay needs much time. I you do not want to edit the existing source, but only crate your own portlets, you can download the plugins SDK from the 'Additional Files' section on the Liferay website. This provides ant scripts, to create a simple JSR compliant portlet, and to create all necessary things, to create a sound Eclipse project, for example:
ant -Dportlet.name=<project name> -Dportlet.display.name="<portlet title>" create
Than cd into the directory of your created portlet an do:
ant setup-eclipse
After that you should be able to create a new project from the sources in that directory in Eclipse, which can then be deployed via another ant script to the running tomcat instance. If you already know somthing about portlet programming, you shoud be pretty much settled now. If not, try to find documentation about JSR portlet programming first, before looking into Liferay specifig portlet development.
Liferay has now released an official set of Eclipse plugins that support portlet development. Here is the installation guide for installing the eclipse plugins:
Liferay IDE Installation Guide
Also there is a getting started guide that shows what to do after installation to actually setting up your first portlet project.
Getting Started Tutorial
Liferay IDE uses the Plugins SDK from Liferay under the covers to do all the work. If you already have existing projects that you created with the Plugins SDK those can be imported into Liferay IDE as well.
Importing existing Projects
you can find the tutorial for deploying liferay in eclipse
http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Development+Environment+(Windows)
No clue about Liferay's specifics, but in general, I'd do this:
Follow the steps 1 and 2 from your NB setup list
Create a new Dynamic web project (or a Java project if you don't need the web project's features) in Eclipse
Import the contents of sample portlet directory by doing Import -> File system in Eclipse
Adjust the project's Java source directory to point to the generated sample portlet source directory (that should now appear in your project)
Adjust classpath of the project, point it to LR lib folders, ...
If there's a generated build.xml, check if it can be used to deploy to LR, or to produce builds.
As of March 2011, there is some official Liferay support for NetBeans and as noted before, there is official support for Eclipse ( In the Marketplace). The Documentarian uses Eclipse himself, though many examples just use the Plugins-SDK with shell scripts, ant scripts and no IDE.
We are fighting with Liferay on Eclipse, Eclipse seems buggy and unpredictable, but we are also new to J2EE and Eclipse ( so discount this last comment a bit), and I have our portlet files setup in a separate area for SVN, requiring a refactor-move, refactor is definitely buggy.
You should be aware that there is a book for developers on the way from the official documentarian - we've bought the early release and found it useful. He does cover some IDE issues. See Manning press.
The Liferay sample portlets ( there are many) are not set up for Eclipse projects, and you'll have to import some java files and jump through some Eclipse hoops to get them into a running Eclipse project you can develop.