Servlets :: How To Execute Batch And Exe File

Jun 23, 2014

Question : How to execute batch file & .exe file using jsp servlet?I am giving input for blast in the FASTA format. After that i wants to make the sequence.FASTA file in my project folder. And I wants to execute batch file with parameters as blastp.exe file, sequence. FASTA file, database files, output file.

There is no problem in the file creation of sequence.FASTA

ERROR IN: the batch file is not execute, So the I am not able to get the output file for display.

ERROR is : java.io.FileNotFoundException: D:vaibhav_workspace.metadata.pluginsorg.eclipse.wst.server.core mp4wtpwebapps oxin-dataoutputprotein.txt (The system cannot find the file specified)

Technologies Used :JSP,Servlet,Process-builder

I have the following code as :

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
String values=request.getParameter("t1");
ServletContext servletContext = request.getSession().getServletContext();
servletContext = request.getSession().getServletContext();
String path="//sequence.FASTA"; /*file is created in getRealPath()*/

[Code]...

Here the getRealpath() is:

D:workspace.metadata.pluginsorg.eclipse.wst.server.core mp4wtpwebapps oxin-data

My all files in the project folder as toxin-data

View Replies


ADVERTISEMENT

Batch File With Some Relative Folders

Jul 17, 2014

Batch file (. BAT) problems with some folders on. I created an application in Java and put the JRE folder within the application, because some users do not have Java installed on your machine and the way I did, my application runs. JAR with the JRE that is contained in my application but I created a BAT file that contains the following command:

start "" jre8 bin javaw-jar app.jar

So I run my program in java through the file. BAT calling JRE that is inside the folder and then this JRE runs the mine. JAR and works great anywhere in windows, worked well on a USB key with this command is within. BAT (start "" jre8 bin javaw-jar app.jar).

BAT in certain folders, eg Program Files and Program Files (x86), I need this code to be able to find any directory, regardless of whether the directory has spaces in the name, symbols, numbers or anything else, because maybe people will put the application folder to another location or rename the folder, and if this happens the program will stop working? And especially do not give problems to run inside the Program Files and Program Files (x86) because the application runs everywhere except in these two folders.

View Replies View Related

Display Jtextfield Value In Batch File Command Prompt

Apr 16, 2015

I am making a ui in which i have a JTextfield and a JButton(run). I am reading values to JTextField from text file and on pressing Jbutton a Batch file runs. Now when i press the Jbutton the batch file runs showing number running, in place of number running, i want to display the JTextfield value. So i want in place of number running it should display JTextfield value running. How can i achieve it.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
import java.awt.event.*;

[Code] .....

a.text: 1248
p.bat:
echo number running
pause

View Replies View Related

Run Jar File From Batch File And CMD Manually

Jun 7, 2014

I get the following error when I try to run my jar file from a Batch file and CMD manually (The batch file is just set to run the jar and record any output to a text file, and open it after).

Exception in thread "main" java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(Unknown Source)
at com.github.bewd.project.main.Main.<init>(Main.java:37)
at com.github.bewd.project.main.Main.main(Main.java:76)

