Hi Im new to Talend Open Studio , My question is, Im able to create a Job and executing and getting output . Say for an example following is my Job , Now how can i proceed with the next step , That is how can i get the code or convert it into jar or any kind of executable to get my job done every time.
Above is my Job , And i want to automate this that is i need to run this for every hour or on the fly basis . How can i do with the further steps .
As of now i have created my Job how can i proceed with the next step
Thanks
The enterprise platforms of Talend come with Talend Administration Center that enables you to manage your jobs from a web interface and set up CRON jobs or other types of triggers. I'm not actually sure if this comes with the Talend Open Studio versions though.
An alternative is to export the job as a .jar/.war file and then have a scheduler or CRON job execute it every hour.
Right click on your job and there's an option called "Export Job" or "Build Job" (depending on the version you're using). This will generate the java code, and puts it into a zip. All you need to do is edit the zip, open it, and in the subfolder there will be a .bat and .sh file, its basically starting a JavaVM with parameters set, and starts your job.
You can schedule this bat/sh in windows/linux to run every hour also if you double click on it, you can execute on the fly.
Related
I have a Java executable (.exe) with a given JRE build in the same folder, which it uses to actually run.
I want to put this executable on Windows Task Scheduler.
I did some tests with some C++ hello world programs, and all went fine. This Java program, running directly (by two clicks or whatever) works all fine too (it is supposed to write to a file and end).
However, when I put the Java program in the Task Scheduler, it exits immediately, with status code 0x0 (success) and nothing is actually performed.
At Windows Task Manager, I see that javaw.exe starts and exits in a glimpse.
What could it be? Something related to Java? Something due to a specific task scheduler flag?
Aditional:
Java executable built with launch4j.
Scheduler set with schtasks /create /tn MyETL /sc hourly /mo 3 /tr C:\ETL\etl.exe
When you run an application with Windows Scheduler, if that application has dependencies to other files via relative path, then you need to set the start in setting for the task. This sets the path from where execution will begin.
Alternatively you can use a command file and have it navigate to the correct directory first.
Just figured out that the problem was that the program was actually being executed in the wrong folder, in order that the output file wasn't where I thought it would.
The output file was being write in the starting folder, not the program's folder.
I am very new in developing world so my apologies in advance if my question sounds weird.
I have written a test with Selenium and JAVA and made a jar file from it, now I am wondering if there is any way that this jar file can be run every 1 hour automatically, I mean there should be no one clicking on the jar file or any running program to run it.
Open Task Scheduler and Create Task (on right side).
Add a Name on the General tab.
On the Triggers tab, click New...
In the popup, select daily
then in the advanced you can select Repeat Task every:
1 hour
On the Actions tab, click New...
Browse and select your program
Click OK to create the task.
You can use an OS built job scheduler or use a tool which would make your jobs run.Also you could have a main Java program running infinitely and a child process spawning every 60*60*1000 milliseconds .
You can also run Jenkins, and create a job to execute the jar every hour. The nice part about this is you get a web-based UI and an easy way to view the output from the tests.
If you are on a unix based system, you could run the jar as a cronjob. The following would run a jar every 30 seconds.
0 */1 * * * java -jar /path/to/jar/myjar.jar
Read the following to learn how to setup a cronjob correctly https://askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job
For windows, use task scheduler. Go to https://stackoverflow.com/a/26932169/802061 for more details.
I have a Java project which gives me output based on user's request in the front end.
The output is like it will give me the list of devices from each and every server(based on click of a radio button).
Now I need to set up a crontab job which will run at a particular time and it will automatically get the output of all the servers without user's request.
Can anyone give me an approach as how I need to tune my program so that it will automatically give the list of all devices.?
Also do I have to create a war file and deploy that in crone tab to run the daily job?
WAR files are Web ARchives, meant to run inside a Web Container (think Tomcat, JBOSS, etc) - probably you want an executable JAR file. You are probably thinking of Java ARchive (JAR) files.
I would first create an executable JAR file and then schedule it as a CRON job to run at the frequency you wish.
How to create an executable JAR file
How to setup a CRON
job
I have searched all over but found no luck yet, I am using linux ubuntu flavour and need to know that how can I check that whether the java jar file is running at remote end or not using pgrep. As the pgrep -f "someProcess" returns the Process ID.
Note: Both systems are linux based, and I only need to done it through terminal. Any ideas would be appreciated.
I've used Ant to do this.
I can't remember which task I used unfortunately....
But we executed a command or script remotely using an ant task.
I think we used ExecTask.
Notice you can specify an output file.
You can read that to process the output of your command.
Ant is pretty awesome in that anything you can do with an Ant script, you can do with Java.
And it's a lot easier than you'd think.
I believe this is a good starting pont to learn how to do it.
Here is the Javadoc overview page for the Ant classes.
Here are some more links to helpful Javadoc pages:
Project
Task (the base class for all Ant tasks)
SSHExec task (looks like this is what you want)
ExecTask
Copy task (this is a nice simple one for "Hello, World" purposes
FTP task
I'm sure there other ways, but as they say here Ant makes things very easy for you.
I can think of one way to do this.
Assuming you have servers A and B, A performs the process check on B. You can use ssh and setup no-password login from A->B and use command below:
ssh root#12.34.56.78 "pgrep [whatever keyword]"
You'll get the same result as executing the command on B.
You could use plink.exe to do this. You can pass commands to plink in the form of a .txt file input.
I am really new to database and this is my first program in database using java Netbeans 7.1 --- It is summer on our country now and I am a student with the course I.T. Our next subject on programming is about database and since there's no class I spend my time learning database for preparation for the next school semester and I refer to this site as my guide for the first database program I currently making now.
http://www.homeandlearn.co.uk/java/databases_and_java_forms.html
I did everything in the tutorial and I actually done doing the program.
The final thing I did is I clean and build the program since I want the program to run with out opening the netbeans again I downloaded the JRE and make my database_form.jar as a jar executable. "database_form" the name of my Netbeans Project. I do that by making javaw in JRE.7 as my dafault when opening any jar files.
Anyway, this is how i run the program.
Running Program in Netbeans IDE
Using Netbeans, before my program works I first need to "Start Server" on JavaDB. because if I didn't do that an Exception occurred "Err. connecting to server localhost 1527 and so on"
Running Program using jar executable alone.
The Problem is there's an Exception and Err in connecting still occurred.
What I want to achieve?
I want the program to run without opening the Netbeans IDE and going to Java DB to click the "Start Server", I dont want to do that anymore. Or my second option is to start the server using command prompt so that I just have to make a bat file so that whenever I open my program database_form.jar I just place the bat file on my desktop and run it.
Second Problem!
Actually, I already try my second option by using command prompt to start the server but I forgot how I did it, I just found it on some website the only thing I remember is the Exception says "Failed to lunch the server because the database Employees is missing. Employees is the name of my created database.
The O.S. I am using is Windows 7.
Thank you for all the reply and sorry for the long text I just want to be specific, :D
Right, from your description there seems to be a couple of things you are confusing.
First, databases are typically run as servers with multiple clients connecting to them thus allowing they contain to be shared. When you start Java DB you are starting the Java DB database server.
That said, lightweight databases, such as Java DB can be run in an embedded mode as explained here. Remember that the directory you point to with the derby.system.home property will need to contain the database files, if not you'll need to create that programatically too.
Second, there's various ways to run a Java application outside of an IDE, but jars themselves are not executable in the same way an exe file is in Windows.
The simplest way is to call the java executable passing the necessary classpath and the name of the class containing the main method. For example if I had a class called com.example.Application that had been compiled to a directory C:\dev\example\classes the following command line would run the application:
java -cp C:\dev\example\classes com.example.Application
If there were dependencies on external libraries, as there will be in your case on the Derby JDBC driver, then those would also need including in the classpath resulting in something like:
java -cp C:\dev\example\classes;C:\dev\lib\derby.jar com.example.Application
There's a full set of document on the Java launcher here.
Now, back to the jar. Like I said, jars are not executable but there is something that's know as an 'executable jar'. This is the same as any jar except there are some special additions to the manifest to specify the application entry point or main-class and the class-path as described here.
Once the main-class and class-path are specified in the jar's manifest, the following command line would run the application:
java -jar C:\dev\example.jar
You can even associate the jar extension with the java exe and double clicking the jar will cause the application to launch (though on a dev machine it's probably more useful that the jar extension be associated with WinZip or simlar in order to open that jar).
The default database in Netbeans is Derby/JavaDB. So you need to:
add the jar of javadb/derby in our classpath (it maybe already present, as it is bundled with java when you install it in Ubuntu)
setup a path with the jdbc URI to save the database data
I personally recommend the usage of hsqldb or H2 for this: they support in-memory database, very useful for stand alone project with no persistence data or for tests.
If you use window, add ODBC Data Sources from Administrative Tools to your Java Derby driver and run jar.