Pdf Compression using java - java

i developed application which will converts tiff,jpeg,pdfs in a zip file to single pdf,and its working fine and size is also similar to original files , but i need to compress the pdf ( save my file server memory) i searched in google , i got ghost script which will reduce the size of 5mb pdf to 50kb,and i manually executed same in linux and its working fine,but i want to run same command in java programme,
but i dont know how to run linux command in java programme since i am new to java i am facing difficulties,can any one post sample programme how to run linux commands in java ,so i can try myself

What you want to do should be able to be achieved by simply running a bash script, which is pretty simple. Also it happens that someone has asked that question before so that answer should in turn answer yours. Please let me know if you want a more detailed response or need help with the implementation.
Running a bash shell script in java

Related

Executing Jmeter testplan using Java

We all know pretty well that JMeter is a server performance testing tool for both static and dynamic resources. I've had successfully used JMeter for the above written purpose through it's easy to use GUI interface. Recently we've been experiencing a lot of "server down" issue but we're unable to find out when exactly server is down until we're requesting something to it and get nothing in return.
So I thought of using JMeter as a solution here. Using JMeter I would be hitting the server at particular intervals, say once in every 3hours and get a response back which will correctly identify that server is working fine. Using it in GUI mode is not apt. It needs to be scheduled for every 3 hours.
Through a bit of Google's help I learnt JMeter could also be used in "non GUI mode". So I took the script and made a bat file of it. I then triggered the bat file using Java cod with the help of Timer class for scheduling. The script inside the bat file is :
jmeter -n -t E:\Jmeter.jmx -l E:\test.txt
Using above script I get summary report in test.txt which looks like:
1440049645804,576,SOAP/XML-RPC Request,200,OK,Thread Group 1-1,text,true,583,1,1,574
The result was same even when the server was down. I added "View Results Tree" as listener in GUI and saved it but still the result was same. By default the non GUI mode gets just the summary. I would want the Response data of Result tree as well.
The Response data shown above confirms whether server is returning valid data or not. Is there any way I could add up the Response data to my result file?
Also I found the test plans could be run inside the java code using the JMeter API's and Interface i.e JavaSamplerClient . I searched but could not find a live example that I could understand clearly.
Thanks in advance.
In order to see response data you need to do the following:
Switch JMeter output format to XML
"Tell" it to save response data
Command line solution will look like:
jmeter -Jjmeter.save.saveservice.output_format=xml -Jjmeter.save.saveservice.response_data=true -n -t E:\Jmeter.jmx -l E:\test.txt
In regards to running JMeter test from Java see chapter 4.2 Running an existing JMeter Test from Java code of the 5 Ways To Launch a JMeter Test without Using the JMeter GUI guide.
JavaSamplerClient - is the way of creating custom Java Request Samplers, I doubt that it is what you looking for

Converting oracle form FMB's to XML

I'm trying to convert oracle forms FMB files to XML. To do this I'm using forms developer 10's native Java tool. This works fine on my local computer but I'm trying to automate the conversion process on a server.
I've taken the main folder "Dev10G" from my forms install directory and added it to the server, but I'm getting the error that you can see in the screenshot. I'm trying to avoid doing a full install of forms developer on the server if I can help it. Has anyone any suggestion on what I might try next.
Thanks
You need to exit the bat file in textpad.
You will then need to change the paths.
I you need extra help feel free to checkout my note how to do it here
https://oracleformsinfo.wordpress.com/2011/12/16/batch-script-for-fmb-to-xml-and-xml-to-fmb/

Java program to sign pdf files fails when executing it with php exec from the web browser

I use a java program to stamp and sign pdf files from the a php web. I run it with php's exec function and all works great with small files but when I try to sign pdf files heavier than 60mb it crashes and outputs nothing. Normally when it fails because of a java problem prints error messages, but this time it outputs nothing and the pdf is created with 0 bytes.
If I run the java program directly on the server or execute the php script on the server with the php command works fine. The problem occurs only on the web browser.
Anyone can help me to find a solution? Thanks.
I think that the problem comes from your web server configuration. See the upload_max_filesize property in your php.ini and change the limit.
upload_max_filesize = 100M for example
You can also modify this property :
post_max_size = 100M

Java program for Data Processing and Matlab code for results plotting

I am a beginner in the field of Data Mining. I have a data which i need to process before visualizing any useful results. So I do the following:
Preprocess data using Java Program ( Output : txt files) (Input: FileNames)
Convert .txt files to .xls files ( Excel file)
Import excel file in MATLAB
Write Matlab Script to draw some plots on the imported data
I wish to automate this process by just pressing run button and then it happens automatically.
Please guide me how to integrate my work so instead of doing these 4 steps each time i just provide input file names and all the work is done in one go.
Thanks!
You can use arbitrary Java classes from within MATLAB - it is supported to run user-defined classes and even pass data between them and MATLAB. This would give you the following benefits:
no need to write text files/XLS and then import them into matlab
write everything in one MATLAB script - that is what duffymo had in mind, just that you do not need any shell/batch processing. Everything is done in MATLAB
you could add a MATLAB-implemented GUI to handle the process
Have a look at this SO post for some insights.
You want a scripting language: Windows command if you're on that platform; shell scripts on Linux.
It might not be a button, because that implies a UI. You have to write what amounts to an application for that.
The java matlabcontrol library might come in handy
http://code.google.com/p/matlabcontrol/
I had a similar task some time ago. Matlabcontrol is a library which connects MATLAB to your Java program and is quite easy to use.
All steps can be done in Matlab environment.
Java code can be called in Matlab directly. Just add your java class path to Classpath.txt in Matlab and import in the script code.
Maybe CSV data file is better for your case.

How to get unix command line in a web application?

Here's what I'm looking at doing. I've certain log files on a unix box. The files are in the range of 10-100 MB. What I'm looking at building is have a web application in which I can have the unix command line, where I can type my commands like grep,ls etc and then the output that the command gives can be displayed in a table/gridview in the web app. Is this possible to do? I'm looking at a solution possibly in Java. The only thing I cannot use is Microsoft stack.
Have you tried the web SSH clients listed here: http://en.wikipedia.org/wiki/Web-based_SSH
java Runtime can help you. It will allow you to create process and execute the command inside the process and get the results back.

Categories

Resources