Search Results

Search found 1197 results on 48 pages for 'jvm'.

Page 36/48 | < Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >

  • cast across classloader?

    - by IttayD
    How can I do this: class Foo { public static Foo get() throws Exception { ClassLoader cl = new URLClassLoader(new URL[]{"foo.jar"}, null); // Foo.class is in foo.jar return (Foo)cl.loadClass("Foo").newInstance(); // fails on class cast } } What I need is for the JVM to consider the Foo instance from cl as if it is an instance of Foo from the classloader of the executing code. I have seen these approaches, none of them good for me (the above example is a toy example): Load the class (or a separate interface) by a class loader that is a parent of both the calling code and created classloader Serialize and deserialize the object.

    Read the article

  • [Java] Flood fill using a stack

    - by dafero
    Hello to everyone :), I am using the recursive Flood fill algorithm in Java to fill some areas of a image. With very small images it works fine, but when de image becomes larger the JVM gives me a Stack Over Flow Error. That's the reason why I have to reimplement the method using a Flood Fill with my own stack. (I read that's the best way to do it in these kind of cases) Can anyone explain me how to code it? (if you don't have the code at hand, with the pseudo-code of the algorithm will be fine) I've read a lot in the Internet but I haven't understood it very well. Thanks!

    Read the article

  • Is java HashMap.clear() and remove() memory effective?

    - by Shaman
    Consider the follwing HashMap.clear() code: /** * Removes all of the mappings from this map. * The map will be empty after this call returns. */ public void clear() { modCount++; Entry[] tab = table; for (int i = 0; i < tab.length; i++) tab[i] = null; size = 0; } It seems, that the internal array (table) of Entrys is never shrinked. So, when I add 10000 elements to a map, and after that call map.clear(), it will keep 10000 nulls in it's internal array. So, my question is, how does JVM handle this array of nothing, and thus, is HashMap memory effective?

    Read the article

  • Java 'Prototype' pattern - new vs clone vs class.newInstance

    - by Guillaume
    In my project there are some 'Prototype' factories that create instances by cloning a final private instance. The author of those factories says that this pattern provides better performance than calling 'new' operator. Using google to get some clues about that, I've found nothing really relevant about that. Here is a small excerpt found in a javdoc from an unknown project javdoc from an unknown project Sadly, clone() is rather slower than calling new. However it is a lot faster than calling java.lang.Class.newInstance(), and somewhat faster than rolling our own "cloner" method. For me it's looking like an old best practice of the java 1.1 time. Does someone know more about this ? Is this a good practice to use that with 'modern' jvm ?

    Read the article

  • C++ to bytecode compiler for Silverlight CLR?

    - by paleozogt
    I'd like to be able to compile a C/C++ library so that it runs within a safe managed runtime in the Silverlight CLR. There are several tools for doing this with the JVM that allows C++ code to run within a CRT emulation layer (see NestedVM, LLJVM, etc), which effectively allows C++ code to be run within a Java Applet. There's even a tool for this for the Adobe Flash VM (see Alchemy). However, I can't seem to find any tools like this for the CLR. fyi, the MSVC tools don't seem to allow for this: The /clr:pure flag will create C++ code that runs in the CLR, but it isn't safe (because the CRT isn't safe) and /clr:safe requires massive code changes (no native types, etc).

    Read the article

  • Is there a possibility to run applets on Android or Blackberry?

    - by Maxood
    This is what the Java site www.java.com says: "KVM, the virtual machine for mobile devices, is the counterpart of JVM (Java virtual machine). It is used to run applets and applications written with Java technology on mobile devices. KVM must be installed by the manufacturer. It is NOT available for download or installation by consumers". Now Android has a customized virtual machine called DVM (Dalvik Virtual Machine). Can we compare it with KVM? Wonder if we can further reprogram DVM to incorporate features of KVM to run applets on Android? Same goes for Blacberry, is there a possibility?

    Read the article

  • using BOSH/similar technique for existing application/system

    - by SnapConfig.com
    We've an existing system which connects to the the back end via http (apache/ssl) and polls the server for new messages, needless to say we have scalability issues. I'm researching on removing this polling and have come across BOSH/XMPP but I'm not sure how we should take the BOSH technique (using long lived http connection). I've seen there are few libraries available but the entire thing seems bloaty since we do not need buddy lists etc and simply want to notify the clients of available messages. The client is written in C/C++ and works across most OS so that is an important factor. The server is in Java. does bosh result in huge number of httpd processes? since it has to keep all the clients connected, what would be the limit on that. we are also planning to move to 64 bit JVM/apache what would be the max limit of clients in that case. any hints?

    Read the article

  • What causes "java.lang.IncompatibleClassChangeError: vtable stub"?

    - by JimN
    What causes "java.lang.IncompatibleClassChangeError: vtable stub"? In our application, we have seen this error pop up randomly and very seldom (just twice so far, and we run it a lot). It is not readily reproducible, even when restarting the app, using the same jvm/jars without rebuilding. As for our build process, we clean all classes/jars and rebuild them, so it's not the same problem as others have encountered where they made a change in one class and didn't recompile some other dependent classes. This is unlike some of the other questions related to IncompatibleClassChangeError -- none of them mention "vtable stub". In fact, there are surprisingly few google results when searching for "IncompatibleClassChangeError "vtable stub"".

    Read the article

  • Looking for a .NET 3.5 / J2EE architecture concept comparison article/chart

    - by Edward Tanguay
    We are thinking about combining .NET technology with Java technology (WCF, JBoss/ESB, MOM, WPF, WF) and I need to have a high-level idea of what are the apples and oranges in the .NET 3.5 and Java worlds. Does anyone know of a good, clear article or better yet a simple chart which answers questions such as: WCF in the Java world is __ the equivalent of WPF in the Java world is _ the closes thing to JBoss in the .NET world is _ the JVM and CLR are essentially the same except for these differences: .... in the Java world you don't have the concept of WF/WCF/WPF, instead you have .... there is no "LINQ" in the Java world yet, but you can use ___ the closest you get to ADO.NET Data Services in the Java world is .... I'm not looking to debate this so I'm not looking for "fighting points", I just need a neutral what-is-what chart comparing the two worlds.

    Read the article

  • How to indefinitely pause a thread in Java and later resume it?

    - by Carlos Torres
    Maybe this question has been asked many times before, but I never found a satisfying answer. The problem: I have to simulate a process scheduler, using the round robin strategy. I'm using threads to simulate processes and multiprogramming; everything works fine with the JVM managing the threads. But the thing is that now I want to have control of all the threads so that I can run each thread alone by a certain quantum (or time), just like real OS processes schedulers. What I'm thinking to do: I want have a list of all threads, as I iterate the list I want to execute each thread for their corresponding quantum, but as soon the time's up I want to pause that thread indefinitely until all threads in the list are executed and then when I reach the same thread again resume it and so on. The question: So is their a way, without using deprecated methods stop(), suspend(), or resume(), to have this control over threads?

    Read the article

  • Which programming langauge is the funniest?

    - by Shervin
    I know there are tons of different programming languages, and some of them are made with a tad of sense of humor. But which one is the funniest in your opinion? I have heard of something called Moo (although I am not sure of the exact name), which was a programming language for the JVM. The basic idea was that the only syntax allowed was a fork of Moo, like this: moo; //Means something mooo; //means another thing moooooo; //means something else and so on. That is pretty funny IMO. Not so useful, and definitely not easy to learn, but quite funny.

    Read the article

  • HPC (mainly on Java)

    - by Insectatorious
    I'm looking for some way of using the number-crunching ability of a GPU (with Java perhaps?) in addition to using the multiple cores that the target machine has. I will be working on implementing (at present) the A* Algorithm but in the future I hope to replace it with a Genetic Algorithm of sorts. I've looked at Project Fortress but as I'm building my GUI in JavaFX, I'd prefer not to stray too far from a JVM. Of course, should no feasible solution be available, I will migrate to the easiest solution to implement.

    Read the article

  • What is cached on a client machine when using https.

    - by TroyP
    I have an application that is working on https for everybody and on http for all but two users. The two users get a JavaScript error when trying to "edit" a page while on http but can edit the page on https. The problem is for occurs for both IE6 and FF3.6 for one of these users. Others have no problem using any browser. I have used Charles Proxy to look at the server response and no request is being made to https when on http and all browser requests return successfully. I have cleared all caches known to me on the clients (browser, jvm). Are http and https caches stored in different locations on the clients computers. Could a cached encrypted file be being read on the unencrypted port.

    Read the article

  • Limiting the size of the managed heap in a C# application

    - by Assaf Lavie
    Can I configure my C# application to limit its memory consumption to, say, 200MB? IOW, I don't want to wait for the automatic GC (which seems to allow the heap to grow much more than actually needed by this application). I know that in Java there's a command line switch you can pass to the JVM that achieves this.. is there an equivalent in C#? p.s. I know that I can invoke the GC from code, but that's something I would rather not have to do periodically. I'd rather set it once upon startup somehow and forget it.

    Read the article

  • Problem with starting OpenOffice service (soffice) from Java (command working in commandline, but no

    - by Shervin
    I want to exceute a simple command which works from the shell but doesn't work from Java. This is the command I want to execute, which works fine: soffice -headless "-accept=socket,host=localhost,port=8100;urp;" This is the code I am excecuting from Java trying to run this command: String[] commands = new String[] {"soffice","-headless","\"-accept=socket,host=localhost,port=8100;urp;\""}; Process process = Runtime.getRuntime().exec(commands) int code = process.waitFor(); if(code == 0) System.out.println("Commands executed successfully"); When I run this program I get "Commands executed successfully". However the process is not running when the program finishes. Is it possible that the JVM kills the program after it has run? Why doesn't this work?

    Read the article

  • Functional languages targeting the LLVM

    - by Matthew
    Are there any languages that target the LLVM that: Are statically typed Use type inference Are functional (i.e. lambda expressions, closures, list primitives, list comprehensions, etc.) Have first class object-oriented features (inheritance, polymorphism, mixins, etc.) Have a sophisticated type system (generics, covariance and contravariance, etc.) Scala is all of these, but only targets the JVM. F# (and to some extent C#) is most if not all of these, but only targets .NET. What similar language targets the LLVM?

    Read the article

  • Anyone up to creating a tomcat based alternative for GAE?

    - by bach
    Hi, If we had the possibility to run GAE app without any code change on our servlet engine that would be great because: in case that google changes their billing policy we can just jump to our own server or in case their current policy doesn't fit our app needs we can do stuff which is not allowed in the GAE, compromising a 1 JVM, 1 DB We don't actually need a distributed system but more of a realtime system with synchronize, true locking mechanisms, other servers/software installed on the server machine, socket interface etc... Such a package should include at least: TomCat (or equivalent) DataNucleus Access Platform (Task Queue service) Any idea if it's easy to get such a thing or if it's already exist somewhere? Thanks

    Read the article

  • Make a connection to a HTTPS server from Java and ignore the validity of the security certificate

    - by justinhj
    I've been testing some that works with a bunch of https servers with different keys, some of which are invalid and all of them are not in the local key store for my JVM. I am really only testing things out, so I don't care about the security at this stage. Is there a good way to make POST calls to the server and tell Java not to worry about the security certificates? My google searches for this have brought up some code examples that make a class to do the validation, that always works, but I cannot get it to connect to any of the servers.

    Read the article

  • How to catch printf from a dll?

    - by Xarx
    I've got a C++ console application that uses a third-party dll (jvm.dll, indirectly) that uses printf to print various error messages (Java stacktrace). I need to catch these stacktraces to a string in order to process them further, or at least to see them printed on the console. The thing is that I see the stacktrace only when debugging my application in VisualStudio (VS 2010). When I run my application in the "normal way", i.e. from the command line, nothing is printed on the console. So VS is able to somehow interfere the java output and display it. I need to be able to do the same thing. I've already tried freopen(), but without success. Also, I've found this question on the same problem, but without a clear answer.

    Read the article

  • Java BufferedWriter close()

    - by rakeshr
    Hi, assume that I have the following code fragment operation1(); bw.close(); operation2(); When I call BufferedReader.close() from my code, I am assuming my JVM makes a system call that ensures that the buffer has been flushed and written to disk. I want to know if close() waits for the system call to complete its operation or does it proceed to operation2() without waiting for close() to finish. To rephrase my question, when I do operation2(), can I assume that bw.close() has completed successfully?

    Read the article

  • Counting down to zero in contrast to counting up to length - 1

    - by Helper Method
    Is it recommended to count in small loops (where possible) down from length - 1 to zero instead of counting up to length - 1? 1.) Counting down for (int i = a.length - 1; i >= 0; i--) { if (a[i] == key) return i; } 2.) Counting up for (int i = 0; i < a.length; i++) { if (a[i] == key) return i; } The first one is slightly faster that the second one (because comparing to zero is faster) but is a little more error-prone in my opinion. Besides, the first one could maybe not be optimized by future improvements of the JVM. Any ideas on that?

    Read the article

  • Stub web calls in Scala

    - by Dennis Laumen
    I'm currently writing a wrapper of the Spotify Metadata API to learn Scala. Everything's fine and dandy but I'd like to unit test the code. To properly do this I'll need to stub the Spotify API and get consistent return values (stuff like popularity of tracks changes very frequently). Does anybody know how to stub web calls in Scala, the JVM in general or by using some external tool I could hook up into my Maven setup? PS I'm basically looking for something like Ruby's FakeWeb... Thanks in advance!

    Read the article

  • Java Time Zone When Parsing DateFormat

    - by shipmaster
    I had code that parses date as follows: String ALT_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; SimpleDateFormat sdf = new SimpleDateFormat( ALT_DATE_TIME_FORMAT); Date date = sdf.parse(requiredTimeStamp); And it was working fine, suddenly, this stopped working. It turns out an admin made some config changes on the server and the date is currently being returned as "2010-12-27T10:50:44.000-08:00" which is not parse-able by the above pattern. I have two questions: The first would be what pattern would parse the date being returned by the JVM in the format above (specifically, just '-08:00' as the time zone)? And second, where exactly would one change such settings on a linux RHEL 5 server so that we are aware of such changes in the future?

    Read the article

  • Passing arguments to java vm from NSIS script

    - by CodeBuddy
    I'm developing my first java application using Eclipse. I've recently needed to adjust the amount of memory allocated by passing -Xmx256M to the JVM. The application is currently package up as a runnable jar and installed using the NSIS. I'm having a problem passing arguments to the jar file once its installed. What is the common practice for doing this? Here is what I'm currently doing in my nsi file: CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" "$SYSDIR\javaw.exe" "-jar -Xmx256M $INSTDIR\Foo.jar" This results in the following being created as the shortcut Target on windows: C:\WINDOWS\system32\javaw.exe -jar -Xmx256M C:\Program Files\Foo\Foo.jar Unfortunately this does not work due to the space in C:\Program Files, If I change the link created manually to include quotes all is well: C:\WINDOWS\system32\javaw.exe -jar -Xmx256M "C:\Program Files\Foo\Foo.jar"

    Read the article

  • Are frameworks using byte-code generation creating leaky abstractions?

    - by Gabriel Šcerbák
    My point is, if you don't understand the abstraction of a framework, you can still decompile it and understand it, because you know the language e.g. Java. However, when byte-code generation happens, you have to understand even a lower level - JVM level byte-codes. I am really affraid of using any of such frameworks, which are many. Most of the time I think the reason for byte-code generation is simply lack of language features such as metaprogramming. Do you agree? What is your opinion and argument? How do you take over the problem with leaky abstractions in those frameworks?

    Read the article

< Previous Page | 32 33 34 35 36 37 38 39 40 41 42 43  | Next Page >