Jubula - Test suite will not map the object possible jar issue? - java

I'm using Jubula to run some automation for a large Java project. The gateway is a launcher that sets all the parameters etc for the project to run. The gateway is wrapped as a .exe file. I converted it back to a jar in order to get Jubula working with it, I managed to one time but not all the projects jars were launched from the main project launcher. If I attempted to use the .exe within the AUT properties, it won't launch at all. If I convert back to a jar, then I run into an issue of either not being able to object map no matter how much I press CTL+SHIFT+Q or some of the apps don't launch when I use Jubula to automate. Also I need to create a bat file to launch either the jar or the .exe file in any case. I can't just launch the jar from settings within AUT properties.
Is this an issue of the .exe wrapper being the culprit and I should just launch everything without the project launcher or are there known issues with object mapping someone can alert me to?

The .exe should mean no problem. If you can't map it means the RC (Remote Control) .jar is either not present or is not launched. Could you check that?
The less likely possibilities are Firewall blocking the communication between remote client and AUT agent (corporate machines with Windows usually do), or that you're using incompatible versions of RC/AUT agent/Testexec triple. The latter can only happen if you've updated your Jubula on your machine to newer version.

Actually it wasn't an issue with Jubula at all. I had a permissions issue somehow with anything Java related. So I got my machine reimaged and now everything works like a champ.

Related

Run a command before windows service starts

