Search Results

Search found 32961 results on 1319 pages for 'java webline'.

Page 83/1319 | < Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >

  • Controlling maximum Java standalone running in Linux

    - by Gnanam
    Hi, We've developed a Java standalone program. We've configured in our Linux (RedHat ES 4) cron schedule to execute this Java standalone every 10 minutes. Each standalone may sometime take more than 1 hour to complete, or sometime it may complete even within 5 minutes. My problem/solution I'm looking for is, the number of Java standalones executing at any time should not exceed, for example, 5 threads. So, for example, before even a Java standalone/thread starts, if there are already 5 threads running, then this thread should not be started; otherwise this would indirectly start creating OutOfMemoryError problems. How do I control this? I would also like to make this 5 thread as configurable. Other Information: I've also configured -Xms and -Xmx heap size settings. Is there any tool/mechanism by which we can control this? I also heard about Java Service Wrapper. What is this all about?

    Read the article

  • Java: design problem with final-value and empty constructor

    - by HH
    $ javac InitInt.java InitInt.java:7: variable right might not have been initialized InitInt(){} ^ 1 error $ cat InitInt.java import java.util.*; import java.io.*; public class InitInt { private final int right; // Design Problem? // I feel the initialization problem is just due to bad style. InitInt(){} InitInt{ // Still the error, "may not be initialized" // How to initialise it? if(snippetBuilder.length()>(charwisePos+25)){ right=charwisePos+25; }else{ right=snippetBuilder.length()-1; } } public static void main(String[] args) { InitInt test = new InitInt(); System.out.println(test.getRight()); } public int getRight(){return right;} } Partial Solutions and Suggestions use "this" to access methods in the class, instead of creating empty constructor change final to non-final with final field value: initialize all final values in every constructor remove the empty constructor, keep your code simple and clean

    Read the article

  • Where do Java Applets live?

    - by Wendi Peters
    I'm trying to figure out where java Applets that I run from the browser live. I'm using Firefox 3.0 on Windows XP with Java 1.6 if that makes any difference. From the Java Control Panel on the toolbar, I can access "Temporary Internet Files - Settings" to find the Java cache. From there I can show the resources and see a file called "dws2010066.dat". Does this resource correspond to a file on disk? I did a search in the Java cache/my whole computer and came up empty handed.

    Read the article

  • How to stop java application using a shell script

    - by Fernando Moyano
    I have a shell script, which is run under a opensuse linux, that starts a java application (under a jar), the script is: #!/bin/sh #export JAVA_HOME=/usr/local/java #PATH=/usr/local/java/bin:${PATH} #---------------------------------# # dynamically build the classpath # #---------------------------------# THE_CLASSPATH= for i in `ls ./lib/*.jar` do THE_CLASSPATH=${THE_CLASSPATH}:${i} done #---------------------------# # run the application # #---------------------------# java -server -Xms512M -Xmx1G -cp ".:${THE_CLASSPATH}" com.package.MyApp > myApp.out 2>&0 & This script is working fine. Now, what I want, is to write a script to kill gracefully this app, something that allows me to kill it with the -15 argument from Linux kill command. The problem, is that there will be many java applications running on this server, so I need to specifically kill this one. Any help? Thanks in advance, Fernando

    Read the article

  • How to get java to recognize symbolic links under cygwin

    - by Keith Randall
    Here's a very simple java program to print the first line of a file: import java.io.* public class test { public static void main(String[] args) throws IOException { System.out.print(new BufferedReader(new FileReader(args[0])).readLine()); } } When I run this program under cygwin and pass it the name of a symbolic link, it prints the contents of the symbolic link, not the target of that link: $ echo foo > testfile $ ln -s testfile symlink_to_testfile $ java test testfile foo $ java test symlink_to_testfile !<symlink> ?t e s t f i l e How do I convince java to follow the symlink? I was hoping there was something simpler than implementing the redirect myself.

    Read the article

  • Java compiler error: "cannot find symbol" when trying to access local variable

    - by HH
    $ javac GetAllDirs.java GetAllDirs.java:16: cannot find symbol symbol : variable checkFile location: class GetAllDirs System.out.println(checkFile.getName()); ^ 1 error $ cat GetAllDirs.java import java.util.*; import java.io.*; public class GetAllDirs { public void getAllDirs(File file) { if(file.isDirectory()){ System.out.println(file.getName()); File checkFile = new File(file.getCanonicalPath()); }else if(file.isFile()){ System.out.println(file.getName()); File checkFile = new File(file.getParent()); }else{ // checkFile should get Initialized at least HERE! File checkFile = file; } System.out.println(file.getName()); // WHY ERROR HERE: checkfile not found System.out.println(checkFile.getName()); } public static void main(String[] args) { GetAllDirs dirs = new GetAllDirs(); File current = new File("."); dirs.getAllDirs(current); } }

    Read the article

  • What is the most efficient Java Collections library?

    - by dehmann
    What is the most efficient Java Collections library? A few years ago, I did a lot of Java and had the impression back then that trove is the best (most efficient) Java Collections implementation. But when I read the answers to the question "Most useful free Java libraries?" I noticed that trove is hardly mentioned. So which Java Collections library is best now? UPDATE: To clarify, I mostly want to know what library to use when I have to store millions of entries in a hash table etc. (need a small runtime and memory footprint).

    Read the article

  • Java RMI : connection refused

    - by mihsathe
    I have written following code for the client of RMI. But getting java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused: connect code : import java.rmi.*; import java.net.*; import java.rmi.registry.*; class client { public static void main(String [] ars) { Iface serv; Registry r; String serveraddr = ars[0]; String serverport = ars[1]; String text = "Hey jude"; System.out.println("Sending" + text); try{ r = LocateRegistry.getRegistry( serveraddr, (new Integer(serverport)).intValue() ); serv = (Iface) r.lookup("rmi://server"); serv.receive(text); } catch(Exception e){ System.out.println(e); } } }

    Read the article

  • java.io.IOException: Invalid argument

    - by Luixv
    Hi I have a web application running in cluster mode with a load balancer. It consists in two tomcats (T1, and T2) addressing only one DB. T2 is nfs mounted to T1. This is the only dofference between both nodes. I have a java method generating some files. If the request runs on T1 there is no problem but if the request is running on node 2 I get an exception as follows: java.io.IOException: Invalid argument at java.io.FileOutputStream.close0(Native Method) at java.io.FileOutputStream.close(FileOutputStream.java:279) The corresponding code is as follows: for (int i = 0; i < dataFileList.size(); i++) { outputFileName = outputFolder + fileNameList.get(i); FileOutputStream fileOut = new FileOutputStream(outputFileName); fileOut.write(dataFileList.get(i), 0, dataFileList.get(i).length); fileOut.flush(); fileOut.close(); } The exception appears at the fileOut.close() Any hint? Luis

    Read the article

  • Sanitize json input to a java server

    - by morgancodes
    I'm using json to pass data between the browser and a java server. I'm using Json-lib to convert between java objects and json. I'd like to strip out susupicious looking stuff (i.e "doSomethingNasty().) from the user input while converting from json to java. I can imagine several points at which I could do this: I could examine the raw json string and strip out funny-looking stuff I could look for a way to intercept every json value on its way into the java object, and look for funny stuff there. I could traverse my new java objects immediately after reconstitution from json, look for any fields that are Strings, and stripp stuff out there. What's the best approach? Are there any technologies built for this this task that I tack tack on to what I have already?

    Read the article

  • why do we all learn and study java or .net or why java or .net are popular?

    - by tadeze
    My question to be clear is why do we all need to learn java or .net(C#) , still java or .net are more popular than delphi or c++ and even there are lot of resource,articles or books compared to c++ or delphi about java and .net. However, I heard majority, if I am right about 80% of software are developed using c++ or delphi in the software industry. so, why do we bother about other languages specifically about the cosmopolitan languages such as java or .net in education as well as for job interview. Although, still I know the elegance of java and .net, their safe code execution,fully objected oriented behavior ...etc, but still according to the statics they are not preferred on software develpement as a primary language mainly because of their execution time compared to c++ or delphi. So my question are why do they choose them for jobs or educational purpose and everything else? why do we lose our time learning these language if we are forced to use the other languages in the industry?

    Read the article

  • How to compile these 2 java files correctly?

    - by user198729
    I'm following the steps here, it's basically : Compile the DataSource and LiveStream classes: javac -d . DataSource.java LiveStream.java Run using JMStudio: java JMStudio screen://0,0,160,120/10 But when I compile them, got lots of errors like javax.media doesn't exist and so on. Here's the directory structure: D:\>dir 2010-06-11 22:25 <DIR> . 2010-06-11 22:25 <DIR> .. 2010-06-11 22:25 3,730 DataSource.java 2010-06-11 22:25 6,860 LiveStream.java Can someone give more detailed steps how to set up the environment correctly to compile correctly?

    Read the article

  • java.lang.UnsupportedClassVersionError in eclipse

    - by Derek
    Hi all, I am not a Java programmer really, so I am posting this question. The exception is being thrown java.lang.UnsupportedClassVersionError in my main class in an eclipse project. If I comment out the imports that this class has, it compiles and runs fine. If I put the imports back in, it does not work. Does this mean that the libraries I am importing were compiled with a newer or older version of java than I have? when i do java -version on the system i get 1.5_07 I could've sworn this was actually working last week, but maybe some setting in eclipse got tweaked? Is the Java Build Path in eclipse what I need to look for to check the JRE and compiler versions?

    Read the article

  • Create Java method from a string?

    - by drozzy
    Is it possible in Java, to declare a method with a string instead of an identifier? For example can I do something like the following: class Car{ new Method("getFoo", { return 1+1; }); } //Use it Car car = new Car(); car.getFoo(); EDIT: I am adding a Purpose WHY I need this. In order to not hardcode method names when using Jersey and it's UriBuilder, which requires a method name: https://jsr311.dev.java.net/nonav/releases/1.1/javax/ws/rs/core/UriBuilder.html See path() method with signature: public abstract UriBuilder path(java.lang.Class resource, java.lang.String method) throws java.lang.IllegalArgumentException I hope my question is clear, if not - let me know and I can clarify it.

    Read the article

  • ANTLR - Embedding Java code, evaluate before or after?

    - by wvd
    Hello all, I'm writing a simple scripting language on top of Java/JVM, where you can also embed Java code using the {} brackets. The problem is, how do I parse this in the grammar? I have two options: 1] Allow everything to be in it, such as: [a-z|a-Z|0-9|_|$], and go on 2] Get an extra java grammar and use that grammar to parse that small code (is it actually possible and efficient?) Since option 2] is basically a double-check since when evaluating java code it's also being checked. Now my last question is -- is way that can dynamically execute java code also with objects which have been created at runtime? Thanks, William van Doorn

    Read the article

  • Swing object: first setText() gets "stuck" when using Mac Java SE 6

    - by Tim
    Hi there, I am a Java newbie trying to maintain an application that works fine under J2SE 5.0 (32- and 64-bit) but has a very specific problem when run under Java SE 6 64-bit: [Tims-MPB:~] tlynch% java -version java version "1.6.0_15" Java(TM) SE Runtime Environment (build 1.6.0_15-b03-226) Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02-92, mixed mode) The application is cross-platform and reportedly works correctly on Java SE 6 under Windows, though I haven't been able to verify that myself. The program uses a JTextField for some text entry and a JLabel to indicate the text to be entered. The first time the showDialog() method is called to set the label text and display the dialog, it works correctly, but subsequent calls all result in the display of the label from the initial invocation rather than the one most recently specified via setText(). public void showDialog(String msgText) { System.out.println("set ChatDialog: " + msgText); jLabel1.setText(msgText); jLabel1.repaint(); // I added this; it didn't help System.out.println("get ChatDialog: " + jLabel1.getText()); super.setVisible(true); } [the full text of the class is provided below] The added printlns validate that expected text is passed to the label's setText() method and is confirmed by retrieving it using getText(), but what shows up on the screen/GUI is always the text from the very first time the method was called for the object. A similar issue is observed with a JTextArea used to label another dialog box. These problem are consistent across multiple Mac systems running Java SE 6 under OS 10.5.x and 10.6.x, but they are never observed when one reverts to J2SE 5.0. If there is some background information pertinent to this problem that I have omitted, please let me know. Any insights or advice appreciated. package gui; import java.awt.*; import java.awt.event.KeyEvent; import javax.swing.*; // Referenced classes of package gui: // MyJPanel, ChatDialog_jTextField1_keyAdapter, WarWindow public class ChatDialog extends JDialog { public ChatDialog(JFrame parent, WarWindow w) { super(parent, true); text = ""; borderLayout1 = new BorderLayout(); jPanel1 = new MyJPanel(); borderLayout2 = new BorderLayout(); jPanel2 = new MyJPanel(); jPanel3 = new MyJPanel(); jLabel1 = new JLabel(); jTextField1 = new JTextField(); warWindow = w; try { jbInit(); } catch(Exception exception) { System.out.println("Problem with ChatDialog init"); exception.printStackTrace(); } return; } public String getText() { return text; } void jTextField1_keyPressed(KeyEvent e) { int id = e.getKeyCode(); switch(id) { case 10: // '\n' text = jTextField1.getText(); setVisible(false); break; } } private void jbInit() throws Exception { setLocation(232, 450); setSize(560, 60); setModal(true); setResizable(false); setUndecorated(true); getContentPane().setLayout(borderLayout1); jPanel1.setLayout(borderLayout2); jPanel2.setMinimumSize(new Dimension(10, 20)); jPanel2.setPreferredSize(new Dimension(10, 20)); jLabel1.setPreferredSize(new Dimension(380, 15)); jLabel1.setHorizontalAlignment(0); jLabel1.setText("Chat Message"); jTextField1.setPreferredSize(new Dimension(520, 21)); jTextField1.setRequestFocusEnabled(false); jTextField1.addKeyListener(new ChatDialog_jTextField1_keyAdapter(this)); getContentPane().add(jPanel1, "Center"); jPanel1.add(jPanel2, "North"); jPanel2.add(jLabel1, null); jPanel1.add(jPanel3, "Center"); jPanel3.add(jTextField1, null); } public void setVisible(boolean b) { jTextField1.setText(""); super.setVisible(b); } public void showDialog(String msgText) { System.out.println("set ChatDialog: " + msgText); jLabel1.setText(msgText); jLabel1.repaint(); // I added this; it didn't help System.out.println("get ChatDialog: " + jLabel1.getText()); super.setVisible(true); } void this_keyPressed(KeyEvent e) { int id = e.getKeyCode(); switch(id) { case 10: // '\n' System.exit(88); break; } } BorderLayout borderLayout1; BorderLayout borderLayout2; JLabel jLabel1; JPanel jPanel1; JPanel jPanel2; JPanel jPanel3; JTextField jTextField1; String text; WarWindow warWindow; }

    Read the article

  • Book recommendation for a Ruby dev learning Java

    - by cpjolicoeur
    I've been a Ruby developer for the past 4-5 years, and prior to that coded in Perl and a language called ProvideX for years. As hard as it may seem, I've never written a Java application short of the basic Hello World app probably a decade ago. I'm beginning to start doing some Android development to port some iPhone applications we did for a client over to the Android platform. As such, I'm wondering what the best reference book I can buy is to get up to speed quickly with the features (and peculiarities) of Java. There are numerous "Learn Ruby for Java programmers" out there, but not really any reference books for going the otherway of Ruby-to-Java. I'm looking for something preferably like the "Learn Perl the Hard Way" book. I know how to code, I just need a reference on learning the proper mechanics of Java after having done Ruby (and a bit of Obj-C) work exclusively for the past few years.

    Read the article

  • Java: design problem with private-final-int-value and empty constructor

    - by HH
    $ javac InitInt.java InitInt.java:7: variable right might not have been initialized InitInt(){} ^ 1 error $ cat InitInt.java import java.util.*; import java.io.*; public class InitInt { private final int right; //DUE to new Klowledge: Design Problem //I think having an empty constructor like this // is an design problem, shall I remove it? What do you think? // When to use an empty constructor? InitInt(){} public static void main(String[] args) { InitInt test = new InitInt(); System.out.println(test.getRight()); } public int getRight(){return right;} } Initialization problem with Constructor InitInt{ // Still the error, "may not be initialized" // How to initialise it? if(snippetBuilder.length()>(charwisePos+25)){ right=charwisePos+25; }else{ right=snippetBuilder.length()-1; } }

    Read the article

  • java best way to transfer images

    - by d.raev
    I have a application that reads a PDF, transform the content to collection of TIF files, and send them to Glass Fish Server for saving. Usually there are 1-5 pages and it works nice, but when I got a input file with 100+ pages... it throws error on the transfer. Java heap space at java.util.Arrays.copyOf(Arrays.java:2786) at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94) Putting more resources is not a good option in my case, so I m looking for a way to optimize it somehow. I store the data in: HashMap<TifProfile, List<byte[]> Is there a better way to store or send them ? EDIT I did some tests and the final collections for PDF with 80 pages has size over 280mb (240 tiffs with different settings inside)

    Read the article

  • Java reflection for generics

    - by Vijay Bhore
    I am using Java Reflection to expose methods in custom eclipse tool. I am writing method getReturnType which accepts java.lang.reflect.Method as input and returns object of Class private static Class<?> getReturnType(Method method) { Type type = ((ParameterizedType)method.getGenericReturnType()).getRawType(); return getClass(type); } This code compiles well but at runtime i get the below exception while casting Type to ParameterizedType. java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType Please suggest. Thanks!

    Read the article

  • Creating a Java platform game as easily as possible

    - by directx
    I need to create a Java-based platformer game for a high school project (not computer science related), and I want to spend as little time on technical stuff as possible. I'm already experienced in Java, and I already have most of the gameplay, graphics, etc. All I need to do is code it. I've looked and I'm considering one of two options that do not involving coding a game from scratch: Copy an existing Java platformer (best option, but I can't find an open source Java platformer) Use a Java game engine to avoid coding from scratch. I've looked at JGame but I'm not sure if it's the best bet for a platformer.

    Read the article

  • Where do Java Applets live?

    - by Wendy Peters
    I'm trying to figure out where java Applets that I run from the browser get downloaded to. I'm using Firefox 3.0 on Windows XP with Java 1.6 if that makes any difference. From the Java Control Panel on the toolbar, I can access "Temporary Internet Files - Settings" to find the Java cache. From there I can show the resources and see a file called "dws2010066.dat". Does this resource correspond to a file on disk? I did a search in the Java cache (and my whole computer) but came up empty handed.

    Read the article

  • Why this java application print "true"?

    - by user292084
    This is my first Class Hello.java public class Hello { String name = ""; } This is my second Class Test1.java public class Test1 { public static void main(String[] args) { Hello h = new Hello(); Test1 t = new Test1(); t.build(h); System.out.println((h.name)); } void build(Hello h){ h.name = "me"; } } When I run Test1.java, it prints "me". I think I understand, because of "reference transfer". This is my third Class Test2.java public class Test2 { public static void main(String[] args) { Hello h = null; Test2 t = new Test2(); t.build(h); System.out.println(((h == null))); } void build(Hello h){ h = new Hello(); } } When I run Test2.java, it prints "true", why ? Is it "reference transfer" no longer? I am confused.

    Read the article

  • no ocijdbc10 in java.library.path

    - by B.Z.B
    Hey all, So I've been plagued by this issue, whenever I try to run my app in eclipse, I get this error. 2011-02-23 09:55:08,388 ERROR (com.xxxxx.services.factory.ServiceInvokerLocal:21) - java.lang.UnsatisfiedLinkError: no ocijdbc10 in java.library.path I've tried following the steps I found here with no luck. I've tried this on a XP VM as well as windows 7 (although in win 7 I get a different error, below) java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path I've made sure my oracle client was ok (by running TOAD) and I also re-added the classes12.jar / ojdbc14.jars to my WEB-INF/lib folder taken directly from my %ORACLE_HOME% folder (also re-added them to the lib path). I've also tried just adding the ojdbc14.jar without the classes12.jar. Any suggestions appreciated. In the XP VM I have my PATH variable set to C:\Program Files\Java\jdk1.6.0_24\bin;C:\ORACLE\product\10.2.0.1\BIN. I'm using Tomcat server 5.0

    Read the article

  • How to load an image in matlab from java

    - by Ian
    Basically I am trying to create a little program that will allow me to make calls in matlab from a jave GUI It's mainly going to be used for image manipulation and deblurring but I am struggling to find a way that will effectively give me full matlab control from the java end I am hoping to have it work like so: { //create matlab execution call String loadImage = " image1 = imread ('imageOnComputer.jpg'); "; //send instruction to matlab and save the path to it so java can //use the newly created variable resultingVariablePath = java.sendInstructionToMatlab(loadImage); //display on the screen java.displayImage(resultingVariablePath); } Basically I am just trying to find out if there is a plugin for matlab (or some java package) that will grant you (pretty much) full control over matlab.

    Read the article

< Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >