|
|
I already seen this link but i didnt get it.
Do u have any other Ideas??
Thanks for your answer.
Regards
Yogesh
|
|
|
|
|
actually the answer is in the code at the bottom of the page.
|
|
|
|
|
My project code which is in executable form MS-DOS BATCH File, is not execute.It just blinks.I can't execute it.what to do? My friend said, to make some changes in properties.But i d'nt know how to do it.Please help me...
|
|
|
|
|
ammu23 wrote: My project code which is in executable form MS-DOS BATCH File
So which is it, executable or batch file?
ammu23 wrote: My friend said, to make some changes in properties
Whose properties, Windows, your app, the bank?
Try and be a bit more specific about your problem:
- is this a Java program?
- what part of the source code fails, i.e. have you run it in the debugger?
MVP 2010 - are they mad?
|
|
|
|
|
I cant execute my java program which is in MS Dos Batch File format.It just blinks when i click on it.What should i do to execute it.
|
|
|
|
|
ammu23 wrote: I cant execute my java program which is in MS Dos Batch File format.It just blinks when i click on it.What should i do to execute it.
Well you have just repeated the question that I asked you to clarify, because it makes no sense. How can a Java program be "in MS Dos Batch File format"? Either you have a Java program which fails for some reason, or you have an MSDos Batch File which does something similar. Try to explain exactly how you created this program - if it is Java then do you have the source code, and if so can you run it through your debugger?
MVP 2010 - are they mad?
|
|
|
|
|
Try calling the batch file from a command line rather than clicking on it to run it. That way, if you are getting any error messages being displayed when the batch file execution fails you will get a chance to see them.
Possible problems range from errors in the Java code through to not having the java exe in the path. There are too many possible errors to know what to advise until you find more information about why it's failing.
|
|
|
|
|
I want to return an XML document via HTTP. Here is the code:
package gmit;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class XMLServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
response.setContentType("text/xml");
File file = new File("../webapps/xml/WEB-INF/etc/flights.xml");
FileInputStream in = new FileInputStream(file);
PrintWriter out = response.getWriter();
int i;
while ((i = in.read()) != -1)
out.write(i);
in.close();
}
How do I execute this code? The goGet() method takes two parameters but I don't know what the parameters are.
|
|
|
|
|
numbskull20 wrote: The doGet() method takes two parameters but I don't know what the parameters are.
Is this not your code?
MVP 2010 - are they mad?
|
|
|
|
|
No, I got it from a book. Murach's Java Servlets and JSP.
|
|
|
|
|
numbskull20 wrote: No, I got it from a book. Murach's Java Servlets and JSP.
Maybe you need to spend more time reading the book?
MVP 2010 - are they mad?
|
|
|
|
|
|
numbskull20 wrote: Grest help. Thanks.
I'm not sure whether your response was sarcasm or not but just to clarify my position, which I may not have made clear. Your code (taken from a book that I have not read) contains the following lines
public class XMLServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
response.setContentType("text/xml");
You then state that you do not know what the parameters to the doGet() function should be. If the book does not explain it how can anyone here?
MVP 2010 - are they mad?
|
|
|
|
|
Plus this is a web question so of it goes to web development forum.
|
|
|
|
|
I think that's arguable, after all it is Java source.
MVP 2010 - are they mad?
|
|
|
|
|
Hello Friends
I have to read a file in binary mode as we do in c++ by using ifStream.
Is there any way in java to do that?
Thanks In Advance.
Yogesh
|
|
|
|
|
You should really make more use of the tutorials[^] for basic questions. Java, like most languages, supports I/O from basic byte/byte-stream right through to Object serialization.
MVP 2010 - are they mad?
|
|
|
|
|
Hello Friends
I created a project in java tht Encrypts and derypts a file.But first of all I want to know Is that Possible If i use the same code in C++ way to encrypt and decrypt the same file thru java Code.
Another Question is Can I convert Directly my java code to C++ file?
Thanks & Regards
Yogesh Sikri
|
|
|
|
|
1. Given the same key, file, and algorithm then yes.
2. Depends on the implementation of the Java code.
|
|
|
|
|
Encryption in C++ is not quite as simple as in Java but it can be done. You may find articles about it either here or via Google. See also my response here[^].
MVP 2010 - are they mad?
|
|
|
|
|
In college, I was given an assignment, to use these methods to sort a list alphabetically from the args array from a cmd prompt input from the user.
I can take in and print out the list, sorted, however, when I sort it, it doesn't print correctly, eg 1 2 3 4 5 might print as 1 2 4 3 5.
My source code can be seen here:
[MySortProgram Source Code]
|
|
|
|
|
You're forgetting to reset maxSoFar, and Bad Things happen when i == 0
|
|
|
|
|
Can you explain how to "reset" maxSoFar? I thought i just gotta swap the index into temp and then change the small to that index and then the temp to the max so far?
What will happen when i reaches 0?
|
|
|
|
|
bmnot wrote: I thought i just gotta swap the index into temp and then change the small to that index and then the temp to the max so far?
Yes, that is right.
But what you're doing now is remember the index of the global max of the entire array, instead of just the part that you're supposed to be looking at. The next iteration you will need the max of a smaller part of the array, not the global max.
The Bad Things that happen at i == 0 are also partially a result of not resetting maxSoFar, it will not search for a new max (since 0 is not smaller than 0), and then swap them anyway. If you found the correct max (maxSoFar = 0 be cause it's the only one you can still scan) then swapping 0 with 0 has no effect, but you'd still have the old max, so strange things happen.
|
|
|
|