jvm

JRuby / Rack deployment

I know this is pretty exotic, but I want to deploy a Ruby web application (not Rails, but Rack based, so it plugs into most Ruby servers just fine) using JRuby. Google and friends give me a few success stories, but mostly rails related and if not, no details on the deployment are provided. The framework I'm using is Ramaze, if it matters...

Virtual Machine Optimization

I am messing around with a toy interpreter in Java and I was considering trying to write a simple compiler that can generate bytecode for the Java Virtual Machine. Which got me thinking, how much optimization needs to be done by compilers that target virtual machines such as JVM and CLI? Do Just In Time (JIT) compilers do constant foldi...

Problems running Swing application with IDEA 8M1

Is anyone else having trouble running Swing applications from IntelliJ IDEA 8 Milestone 1? Even the simplest application of showing an empty JFrame seems to crash the JVM. I don't get a stack trace or anything, it looks like the JVM itself crashes and Windows shows me a pop-up that says the usual "This process is no longer responding" ...

Is Scala the next big thing?

I've been learning Scala recently, and it seems like a very very promising general purpose programming language. It has all the good functional programming features, terse syntax, it runs on JVM and interoperates with Java. Some think it's the Next Big Language. Others aren't so sure. Why do you think it is/isn't going to be the next b...

How to deal with "java.lang.OutOfMemoryError: Java heap space" error (64MB heap size)

I am writing a client-side Swing application (graphical font designer) on Java 5. Recently, I am running into "java.lang.OutOfMemoryError: Java heap space" error because I am not being conservative on memory usage. The user can open unlimited number of files, and the program keeps the opened objects in the memory. After a quick research ...

Handle signals in the Java Virtual Machine

Is it possible to handle POSIX signals within the Java Virtual Machine? At least SIGINT and SIGKILL should be quite platform independent. ...

How to lock compiled Java Classes to prevent decompilation

I know this must be very well discussed topic on Internet but I could not come to any conclusion after referring them. Many people do suggest obfuscator but they just do rename classes / methods / fields with tough to remember character sequences but what about sensitive constant values ? For example, you have developed the encryption...

What is causing a JVMTI_ERROR_NULL_POINTER?

I'm getting an error when my application starts. It appears to be after it's initialized its connection to the database. It also may be when it starts to spawn threads, but I haven't been able to cause it to happen on purpose. The entire error message is: FATAL ERROR in native method: JDWP NewGlobalRef, jvmtiError=JVMTI_ERROR_NULL_POI...

JVM choices on Windows Mobile..

What are the JVM implementations available on Windows Mobile? Esmertec JBed is the one on my WinMo phone. Wondering how many other JVM vendors are in this zone. Are there any comparison or benchmarking data available? ...

What's the difference between the inner workings of Java's JVM and .NET's CLR?

What's the difference between the inner workings of Java's JVM and .NET's CLR? Perhaps a starting point would be, are they basically the same thing in their respective environments (Java > JVM > Machine code) (C# > CLR > IL). Update: Several people have alluded to the points I was trying to cover: Garbage Collection Boxing/Unboxi...

How do you crash a JVM?

Newbie here... Also not sure whether the question belongs to a site that prefers questions that can be answered and not discussed. Still... I was reading a book on programming skills wherein the author asks the interviewee, "How do you crash a JVM?" I thought that you could do so by writing an infinite for-loop that would eventually use...

How are Integer arrays stored internally, in the JVM?

An array of ints in java is stored as a block of 32-bit values in memory. How is an array of Integer objects stored? i.e. int[] vs. Integer[] I'd imagine that each element in the Integer array is a reference to an Integer object, and that the Integer object has object storage overheads, just like any other object. I'm hoping however ...

What runs in a C heap vs a Java heap in HP-UX environment JVMs?

I've been running into a peculiar issue with certain Java applications in the HP-UX environment. The heap is set to -mx512, yet, looking at the memory regions for this java process using gpm, it shows it using upwards of 1.6GBs of RSS memory, with 1.1GB allocated to the DATA region. Grows quite rapidly over a 24-48hour period and the...

Why do we need other JVM languages

I see here that there are a load of languages aside from Java that run on the JVM. I'm a bit confused about the whole concept of other languages running in the JVM. So: What is the advantage in having other languages for the JVM? What is required (in high level terms) to write a language/compiler for the JVM? How do you write/compile...

Does the Java VM move objects in memory, and if so - how?

Does the Java virtual machine ever move objects in memory, and if so, how does it handle updating references to the moved object? I ask because I'm exploring an idea of storing objects in a distributed fashion (ie. across multiple servers), but I need the ability to move objects between servers for efficiency reasons. Objects need to b...

Does the JVM prevent tail call optimizations?

I saw this on a question: Scala in particular doesn't support tail-call elimination except in self-recursive functions, which limits the kinds of composition you can do (this is a fundamental limitation of the JVM). Is this true? If so, what is it about the JVM that creates this fundamental limitation? ...

How can I give java.util.Random a specific seed in thirdparty classes?

I have a Java program that loads thirdparty class files (classes I did not write) and executes them. These classes often use java.util.Random, which by default generates random starting seed values every time it gets instantiated. For reasons of reproducability, I want to give these classes the same starting seed every time, changing it ...

Best Resources for Learning JavaFX?

For those of us learning JavaFX, what are the best resources you've found so far? (One of the difficulties in finding good JavaFX resources is that things written before July 2008 are often no longer valid because of changes made to beta version of the language) I've found: James Weaver's JavaFX Blog JavaFX in Action by Manning Pres...

Recursive overloading semantics in the Scala REPL - JVM languages

Using Scala's command line REPL: def foo(x: Int): Unit = {} def foo(x: String): Unit = {println(foo(2))} gives error: type mismatch; found: Int(2) required: String It seems that you can't define overloaded recursive methods in the REPL. I thought this was a bug in the Scala REPL and filed it, but it was almost instantly closed with...

How do I set the proxy to be used by the JVM

Many times, a Java app needs to connect to the Internet. The most common example happens when it is reading an XML file and needs to download its schema. I am behind a proxy server. How do I set my JVM to use the proxy ? ...