However running from Netbeans, it works perfectly; JFrame and all. I'm not sure if it's something wrong with my classpath (which I don't think is likely) or something in my code that's affecting it, here's the code:

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.math.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.Scanner;
import java.util.logging.Logger;
import javax.imageio.ImageIO;

[code]....

View Replies View Related

How To Execute Jar File

Apr 3, 2007

How can I execute a jar file ?

how can I make such file ?

Will it be executed as an exe file in windows ?

View Replies View Related

Execute Data From Multiple CSV File

Jan 19, 2015

There are multiple .CSV files (each file has multiple rows and columns). I need to fetch data from all the files and find MEDIAN of the values for each column and do further calculations. Suppose there are 3 files, i need to find the MEDIAN of column 1 in file1, MEDIAN of column 1 in file2, MEDIAN of column 1 in file3. Below code just fetch data from one file.

package testdatapkg;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
 
[code]....

View Replies View Related

How To Make Java Read SQL File And Execute It In Phpmyadmin

Feb 8, 2015

I'm trying to make the program read the "Entity.sql" File and then execute it to make it run in phpmyadmin. I did used a mysql connector to link netbeans to mysql and then it should used the Connection for phpmyadmin to execute the Statement (Entity.sql).The Entity.sql file contains as sql Statement:

CREATE DATABASE IF NOT EXISTS Student

The problem is that it's not working and it's giving me this error:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

here is my entire code:

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.*;
import java.io.*;
import java.util.*;

[code]....

I want the program to first

1- Read the Entity.sql file

2- Execute the file into phpmyadmin

View Replies View Related

How To Make Java Read SQL File And Execute It In PHPMyAdmin

Feb 8, 2015

I'm trying to make the program read the "Entity.sql" File and then execute it to make it run in phpmyadmin. I did used a mysql connector to link netbeans to mysql and then it should used the Connection for phpmyadmin to execute the Statement (Entity.sql)..The Entity.sql file contains as sql Statement:CREATE DATABASE IF NOT EXISTS Student

The problem is that it's not working and it's giving me this error:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorEx ception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

here is my entire code:

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.*;
import java.io.*;
import java.util.*;

[code]....

I want the program to first

1- Read the Entity.sql file

2- Execute the file into phpmyadmin

View Replies View Related

Batch Printing Of Files In Java

May 21, 2014

One challenging task in java i am facing is, batch printing of files in java .....

View Replies View Related

Servlets :: File Is Located In Root Directory Of Project But System Cannot Find File Specified

Jan 10, 2015

I need to make some operations with a file. I struggle to understand why Apache is throwing this error:

(The system cannot find the file specified)

My file is located in the root directory of the project.

And here is how I indicate the path to it:

String filePath = "default.jpg";
InputStream inputStream = new FileInputStream(new File(filePath));

If I put the file in the Eclipse folder, it works... But I need it to work if I put it in my project's root folder.

View Replies View Related

Servlets :: How To Upload File To Dropbox With Only File Name (without Path) Using Java

Dec 1, 2014

In my web application i want to upload file to drop-box. I am getting file name from browser.Is it possible to upload file to drop-box with only file name.

Below the drop-box upload code with java.

File inputFile = new File("New Text Document.txt");
System.out.println("inputFile.getAbsoluteFile(): " + inputFile);
FileInputStream inputStream = new FileInputStream(inputFile);
try {
DbxEntry.File uploadedFile = client.uploadFile("/magnum-opus.txt",
DbxWriteMode.add(), inputFile.length(), inputStream);
System.out.println("Uploaded: " + uploadedFile.toString());
} finally {
inputStream.close();
}

In the above code the place New Text Document.txt we have to provide total path of file.

View Replies View Related

If Else - How To Not Execute Both Statements

Oct 4, 2014

I am making a program, where the user answers 3 questions and then I add the number of correct answers in to the (int) numberofcorrect variable, then I want to print the results, and no matter how many correct, the program executes first the correct if statement, then the else statement.

Eg: I have 2 correct it will print:

"Grade B, 2 of 3 "

"You failed the test"

Why does it do that? How can I change my code so the else statement dosent print if one of the if statments is allready printed?I want to know how to not execute the else statement, if one of the if statements have allready been executed.Below is my current code for this problem:

if (numberofcorrect == 3){
System.out.println("Grade A, full score");}
if (numberofcorrect == 2){
System.out.println("Grade B, 2 of 3 ");}
if (numberofcorrect ==1) {
System.out.println("Grade C, 1 of 3");}
else {
System.out.println("You failed the test"); }

View Replies View Related

Servlets :: Reload Particular Div Tag Of JSP File?

Jul 9, 2014

Can I reload a particular div tag of jsp file from servlet?

View Replies View Related

JSP :: Execute Code After Every 10 Seconds

Feb 25, 2014

I want to execute my jsp code to compare two dates after every 10 seconds if user enter date and current sys date are equal it will send the mail to the user automatically. Below is my jsp code

this if condition i want to check the date after every 10 seconds and when two dates are equal it will send the mail using below mail code

if(ExpcReDt.compareTo(dateStr)>0) {
out.println("Expected return date is greater than current date");
}
else if(ExpcReDt.compareTo(dateStr)==0)

[code]....

View Replies View Related

The Nested While Loop Will Not Execute

May 21, 2014

//Main method
public static void main(String args[])throws IOException{
boolean runProgram = true;
Scanner keyboard = new Scanner(System.in);
//runs program while runProgram is true
while (runProgram){

[code].....

View Replies View Related

Program Compiled But Not Able To Execute

Apr 23, 2014

I am able to compile the below program but not able to execute.

public class String {
public static void main(String[] agrs){
System.out.println("Hello String");
}
}

Output Error:

Class String does not have a main method

View Replies View Related

Compiles But Won't Execute - JCreator

Oct 18, 2014

I was typing up this program and when I compile it, there aren't any errors, but it won't advance past the second conditional.

Here's the code:

import static java.lang.System.*;
import javax.swing.JOptionPane;
import java.util.*;
public class area51
{
public static void main(String args[])

[Code] ....

The first two answers are 41 and right.

View Replies View Related

Servlets :: File Not Getting Retrieved From Database

May 12, 2014

I want to retrieve file from database which is stored with blob datatype and i am passing manually id associated with in code. Its not retrieving the file.

public class retrieve_image extends HttpServlet
{
/**
*
*/
private static final long serialVersionUID = 1L;
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
ResultSet rs = null;

[Code] .....

View Replies View Related

Servlets :: Writing A File Inside WEB-INF?

Nov 29, 2014

I want a servlet to write a file inside WEB-INF folder

I tried these things

File file =new File("feedback.txt");

or

File file =new File("/feedback.txt");

or

File file =new File("WEB-INF/feedback.txt");

View Replies View Related

Servlets :: Submit Buttons In JSP File

Apr 30, 2014

A user can dislike/like a topic. However I have to submit buttons in my jsp file, the issue is that when a user presses like/dislike it should print out on the consile line. It does that perfectly but it prints out both when it should only print out either like or dislike.

My JSP code:

<form name = "ViewTripServlet" action="ViewTripServlet" method="post">

</br>
</br>
</br>
<input type="image" name = "like" value="submit" src=images/like.png onMouseOver="this.src='images/like.png'">
</br>
</br>
</br>
<input type="image" name = "dislike" value="submit" src=images/dislike.png onMouseOver="this.src='images/dislike.png'">

</form>

Servlet Code:

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ViewTri vT = new ViewTrip();
vT.user_like(request.getParameter("like"));

vT.user_dislike(request.getParameter("dislike"));

[code]....

View Replies View Related

How Compiler Picks What Method To Execute

Feb 20, 2014

public class Main {
private static void foo(Integer a) {
System.out.println("Integer");
}
private static void foo(long a) {
System.out.println("long");

[Code] ....

This code prints long. Why is that? How did compiler decided that it likes long version of foo() method the most. If I had to guess I'd pick int... or possibly Integer as they are most similiar to what was passed. But why long?

View Replies View Related

Unable To Execute The Mail Code

Mar 6, 2014

I am unable to run this java mail code, whats the error!!

public class Class1 {
final String senderEmailID = "from@gmail.com";
final String senderPassword = "password";
final String emailSMTPserver = "smtp.gmail.com";
final String emailServerPort = "465";
String receiverEmailID = null;

[Code] ...

I get an error as this

javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1949)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)
at javax.mail.Service.connect(Service.java:317)

[Code] ....

View Replies View Related

How To Execute And Use Win7 Speech Recognition

May 26, 2014

I want to execute and use the Win7 Speech Recognition with Java. How can I open it?

I tried to open it with "Runtime.getRuntime().exec(" ");" but I couldn't find a command to open it. How can I use the speech recognition once I opened it with commands in Java?

View Replies View Related

Jar Should Be Present To Execute Main Class

Mar 18, 2014

I have few queries regarding compiling v/s execution of a java program. Suppose I have a Main Class which is referring to class Test which is present in JarA. Now, at compile time, this jar JarA must be present in classpath/buildpath. So, what actually is the action performed by the compiler by referring to this jar?

Now, at runtime also, this jar should be present to execute the Main class. Is this correct? If yes, then what is the action performed by JRE when it refers to this class at runtime? WOn't all the dependencies be resolved at compile time only?

View Replies View Related

JVM Not Execute The Code Without Storing In Memory?

Jun 5, 2014

Any article where it mentions about when the class is loaded into memory?Does it happen before the server starts?

Also does the class needed to be loaded into memory? Can the JVM not just execute the code without storing in memory?

I searched in google. Could not get anything concrete.

View Replies View Related

How To Time While Loop To Execute Every 3 Seconds

Jul 11, 2014

How can I time my while loop to executeevery 3 seconds?

Here is my code:

class Info{
public String name;
public String version;
public String arch;
double CPUSpeed;
};
Info info = new Info();
Info[] queue = new Info[100];

[Code]...

I seem to have done it right, but it doesn't work... What is wrong?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved