Hello everyone. I am having a problem in using MultipartRequest class for uploading file. I had successfully compiled my program with no errors ,downloaded the cos.jar file and set the classpath using command prompt. But when I run my servlet on Weblogic 8.1 or Apache Tomcat server, it gives error which says : java.lang.NoClassDefFoundError: com/oreilly/servlet/MultipartRequest at uploadservlet.doPost(uploadservlet.java: 16) at javax.servlet.http.HttpServlet.service(H ttpServlet .java:760) at javax.servlet.http.HttpServlet.service(H ttpServlet .java:853) ..... ... Can any one please guide me how to remove this error. Thanks and regards,,
Hello forum. I am confused. I am writing a method that takes in a int value and a base and from those two find the base number . For example: The method takes a number, say 342, and converts it to a base (any base). I understand the algorithm, cant fathom the code Heres what I know value % base = first digit starting from right (value/base) % base = second digit starting from the right (value/base^2)% base = third digit starting from right... ,... and so forth. I am not sure how to write this loop. I was thinking a while...I cant see this. Can some one help me better understand how to loop this? THanks in advance
Hey all. I am trying to find the millionth prime number. My code's functionality is fine, but it takes too long to run (about 3 minutes) I want to make it run in about a minute or less. Here's my code: Code: import java.util.*; public class Mainn public static void main(String[] args) int count = 0; int number = 2; ArrayList a = new ArrayList(); while(count < 1000000) int c=0; for(int i = 2; i <= Math.sqrt(number) ; i++) { if (number%i == 0) //check to see if it is even c=1; break; //end loop if even if(c==0) a.add(number); count++; number++; }//end of while System.out.println(a.get(a.size()-1)); //prints last element of the arraylist which is the 1 millionth prime number long startTime = System.currentTimeMillis(); long total = 0; for (int i = 0; i < 1000000; i++) tot
Hello forum, I would like to build a simple Java server that can receive TCP messages from different endpoints that use Java, C++ or any other language. As far as I know the following message properties are critical: byte order, encoding and number representation. However, I don't know which Java Streams and Writers write Java specific code (like ObjectOutputStream does) and which can be used to communicate with a non-Java endpoint. Thanks for any help.
Hi, im new to Java and learning how to program through a book. Im working on adding a method to a class but I am getting an error when compiling and im not sure what i need to do to the method to allow it to be read. Any help is much appreciated :o) Here is the problem. im using eclipse to compile. The class is saved as AddMeth.java. I had no problems previously adding class vehicle to an existing class before i prepared AddMeth. Error message: Minivan can carry 7.Exception in thread "main" java.lang.NoSuchMethodError: vehicle.range()V at AddMeth.main(AddMeth.java:28) code class vehicle{ int passengers; int fuelcap; int mpg; void range() System.out.println("The Range is " + fuelcap * mpg); public class AddMeth { public static void main(String args []){ vehicle minivan = new vehicl
I am trying to write a Java program that runs on the server as a CGI and then it will be able to save an uploaded file. I am running on an MVS system so I can't use imports like javax.* or apache.* and most examples use those imports. I have code that parses the data from the HTML POST but I am not clear on how I get the Data Input Stream to save it on the Server ? Thanks
Hello. Why is it necessary to have a semicolon after a closing curly brace? I thought the purpose of the curly braces was simply to identify a code block. So what purpose does the semicolon after a closing curly braces serve? Ex. The compiler is telling me I need a semicolon after the last closing curly brace of this block of code. With the added semicolon, the code compiles OK. Code: ActionListener action = new ActionListener() { public void actionPerformed(ActionEvent evt) { if (boat != null) { boat.updateForNewFrame(); bomb.updateForNewFrame(); sub.updateForNewFrame(); repaint(); Thanks in advance.
Hi , My web application is deployed on my machine . I can access thru Url and access the API's . But when I am trying to access the API thru Java code,HTTP 405 Status Error: Method not Allowed comes up. The request will be in this form: abc XYZ url : http://127.0.1.11:5555/IDXWeb/TestServic e.htm My java code is like this : package gepoc; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import java.io.StringWriter; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.util.logging.Level; import java.util.logging.Logger; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory ; import javax.xml.parsers.ParserCon
What is new in this release? The long awaited version of Aspose.Cells for Java 7.5.0 has been released. This maintenance release contains enhancements and fixes for the issues reported in earlier versions. In this release, we have provided support to fonts in rendering image files when the required font is not found. We also resolved an issue caused by JBOSS for mixed cases Java classes for the users. Several other important issues have been addressed. For example, issues around rendering Microsoft Excel files, rendering charts, manipulating worksheets and rendering to PDF format have been resolved. Issues pertaining to the formula calculation engine have also been fixed in this release. This release includes plenty of improved features and bug fixes as listed below Use java.awt.Font to
My question: how to trigger an event by using a random boolean? I want a action event to happen in my program but I only want the action performed if the boolean is true(for example by clicking on a button I want something to display or not if the boolean is true). I want to use a random boolean, and then use an if statement to test to see if the boolean is true and if so then display like a JDialog or something. Here is some of the code for what I am trying to do //rob boolean declared as true in constructor public boolean randomBoolean(){ return Math.random() < 0.5; private void LeaveTownActionPerformed(java.awt.event. ActionEven t evt) { rob=randomBoolean(); if(rob==true){ Dialog.showMessage("You have been robbed"); So why doesn't this code work?????????? Thanks
I am trying to iterate through a directory and a search for any file that contains .log in its name, and save these names into a string array. The directory which I want to search is where ever the .class or .jar will be located (i.e. if i put the program onto the desktop, it will look through all file names existing on the desktop). Is there a way to do this?
I need to search for a specific pattern in a string. I need to identify if a string contains a 10 character sequence that begins with C, and contains both and only numbers and letters (i.e. no symbols), and all characters must be uppercase. I did look into regex's but I didn't fully understand them, and I am not even sure if this is what to use for such a task. I would also need to get the index of this character sequence when found as well. Can anyone help me out?
Hi, I have written one Telnet based connection class to send and receive response from Network. Here I am facing an issue when I am reading the Network response in byte[] by using TelnetConnection.read(byte[]) method, at a time I am receiving maximum of 1024 bytes only and due to this I am getting only half of the response in that request. Pls.let me know the solution to get the entire response in single request. Thank & Regards, RK.
EDIT So i have finally resolved my problem all I did was add @Context private HttpServletRequest request; which allowed me to call return request.getSession().getId(); within my RESTful web service. So im developing some code that allows a user to upload a file using apache tomcat. I have the upload portion working correctly but what I am having trouble with is the code to obtain a users session ID because all i can find is examples that show how to get a session ID using servlets but i am not using a servlet i am using a RESTful webservice. My question is, is it possible to obtain the users session ID without using a servlet because i havent found any way to do this
Hi , Could you please advise I Have a program that works find with Java 1.6 but not with Java 1.7 ( user can't enter input ) I didn't wrote the code just need to fix it ... The problem is related to " netscape.javascript.JSObject" witch is define to work with java-plugin-1.6.0.23 Q -1 - Where ( in the project ) should the java-plugin- 1.6 .0.23 is define ? Q -2 - Is there a java-plugin- 1.7 for " netscape.javascript.JSObject" ? Thanks
Hi, I'm trying to make an interactive game for school and I'm trying to do it in java. What I mean with an interactive game is this: for example, I put a video of basketballer dunking in java. However I want to pauze at certain points. So, for example, when he's about to jump the video pauzes (or slows down) and you need to press space in order to continue the video. After that when he's almost at the ring it pauzes again and then you need to press arrow keys up, right and down. This idea sounded very simple to me, but I can't even get it to work to play a video in java. I want to put a small menu screen in the beginning and I want to use multiple videos. I tried JMF, but it says it can't create a player for any of my videos (.mov .avi .mp4 ...). Can anyone tell me how I should handle this
I have a java app that displays a slideshow. Some of the files are movies instead of photos. When a movie comes to be displayed the action depends upon the OS. On Mac OS X it calls exec() VLC to play the movie. This works, but... VLC displays behind my App. OK so I add -video-on-top to VLC command line. Movie now visible but VLC is still a background process (key presses go to my app while movie is playing). I want keypresses to go to VLC until the video finishes (then VLC quits automatically). How can I use exec to launch a (Mac OS X bundle app) in the foreground?
Hello I am new to servlets.I have installed eclipse juno and installed Apache tomcat 6.0 in it.I wrote hello world in servlets and tried to execute it.I end up with http-404 error.I have oracle database client at 8080.So i changed the connector port to 8081 in config.Still i find in the eclipse console that tomcat is running on 8080.I am clueless as i am new to it. Sometimes I get this error also."several ports(8080,8009)required by tomcat are already in use. Can someone help me?
As the title says Im trying to output to a JTextArea in real time exactly how the console works. What I have so far is a GUI when the user enter a integer and button is clicked loops starts and only outputs the whole result once all the calculations and loops finish. Also I am using the .append() method to output to JTextArea. How can I resolve this problem ?