I have a windows service running a java application. When I install this application on a share drive it takes ages to start. I decided i want to copy all the application jars and libs to a local path, and run it from there.
The problem is I can't find a clean way to do it. I understand i cannot run a batch script (to copy the files before starting the app) as a service. I don't want to create two services with dependancies on them and creating another java app just for copying the jars sounds and overkill for the problem.
Can you think if a nice way to do it? I thought maybe downloading a template of a generic windows service (I don't care what language, preferablly C\C++) and make it copy the jars\libs to local disk and then execute the regular service to run from there. If this is the write way, is there an equivilant of the exec linux system call in Windows? i don't want the startup executable to stay alive while the app is running.
Thanks in advance

What is difference between executable and install able jars

I am developing one desktop application in javaFX. I am using in memory database hsqldb. I want to make this application to run on any windows machine by just double click or by installing.
I have gone through the launch4j library, using which I can make .exe file of my jar.
But if I create the .exe file, then I can open this application by just double clicking on it. anyone can copy and paste and open it.
I am confused with install word here.
What extra things will happens, if I want to make my application installable. Because I want to give an expiry date my application.
The answer to your question lies on the description of launch4j on their site.
The executable can be configured to search for a certain JRE version
or use a bundled one, and it's possible to set runtime options, like
the initial/max heap size
Not every machine you distribute the jar to may have a JRE. A bundled JRE will help the launcher run your jar if a JRE cannot be found on the target machine.
If you want to force updates on your jar, consider running a plugin mechanism or forcing the user to download a new version. It sounds to me like a web application might suffice instead ?

Running multiple files in Eclipse

I am doing a distributed systems project & I want to run multiple servers (of a same file ) by eclipse at the same time on my local system,
Is it possible to do that ? generally, is it possible to run multiple files (e.g. a client and a server) on one eclipse ?
You cannot directly launch multiple launch configuration at once: there is an old bug still pending, which involves the "launch group" option (present in the "C/C++ Development Tools" plugin, but usable for other non-C++ project.
But you can run multiple launch configuration one after the other.
As illustrated in "Run two Java programs from Eclipse at once?", you will have multiple console.
And you can script that launch sequence with escript.
If by file you mean program, yes.
Yes.
You can start multiple servers one by one, and then swith to your program want to run. and run again directly. Or you can set up many run configurations manuly and then run them one by one. Any unclear pls point out.

Convert Java Project to .Exe

I've created a game project in NetBeans 6.9, and I want to run the project on another computer. The problem is if NetBeans is not installed on the other computer then surely I cannot run the project.
Therefore I have to convert my project into a .exe that can be run on other computers without having to install NetBeans.
Is there a free application that can convert .java to .exe?
Please help me to convert my project into a .exe file. Thanks.
Check out these official netbeans article for Packaging and Deploying Desktop Java Applications and Developing General Java Applications.
From the article
Running the Application Inside of the IDE
When developing applications in the IDE, typically you will need to test and refine them before distributing them. You can easily test an application that you are working on by running the application from the IDE.
To run the AnotherGrep project in the IDE, right-clicking the project's node (AnotherGrep) in the Projects window and choose Run Project.
The xGrep window should open. You can click the Browse button to choose a file in which to search for a text pattern. In the Search Pattern field, type text or a regular expression pattern that you would like to match, and click Search. The results of each match will appear in the xGrep window's Output area.
Information on regular expressions that you can use in this application are available here and in many other places on the World Wide Web.
Running the Application Outside of the IDE
Once you have finished developing the application and before you distribute it, you will probably want to make sure that the application also works outside of the IDE.
You can run the application outside of the IDE by following these steps:
In your system's file manager (for example, in the My Computer window on Windows XP systems), navigate to PROJECT_HOME/dist and double-click the AnotherGrep.jar file.
You will know that the application has started successfully when the xGrep window opens.
If the xGrep window does not open, your system probably does not have a file association between JAR files and the Java Runtime Environment. See Troubleshooting JAR File Associations.
Distributing the Application to Other Users
Now that you have verified that the application works outside of the IDE, you are ready to distribute it.
You can distribute the application by following these steps:
1: Create a zip file that contains the application JAR file (AnotherGrep.jar) and the accompanying lib folder that contains swing-layout-1.0.jar.
2: Send the file to the people who will use the application. Instruct them to unpack the zip file, making sure that the AnotherGrep.jar file and the lib folder are in the same folder.
The users of your application should be able to run it by double-clicking the JAR file. If this does not work for them, show them the information in the Troubleshooting JAR File Associations section.
Also some third party tools like Launch4j may do the trick. For more information see this article on java-to-exe
See Launch4j. I dislike starting java apps with a batch file. This wraps anything from the root jar all the way up to a complete Java environment in an exe. You get your own icon in the system tray rather than the generic coffee cup. I've used it successfully on a project that has about 300,000 downloads, and it's never been the source of a reported bug. NB It does take some careful reading to pick the right options for your project. But you can set it up with the Ant build script in Netbeans to make the .exe automatically. Very nice and clean. My project includes native libraries. They work fine as well.
I think the NSIS will help you . Most of the applications using NSIS. Because it is open source.
Also there is a Eclipse plugin for NSIS to make the process easy.
http://hmne.sourceforge.net/

Deploy java (command line) app using Netbeans / ant

I've finally managed to create a Netbeans project out of an old standalone (not Web-) Java application which consisted only out of single .java sources. Now I have basically two questions regarding Netbeans Subversion interaction and application deployment:
Do you check in all the Netbeans project files into the repository, normally?
If I build the project using Netbeans (or ant) I get a .jar file and some additional jar libraries. In order for the app to run properly on the server, some additional config files and directories (log/ for example) are needed. The application itself is a J2SE application (no frameworks) which runs from the command line on a Linux platform. How would you deploy and install such an application? It would also be nice if I could see what version of app is currently installed (maybe by appending the version number to the installed app path).
Thanks for any tips.
No, not usually. Anything specific to NetBeans (or Eclipse, IntteliJ, etc), I don't check in; try to make it build from the command line with your ant script and produce exactly what you want. The build.xml is something that can be used for other IDEs, or in use with Anthill or CruiseControl for automated builds/continuous integration, so that should be checked in. Check in what is needed to produce/create your artifacts.
You don't specify what type of server, or what exact type of application. Some apps are deployed via JNLP/WebStart to be downloaded by multiple users, and have different rules than something deployed standalone for one user on a server to run with no GUI as a monitoring application. I cannot help you more with that unless you can give some more details about your application, the server environment, etc.
Regarding the config files, how do you access those? Are they static and never going to change (something you can load using a ResourceBundle)? ? You can add them to the jar file to look them up in the ResourceBundle, but it all depends on what you are doing there. If they have to be outside the jar file for modification without recompiling, have them copied with an installer script.
As for directories, must they already exist? Or does the application check for their existence, and create them if necessary? If the app can create them if absent, you have no need to create them. If they need to be there, you could make it part of the install script to create those folders before the jar files are installed.
Version number could be as simple as adding an about box somewhere in the app, and looking up the version string in a config/properties file. It has to be maintained, but at least you would be able to access something that would let you know you have deployed build 9876.5.4.321 (or whatever version numbering scheme you use).
Ideally, you should not tie down your application sources and config to a particular IDE.
Questionwise,
I suggest you do not. Keep you repository structure independent of the IDE
You might have to change your application so that it's structure is very generic and can be edited in any IDE.
Is this a web app? A standalone Java app? If you clarify these, it would be easier to answer your query.
We don't check in the /build or the /dist directories.
We tend to use this structure for our Netbeans projects in SVN:
/project1/
/trunk
/tags/
/1.0
/1.1
/binaries/
/1.0
/1.1
When a change is need we check out the netbeans project from trunk/ and make changes to it and check it back in. Once a release of the project is needed we do an SVN copy of the netbeans project files to the next tag version. We also take a copy of the deployable (JAR or WAR) and place it in the version directory under binaries along with any dependencies and config files.
By doing this we have a clean, versioned deployable that is separate from the source. Are deployables are version in the name - project1-1.0.jar, project1-1.1jar and so on.
I disagree with talonx about keeping your source non-IDE specific - by not storing IDE files in SVN along with you source you are adding extra complication to the checkout, change, checkin, deploy cycle. If you store the IDE project files in SVN you can simply check out the project, fire up the IDE and hit build. You don't have to go through the steps of setting up a new project in the IDE, including the files you SVNed, setting up dependencies etc. It saves time and means all developers are working with the same setup, which reduces errors and discrepancies. The last thing you want is for a developer to check out a project to make a small bug fix and have to spend time having to find dependencies and set stuff up.
To answer question #2 -- who's your consumer for this app?
If it's an internal app and only you (or other developers) are going to be deploying it, then what you have is perfectly all right. Throw in a README file explaining the required directories.
If you're sending it out to a client to install, that's a different question, and you should use an installer. There are a few installers out there that wrap an ant script and your resources, which is a nice approach particularly if you don't need the GUI... just write a simple ant script to put everything in the right place.
Version number is up to you -- naming the JARs isn't a bad idea. I also have a habit of printing out the version number on startup, which can come in handy.

Categories