Search Results

Search found 33640 results on 1346 pages for 'java generics'.

Page 164/1346 | < Previous Page | 160 161 162 163 164 165 166 167 168 169 170 171  | Next Page >

  • drawImage in Java applet flickers in Safari

    - by lcvinny
    I'm having a flicker problem in a Java applet in Safari (Mac). However, it's not the usual double buffering problem. I have isolated it down to one single drawImage call (no redundant repaint, no clear is called), which gives a white flicker before painting the image but not on every repaint. In fact, I measured the duration of the drawImage call, which is normally about 1ms, but up to 30ms about every 5th time paint is called, which is when it flickers. Repaints are triggered when I drag a component or when the window is scrolled. Is this a bug in the java implementation on OSX, and is there a fix for it?

    Read the article

  • Printing out series of numbers in java

    - by Jay
    hi guys i am just doing some reading for myself to learn java and came across this problem and is currently stuck. i need to print out series of number based on the input given by the user. for example, if input = 5, the output should be as follows @1@22@333@4444@55555 import java.util.*; public class ex5{ public static void main(String[] args){ Scanner kb = new Scanner(System.in); System.out.println("Please type a #: "); int input = kb.nextInt(); for(int i=0;i<input;i++){ if(input==1){ System.out.print("@1"); } if(input==2){ System.out.print("@1@22"); } } } } this doesnt seem to be working because this is the output i get Please type a #: 2 @1@22@1@22 im not sure what to put inside the for loop right now and i dont think i am using the for loop here very well either... any help guys?

    Read the article

  • 'void' type not allowed here error (java) help?

    - by David
    When i try to compile this: import java.awt.* ; class obj { public static void printPoint (Point p) { System.out.println ("(" + p.x + ", " + p.y + ")"); } public static void main (String[]arg) { Point blank = new Point (3,4) ; System.out.println (printPoint (blank)) ; } } i get this error: obj.java:12: 'void' type not allowed here System.out.println (printPoint (blank)) ; ^ 1 error I don't really know how to start asking about this other than to ask: What went wrong here? What does this error message mean?

    Read the article

  • Java + Eclipse + Pulpcore

    - by cable729
    I've never programmed in java or eclipse before, although I have used c# and visual studio. I'm trying to get started with java development, and develop 2d games, but I can't get the project to run. I've followed the tutorial here: http://cloningtheclassics.com/getting-started-with-pulpcore/ I've retried the tutorial at least 5 times, and I still can't get it to work. The error it displays is: Buildfile: C:\workspace\javapulp\project\build.xml [taskdef] Could not load definitions from resource tasks.properties. It could not be found. [taskdef] Could not load definitions from resource tasks.properties. It could not be found. -init: BUILD FAILED C:\workspace\javapulp\project\build.xml:127: Required file not found: ../../build/pulpcore-applet-debug-0.11.jar Total time: 1 second Thanks in advance!

    Read the article

  • Detect file system changes on Samba share with Java on Windows

    - by GHad
    Hi, for a recent project I need to detect file system changes on a mapped Samba share from java on windows: Creates, updates and removes. At the moment I am using a folder poll that maintains a list of files and their modified timestamp to look for events. But my problem is that this folder poll only peeks into the folder at certain times (every 10 seconds for example), so an updated file can be updated twice between two polls without recognizing. Is there any way to get events from windows inside Java whenever a file event occours on that mappep Samba share? Thanks!

    Read the article

  • Java/C++ communication via pipe on Windows

    - by Warlax
    Hi, I have two separate programs, one in Java and one in C++, both running on Windows. We need to do bidirectional interprocess communication between the two. Up until now, we were using this awkward solution of writing to text files and reading them on the other side, where the producer would generate a .lock file when it's done writing and the consumer would remove that when it's done reading... like I said, awkward. If we were on *nix, we would use a pipe using popen() on the C++ and RadomAccessFile on the Java side. It seems to work well. What can we do on Windows? Can we use named pipes? Thank you.

    Read the article

  • ProGuard breaks Java application - no text, no images

    - by jocull
    I'm trying to use ProGuard to obfuscate a Java application. I'm experiencing a problem where all of my text and images disappear from the GUI (Swing) forms. I've tried disabling optimizations and including more libraries, but nothing seems to be working. I've inspected the output generated by the obfuscator with a decompiler, and my resource paths seem to still be correct. Do I need to be including more core Java libraries outside of jre/lib/rt.jar? Are there more settings I should disable? ...other suggestions? Thanks.

    Read the article

  • Console class in java Exception in reading password

    - by satheesh
    Hi, i am trying to use Console class in java. with this code import java.io.Console; public class ConsoleClass { public static void main(String[] args){ Console c=System.console(); char[] pw; pw=c.readPassword("%s","pw :"); for(char ch:pw){ c.format("%c",ch); } c.format("\n"); MyUtility mu =new MyUtility(); while(true){ String name=c.readLine("%s", "input?: "); c.format("output: %s \n",mu.doStuff(name)); } } } class MyUtility{ String doStuff(String arg1){ return "result is " +arg1; } } here i am getting NullPointerException when i tried to run in netbeans but i am not getting any Exception when tried to run in cmd with out netbeans IDE.Why?

    Read the article

  • Hibernate Communications Link Failure in Restlet-Hibernate Based Java application powered by MySQL

    - by Vatsala
    Let me describe my question - I have a Java application - Hibernate as the DB interfacing layer over MySQL. I get the communications link failure error in my application. The occurence of this error is a very specific case. I get this error , When I leave mysql server unattended for more than approximately 6 hours (i.e. when there are no queries issued to MySQL for more than approximately 6 hours). I am pasting a top 'exception' level description below, and adding a pastebin link for a detailed stacktrace description. javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Cannot open connection - Caused by: org.hibernate.exception.JDBCConnectionException: Cannot open connection - Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure - The last packet successfully received from the server was 1,274,868,181,212 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. - Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure - The last packet successfully received from the server was 1,274,868,181,212 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. - Caused by: java.net.ConnectException: Connection refused: connect the link to the pastebin for further investigation - http://pastebin.com/4KujAmgD What I understand from these exception statements is that MySQL is refusing to take in any connections after a period of idle/nil activity. I have been reading up a bit about this via google search, and came to know that one of the possible ways to overcome this is to set values for c3p0 properties as c3p0 comes bundled with Hibernate. Specifically, I read from here http://www.mchange.com/projects/c3p0/index.html that setting two properties idleConnectionTestPeriod and preferredTestQuery will solve this for me. But these values dont seem to have had an effect. Is this the correct approach to fixing this? If not, what is the right way to get over this? The following are related Communications Link Failure questions at stackoverflow.com, but I've not found a satisfactory answer in their answers. http://stackoverflow.com/questions/2121829/java-db-communications-link-failure http://stackoverflow.com/questions/298988/how-to-handle-communication-link-failure Note 1 - i dont get this error when I am using my application continuosly. Note 2 - I use JPA with Hibernate and hence my hibernate.dialect,etc hibernate properties reside within the persistence.xml in the META-INF folder (does that prevent the c3p0 properties from working?)

    Read the article

  • Java respawn process

    - by Bart van Heukelom
    I'm making an editor-like program. If the user chooses File-Open in the main window I want to start a new copy of the editor process with the chosen filename as an argument. However, for that I need to know what command was used to start the first process: java -jar myapp.jar blabalsomearguments // --- need this information Open File (fileUrl) exec("java -jar myapp.jar blabalsomearguments fileUrl"); I'm not looking for an in-process solution, I've already implemented that. I'd like to have the benefits that seperate processes bring.

    Read the article

  • Writing Java code in Matlab?

    - by scooziexp
    Hi, I'm trying to use the Java commands pw.println() and br.readLine() in Matlab because I have set up a socket (input_socket2) between Matlab and a command-line program I want to control using Java classes BufferedReader and PrintWriter. Before the following snippet of code, I implemented another socket that goes between 2 computers. This works great and I also know that the following snippet of code successfully opens up a communication line between Matlab and the other program. However, Matlab throws an error at pw.println('noop'). I think it has something to do with syntax, but I'm not sure how to write the command in Matlab syntax then: try input_socket2 = Socket(host2,port2); input_stream2 = input_socket2.getInputStream; d_input_stream2 = DataInputStream(input_stream2); br = BufferedReader(InputStreamReader(input_stream2)); pw = PrintWriter(input_socket2.getOutputStream,true); pw.println('noop') br.read end Any ideas?

    Read the article

  • Java not working on MacOS X Leopard

    - by eeeeaaii
    I'm running Leopard, xcode 3.1.3. When I type "java" at the command line I get this: dyld: could not load inserted library: /usr/lib/libSaturnFE.dylib Trace/BPT trap What did I do? I did do some profiling with Saturn a while back but I didn't know it was going to screw up my machine. I'm fairly sure it worked when I first installed xcode. I guess I could install a different Java SDK than the one that came with Xcode? I can't find an upgrade path for Xcode that doesn't require me to upgrade to Snow Leopard. I just don't feel like upgrading to Snow Leopard right now because I don't have good disk backups in place. edit: at least if anybody could point me to a resource or even a Mac forum where I could ask this question it would be really helpful.

    Read the article

  • Java NoSuchElementException using scanner.nextInt()

    - by othnin
    I am trying to read in a pgm file (512x512 array) and when I read in a larger file I get the error: java.util.NoSuchElementException on reading element (3,97). I have created a much smaller file to read (23x23) and it reads fine. Is there a size limit? I have checked the file and confirmed that there is an int for the value: This appears to be the line it crashes at: fileArray[row][col] = scan.nextInt(); Here is the file: import java.util.Scanner; import java.io.*; public class FileReader { public static void main(String[] args) throws IOException { String fileName = "lena.pgma"; int width, height, maxValue; FileInputStream fileInputStream = null; fileInputStream = new FileInputStream(fileName); Scanner scan = new Scanner(fileInputStream); // Discard the magic number scan.nextLine(); // Discard the comment line scan.nextLine(); // Read pic width, height and max value width = scan.nextInt(); System.out.println("Width: " + width); height = scan.nextInt(); System.out.println("Heigth: " + height); maxValue = scan.nextInt(); fileInputStream.close(); // Now parse the file as binary data FileInputStream fin = new FileInputStream(fileName); DataInputStream dis = new DataInputStream(fin); // look for 4 lines (i.e.: the header) and discard them int numnewlines = 4; while (numnewlines > 0) { char c; do { c = (char)(dis.readUnsignedByte()); } while (c != '\n'); numnewlines--; } // read the image data int[][] fileArray = new int[height][width]; for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { fileArray[row][col] = scan.nextInt(); System.out.print("(" + row + " ," + col +"): " + fileArray[row][col]+ " "); } System.out.println(); } dis.close(); } } any advise would be appreciated.

    Read the article

  • Java EE - newbie question (not related to learning JEE)

    - by UnCon
    I've read lot of articles saying, that Java EE is most popular enterprise solution nowadays. Let's not argue if it is most popular or second most popular or what. The thing is : I see almost all web pages with extension like .html, .php and .aspx. Why there is (almost) none .JSP ? Why so ease to find ASP.NET pages if it is supposed to be less popular? Please I am not programming with Java EE (yet) so don't blame me, if I am completely wrong. The answer with patience would be greatly appreciated!

    Read the article

  • Good design of mapping Java Domain objects to Tables (using Hibernate)

    - by M. McKenzie
    Hey guys, I have a question that is more in the realm of design, than implementation. I'm also happy for anyone to point out resources for the answer and I'll gladly, research for myself. Highly simplified Java and SQL: Say I have a business domain POJO called 'Picture' with three attributes. class Picture int idPicture String fileName long size Say I have another business domain POJO called "Item" with 3 attributes Class Item int idItem String itemName ArrayList itemPictures These would be a normal simple relationship. You could say that 'Picture' object, will never exist outside an 'Item' object. Assume a picture belongs only to a specific item, but that an item can have multiple pictures Now - using good database design (3rd Normal Form), we know that we should put items and pictures in their own tables. Here is what I assume would be correct. table Item int idItem (primary key) String itemName table Picture int idPicture (primary key) varchar(45) fileName long size int idItem (foreign key) Here is my question: If you are making Hibernate mapping files for these objects. In the data design, your Picture table needs a column to refer to the Item, so that a foreign key relation can be maintained. However,in your business domain objects - your Picture does not hold a reference/attribute to the idItem - and does not need to know it. A java Picture instance is always instantiated inside an Item instance. If you want to know the Item that the Picture belongs to you are already in the correct scope. Call myItem.getIdItem() and myItem.getItemPictures(),and you have the two pieces of information you need. I know that Hibernate tools have a generator that can auto make your POJO's from looking at your database. My problem stems from the fact that I planned out the data design for this experiment/project first. Then when I went to make the domain java objects, I realized that good design dictated that the objects hold other objects in a nested way. This is obviously different from the way that a database schema is - where all objects(tables) are flat and hold no other complex types within them. What is a good way to reconcile this? Would you: (A) Make the hibernate mapping files so that Picture.hbm.xml has a mapping to the POJO parent's idItem Field (if it's even possible) (B) Add an int attribute in the Picture class to refer to the idItem and set it at instantiation, thus simplifying the hbm.xml mapping file by having all table fields as local attributes in the class (C) Fix the database design because it is wrong, dork. I'd truly appreciate any feedback

    Read the article

  • Running a Java process in Windows even after the user is logged out

    - by Mani
    I have a batch file that starts a Java process in a Windows 2003 server. As per the security policy, the users of that machine are logged off forcefully, if the user is inactive for a certain period of time. The problem is that when the user is logged out, the process also dies. I scheduled a new task (Control Panel - Scheduled Tasks) and selected the option of 'When my computer starts' and gave the user account details there. But it doesn't seem to have any effect, the user is still logged out and the process dies. Is a reboot necessary to make this change effective? And after the reboot, will I achieve what I'm expecting (keeping the process alive)? Alternatively, will running this process as a Windows Service solve the problem? If so, can you please let me know how I can make a Java program or a batch file to run as a Windows Service? I would prefer not to use any other third party tools or libraries. Thanks

    Read the article

  • Can I add elements to a Java GUI?

    - by Asj
    I want to know how I can make a java program where an unknown amount of objects can be added to a GUI depending on user input. I can program in objects one at a time within the program, but I haven't seen a more dynamic program. Can I do that with Java? If not, what can I do it with? For more information, here's a picture. http://i6.photobucket.com/albums/y223/Asj127/CapProjIdea.jpg There can be more than one question per question block, and each question can have it's own question block.

    Read the article

  • reading html from an inputstream java

    - by randeel wimalagunarathne
    hello everyone, I am reading a html file using an inputstream from a java servlet. But the contents of the original and the read one are in a different format although when displayed in a web browser they are the same. These are the two links for the html files after reading output http://www.fileflyer.com/view/gQREGAe orginal output http://www.fileflyer.com/view/mWXHVAE Is there a way to get the original html when reading? why is this happening? my java code is as follows; InputStreamReader isr = new InputStreamReader(inputStream); BufferedReader br = new BufferedReader(isr); String line = null; while ( (line = br.readLine()) != null) { System.out.println(line); } Any help would be greatly appreciated!! Thank you, rana.

    Read the article

< Previous Page | 160 161 162 163 164 165 166 167 168 169 170 171  | Next Page >