Skip to main content
Inspiring
February 17, 2012
Question

Java object failed to create

  • February 17, 2012
  • 3 replies
  • 5465 views

Hi everyone,

  I have a Java class and want to deploy it in ColdFusion. I put the class file at C:\ColdFusion9\wwwroot\web-inf\classes. However, on my Vista machine everything works fine. But it fails on my windows7 machine. On windows7, It seems that the page that uses this Java object simply stop working. The page displays the navigation menu at the very top first, then it supposes to display some messages output by this object but it does not. And on that page any code after the Java object creation does not get executed. The only thing this page displays is the navigation bar and the background color. I suspect this may have something to do with Vista being 32 bit and windows 7 being a 64-bit machine? Is this correct? Anyone encountered the same problem before and knows the answer?

Thanks in advance for helping!!

    This topic has been closed for replies.

    3 replies

    ffcaiAuthor
    Inspiring
    February 19, 2012

    I also recommend CF team come up with some sort of patch for updating its internal JVM everytime a new Java version is released. 

    Inspiring
    February 19, 2012

    I have used Java for many years but never have a chance to meet '-target' option.

    My bad. It has been a while since I have used the command line compiler. (I usually go through Eclipse, for compiling jars). So I had to look it up myself ;-)  Both of these worked with 1.7.0_03 with a simple test class. Though it generated a warning.  (See: Source and target file decoder)

          c:\path\to\java7\bin\>   javac -source 1.6 c:\dev\MyTestClass.java

          c:\path\to\java7\bin\>   javac -source 1.6 -target 1.6 c:\dev\MyTestClass.java

    But according to this article you may also want to supply the bootstrapclasspath of the older jvm in some cases.

    Inspiring
    February 19, 2012

    (Ugh... formatting with this forum software is such fun...)

    I also recommend CF team come up with some sort of patch for updating its internal JVM everytime a new Java version is released.

    Edit:  Since the jvm is so critical, I do not think the jvm of an existing instance should be changed automatically.

    I seem to recall reading about some issues with java 7. So the decision to stick with 1.6 was probably deliberate. However, you can easily update the jvm path yourself, assuming the version is compatible.

    Inspiring
    February 17, 2012

    I suspect this may have something to do with Vista being 32 bit and windows 7 being a 64-bit machine? Is this correct?

    Java is mostly platform neutral. So it is possible, but less likely to be the cause.

    What does this class do in general terms? Also, what is the error message thrown? Check the error logs too.

    ffcaiAuthor
    Inspiring
    February 18, 2012

    Thanks for reminding me. I did not look at the log before. Here is the message:

    "Error","web-5","02/16/12","18:25:13","xqc","HelloWorld : Unsupported major.minor version 51.0 The specific sequence of files included or processed is: C:\ColdFusion9\wwwroot\xqc\index.cfm, line: 18 "

    Based on the message, I strongly felt the Java version installed was the problem. I went ahead to prove it. I copied the Java class from my Vista machine to my Windows 7 machine. It worked! If I remember it right, my Vista machine produce something with version 50. My Vista has Java 6 installed. My Windows 7 has Java 7 installed. It seems the JVM comes with ColdFusion does not recognize class files produced by Java 7 yet. Problem solved. Thank you BKBK and cfSearching. I will need to develop and compile the Java classes on my Vista machine, then copy them over to Windows 7...

    Inspiring
    February 18, 2012

    It seems the JVM comes with ColdFusion does not recognize class files produced by Java 7 yet.

    Maybe I need more coffee, but you lost me ;-) ... What you are describing does quite match up with the original description:

          "I put the class file at C:\ColdFusion9\wwwroot\web-inf\classes. However, on my Vista machine everything works fine. But it fails on my windows7 machine." 

    ... that suggests the original class was compiled on Vista 32 bit using the jvm that ships with CF9 (1.6). I am not sure where java 7 entered the picture.  What version of java did you use to compile the original class? Also, which verison of java is CF9 using on both machines?

    Message was edited by: -==cfSearching==-

    BKBK
    Community Expert
    Community Expert
    February 17, 2012

    After reading the first few sentences of your description I, too, thought of bitness. However, you should in general be able to carry 32-bit applications over to 64-bit environments. But there could be exceptions.

    I would expect such exceptions only when you, for example, change the bitness of the JVM. Which makes me to ask, is the version of ColdFusion on Windows 7 64-bit?

    ffcaiAuthor
    Inspiring
    February 17, 2012

    In Windows 7 there are two program files folder, one called 'Program FIles' for 64-bit software and the other called 'Program Files(x86)' for 32-bit software. Both Program FIles have Java folder there. We don't know, it all depends on how ColdFusion interact with JVM. Only ColdFusion team knows why...

    BKBK
    Community Expert
    Community Expert
    February 17, 2012

    I was talking about ColdFusion, which ships with its own JVM by default. Is the version of ColdFusion 9 you installed on Windows 7 32-bit or 64-bit?