[Java solution] "no office executable found!"

Java, C++, C#, Delphi... - Using the UNO bridges
Hardie82
Posts: 5
Joined: Fri Oct 24, 2008 3:08 pm

Re: [Java solution] "no office executable found!"

Post by Hardie82 »

If I tried to use the following code I got a StackOverflowError:

String ooExeFolder = "C:\\Programme\\OpenOffice.org 2.4\\program\\";
this.xContext = BootstrapConnector.bootstrap(ooExeFolder, "", "");
XMultiComponentFactory xMCF = this.xContext.getServiceManager();
this.xCLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", this.xContext));
OOo 2.3.X on Ms Windows XP
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

Hardie82 wrote:After reading this thread I included the jar-file. But using the bootstrap-method there is a difference between the code in this thread an the method from BootstrapConnector-class.
That depends on you! You can use the JAR as I wrote in the first example in this thread:

Code: Select all

XComponentContext xContext = BootstrapSocketConnector.bootstrap(oooExeFolder);
Or you can use the bootstrap-method with three parameters. If you want to know what the other two parameters are for, take a look into the JAR file: It contains the whole source code with some comments.
Hardie82 wrote:In the method there are three parameters required.
My advice: Use the method from the example with just one parameter!
Hardie82 wrote:Were there some changes to the class
No.
Hardie82 wrote:and what's about the other two parameters?
As said above: Take a look into the JAR file: It contains the whole source code with some comments.
Hardie82 wrote:If I tried to use the following code I got a StackOverflowError:

String ooExeFolder = "C:\\Programme\\OpenOffice.org 2.4\\program\\";
First: Use this instead:

Code: Select all

String oooExeFolder = "C:/Programme/OpenOffice.org 2.4/program/";
The example from the first post in this tread is working on Windows without double backslashes.
Hardie82 wrote:this.xContext = BootstrapConnector.bootstrap(ooExeFolder, "", "");
Second: Use this much simpler code from the first post in this tread instead:

Code: Select all

XComponentContext xContext = BootstrapSocketConnector.bootstrap(oooExeFolder);
Or take a look into the JAR file and use the appropriate parameters.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
Hardie82
Posts: 5
Joined: Fri Oct 24, 2008 3:08 pm

Re: [Java solution] "no office executable found!"

Post by Hardie82 »

After using the BoostrapSocketConnector all works fine. Thanks a lot. But there is still a question. After writing my document and saving it to disk the oo-process is still alive. Is there a way to stop it?
OOo 2.3.X on Ms Windows XP
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

Hardie82 wrote:After using the BoostrapSocketConnector all works fine. Thanks a lot.
That was the reason for providing the example with BoostrapSocketConnector in the first post of this thread ;-)
Hardie82 wrote:But there is still a question. After writing my document and saving it to disk the oo-process is still alive. Is there a way to stop it?
As long as you don't terminate OOo, that process keeps running. Terminating OOo stops your process, too.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
Hardie82
Posts: 5
Joined: Fri Oct 24, 2008 3:08 pm

Re: [Java solution] "no office executable found!"

Post by Hardie82 »

Ahh, okay. Is there the possibility to open one time a process and reuse this process without starting a new one? So I only have one oo-process running?

BTW: how do I terminate an oo-process?
OOo 2.3.X on Ms Windows XP
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

Hardie82 wrote:Is there the possibility to open one time a process and reuse this process without starting a new one? So I only have one oo-process running?
Sure, that is possible. Write your own OOoService which starts OOo and does all the stuff you need OOo for (like a document conversion) and call it whenever you need it. Call it for example through a synchroniced method to serialize all of OOo's actions.
Hardie82 wrote:BTW: how do I terminate an oo-process?
Take a closer look at these threads for example:
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hbagchi
Posts: 3
Joined: Mon Oct 27, 2008 7:41 am

Re: [Java solution] "no office executable found!"

Post by hbagchi »

While things are working as explained here, I see the open office UI window popping up every time when I use
either the convertWithStaticConnector() or the convertWithConnector() method in the attached example BootstrapSocketConnectorExample. I have provided additional options like -headless. Still the oo UI window is popping up every time I fire a conversion. Moreover, with the convertWithStaticConnector() method once the window opens up it stays that way and does not close as it does for the other option. Although, if I use the JODConverter 2.2.1 library and start openoffice as a service with the headless options, no UI window is popping up.
Of course the latest released version of JODConverter does not support the docx format.

Any idea what is going wrong?

Cheers,
Hitesh
OOo 3.0.X on Ms Windows XP
jeffpk
Posts: 18
Joined: Fri Oct 31, 2008 5:43 pm

Re: [Java solution] "no office executable found!"

Post by jeffpk »

Hi,

Im trying to use this to get the Netbenas plugin to work on mac OSX 10.5

It got rid of my big exception trace, but I still ge this error on run of the skeleton prgoram:

com.sun.star.lib.loader.Loader::getCustomLoader: exec unoinfo: java.io.IOException: Cannot run program "${office.program.dir}/unoinfo": error=2, No such file or directory

Any idea what might be causing that??
OOo 3.0.X on Mac OSx Leopard
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

jeffpk wrote:Im trying to use this to get the Netbenas plugin to work on mac OSX 10.5

It got rid of my big exception trace, but I still ge this error on run of the skeleton prgoram:

com.sun.star.lib.loader.Loader::getCustomLoader: exec unoinfo: java.io.IOException: Cannot run program "${office.program.dir}/unoinfo": error=2, No such file or directory

Any idea what might be causing that??
Reading this thread http://user.services.openoffice.org/en/ ... 20&t=11555, you got it working?
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
zebulon
Posts: 3
Joined: Thu Nov 06, 2008 7:18 pm

Re: [Java solution] "no office executable found!"

Post by zebulon »

I am having problems getting rid of the error, perhaps someone could help me. When using the method described here my code works fine in Eclipse, but does not work when I deploy my code to Tomcat 6. I am currently using Fedora 9 and OpenOffice 2.4. Does anyone have any advice?
OOo 2.4.X on Fedora 9
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

zebulon wrote:When using the method described here my code works fine in Eclipse, but does not work when I deploy my code to Tomcat 6. I am currently using Fedora 9 and OpenOffice 2.4. Does anyone have any advice?
Post your exception, some code (at least some code around your exception), and tell us, which of OOo's JARs and which other JAR files you deploy where in Tomcat. Otherwise I can give no further advice.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
zebulon
Posts: 3
Joined: Thu Nov 06, 2008 7:18 pm

Re: [Java solution] "no office executable found!"

Post by zebulon »

Here's the code:

Code: Select all

private void getContext() {
		try {
			String oooExeFolder = "/usr/lib/openoffice.org/program/";
			this.context = BootstrapSocketConnector.bootstrap(oooExeFolder);
		    if(context == null) {
		    	System.err.println("ERROR: Could not bootstrap default Office.");
		    }
		} catch(BootstrapException e) {
		    e.printStackTrace();
		    System.exit(1);
		}
    }
The error happens on this.context = BootstrapSocketConnector.bootstrap(oooExeFolder)
The error I get is:

Code: Select all

com.sun.star.comp.helper.BootstrapException: no office executable found!
This is all part of a servlet that is going to use Impress, so this is part of code to do that. The code all runs perfectly in Eclipse, but still fails when the war file is deployed to Tomcat 6.
OOo 2.4.X on Fedora 9
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

zebulon wrote:The code all runs perfectly in Eclipse, but still fails when the war file is deployed to Tomcat 6.
You still haven't told which JAR files you use and deploy.

Anyway, for whatever reason, something goes wrong. So the next step I would take is to debug the application. My bootstrapconnector.jar contains all the source code, too. So it should be possible to remote debug your application running in Tomcat from Eclipse. Doing this, you should take a closer look at the OOoServer.start() method. There you'll find the lines

Code: Select all

if (fOffice == null)
    throw new BootstrapException("no office executable found!");
where your exception occurs.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
zoharat
Posts: 18
Joined: Tue Dec 02, 2008 7:19 pm

Re: [Java solution] "no office executable found!"

Post by zoharat »

Once you connect to OpenOffice to perform your conversions how do we disconnect when the server shuts down?

Sometimes my files get locked and I cannot delete them. I have to manually go into task maanger and shut down soffice.bin and then I can delete the files.
OOo 3.0.X on Ms Windows XP + Red Hat Linux
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

zoharat wrote:Once you connect to OpenOffice to perform your conversions how do we disconnect when the server shuts down?
There is no disconnect available. And even if OOo should offer something like this, you might not be able to call it, after the server shut down.
zoharat wrote:Sometimes my files get locked and I cannot delete them. I have to manually go into task maanger and shut down soffice.bin and then I can delete the files.
If the soffice.bin process is still running, it didn't shut down. Although it happens from time to time, that soffice.bin stops processing function calls which you named here shutting down. But ok, this is just wording, and not very helpful for you ;-)

Anyway, you're totally right: OOo causes trouble from time to time. Sometimes it shuts down completely, so there is no longer a soffice.bin process running, and you should have no problems with deleting your files. And sometimes OOo stops responding and blocks every further function call. If this happens, I simply kill OOo the hard way. Some time ago I posted an OOo killer class here http://www.oooforum.org/forum/viewtopic ... 9186#59186. And for simplicity here is that code again:

Code: Select all

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class KillOpenOffice
{
    /**
    * Kill OpenOffice.
    *
    * Supports Windows XP, Solaris (SunOS) and Linux.
    * Perhaps it supports more OS, but it has been tested
    * only with this three.
    *
    * @throws IOException  Killing OpenOffice didn't work
    */
    public static void killOpenOffice() throws IOException
    {
       String osName = System.getProperty("os.name");
       if (osName.startsWith("Windows"))
       {
          windowsKillOpenOffice();
       }
       else if (osName.startsWith("SunOS") || osName.startsWith("Linux"))
       {
          unixKillOpenOffice();
       }
       else
       {
          throw new IOException("Unknown OS, killing impossible");
       }
    }

    /**
    * Kill OpenOffice on Windows XP.
    */
    private static void windowsKillOpenOffice() throws IOException
    {
       Runtime.getRuntime().exec("tskill soffice");
    }

    /**
    * Kill OpenOffice on Unix.
    */
    private static void unixKillOpenOffice() throws IOException
    {
       Runtime runtime = Runtime.getRuntime();

       String pid = getOpenOfficeProcessID();
       if (pid != null)
       {
          while (pid != null)
          {
             String[] killCmd = {"/bin/bash", "-c", "kill -9 "+pid};
             runtime.exec(killCmd);

             // Is another OpenOffice prozess running?
             pid = getOpenOfficeProcessID();
          }
       }
    }

    /**
    * Get OpenOffice prozess id.
    */
    private static String getOpenOfficeProcessID() throws IOException
    {
       Runtime runtime = Runtime.getRuntime();

       // Get prozess id
       String[] getPidCmd = {"/bin/bash", "-c", "ps -e|grep soffice|awk '{print $1}'"};
       Process getPidProcess = runtime.exec(getPidCmd);

       // Read prozess id
       InputStreamReader isr = new InputStreamReader(getPidProcess.getInputStream());
       BufferedReader br = new BufferedReader(isr);

       return br.readLine();
    }
}
You can find more about the Windows tskill command, that I used in the OOo killer class here http://technet.microsoft.com/en-us/libr ... 90806.aspx for example.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
zoharat
Posts: 18
Joined: Tue Dec 02, 2008 7:19 pm

Re: [Java solution] "no office executable found!"

Post by zoharat »

If I use the boostrapConnector.disconnect method , it kills the soffice.exe. Not the soffice.bin process.

Besides killing it directly is there any other way to stop the soffice.bin process.
OOo 3.0.X on Ms Windows XP + Red Hat Linux
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Java solution] "no office executable found!"

Post by Villeroy »

zoharat wrote:If I use the boostrapConnector.disconnect method , it kills the soffice.exe. Not the soffice.bin process.

Besides killing it directly is there any other way to stop the soffice.bin process.
http://user.services.openoffice.org/en/ ... =20#p52442
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Louis Botterill
Posts: 9
Joined: Thu Dec 04, 2008 12:02 pm

Re: [Java solution] "no office executable found!"

Post by Louis Botterill »

Hi,

I've recently used the BootstrapSocketConnector with success for a web app - I've tried it on both Windows XP and OpenSolaris 10 (101b) and it worked just fine. However, when I tried it on Linux I get an error.

I'm using OpenOffice 3.0 latest
CentOs 5.2 32 bit fully updated
Sun Java 6.0

This class is useful to me because I need to connect from a webapp. In my webapp I package all the OO jars supplied as normal in the SDK into my war and rely on none from the host platform.

I've set my UNO_PATH env variable. Unlike OpenSolaris 10 on Linux I seemed to have two path choices, but I've tried with both, with the same results. These being:

export UNO_PATH=/opt/openoffice.org/basis3.0/program/
export UNO_PATH=/opt/openoffice.org3/program/

I've bounced tomcat (in my case) whenever I've changed any env variables and I know the webapp is reading them ok and passing to the BootstrapSocketConnector constructor.

The error I get is an exception with the message "null" - as far as I can tell, the stack trace is:

com.sun.star.comp.helper.BootstrapException
at ooo.connector.BootstrapConnector.connect(BootstrapConnector.java:129)
at ooo.connector.BootstrapSocketConnector.connect(BootstrapSocketConnector.java:68)
at ooo.connector.BootstrapSocketConnector.connect(BootstrapSocketConnector.java:45)
at ooo.connector.BootstrapSocketConnector.bootstrap(BootstrapSocketConnector.java:82)
...

I realise the jar has source, so I will endeavour to add some more logging or debug if possible - but I'd really like to get this working asap so if anyone has any ideas then I'd really appreciate them. Failing that, if I manage to solve the problem I will report back with the details.

Any help much appreciated!
OOo 3.0.X on Linux-Other + Windows, OpenSolaris 10
Louis Botterill
Posts: 9
Joined: Thu Dec 04, 2008 12:02 pm

Re: [Java solution] "no office executable found!"

Post by Louis Botterill »

Hi,

quick update on this. I think it was a combination of things...

firstly, the correct default path for OO3 on Linux (RH etc) seems to be the second one, i.e.

export UNO_PATH=/opt/openoffice.org3/program/

I basically replicated the whole setup I'd tried to do over a terminal on a headless box, on a similar machine with a desktop/display manager so I could see what was going on.

I think what happens is the first time after installing, when soffice is started it launches the registration wizard - and thus hangs.

when I checked on the box where it wasn't working, I am getting a number of soffice processes being launched (so bootstrap is working) but they block when called from the api - I think they must be stuck at this first step - because this is the first time it's ever been launched, it would never be run as a regular user from the desktop.

So, a different problem to solve - but it appears not to be related to this handy jar library - so sorry for any confusion! :)
OOo 3.0.X on Linux-Other + Windows, OpenSolaris 10
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

Louis Botterill wrote:I think what happens is the first time after installing, when soffice is started it launches the registration wizard - and thus hangs.
So use the parameter -nofirststartwizard. Take a closer look into the bootstrapconnector JAR file. It contains the example class BootstrapSocketConnectorExample which demonstrates the usage of -nofirststartwizard to get around the problem you described:

Code: Select all

...
    private static void convertWithConnector(String loadUrl, String storeUrl) throws Exception, IllegalArgumentException, IOException, BootstrapException {

        // Create OOo server with additional -nofirststartwizard option
        List oooOptions = OOoServer.getDefaultOOoOptions();
        oooOptions.add("-nofirststartwizard");
        OOoServer oooServer = new OOoServer(OOO_EXEC_FOLDER, oooOptions);

        // Connect to OOo
        BootstrapSocketConnector bootstrapSocketConnector = new BootstrapSocketConnector(oooServer);
        XComponentContext remoteContext = bootstrapSocketConnector.connect();

        // Convert text document to PDF
        convert(loadUrl, storeUrl, remoteContext);

        // Disconnect and terminate OOo server
        bootstrapSocketConnector.disconnect();
    }
...
The crucial line of code for you is oooOptions.add("-nofirststartwizard");
Louis Botterill wrote:so sorry for any confusion!
Thanks for the clarification! :-)
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
Louis Botterill
Posts: 9
Joined: Thu Dec 04, 2008 12:02 pm

Re: [Java solution] "no office executable found!"

Post by Louis Botterill »

hol.sten wrote:So use the parameter -nofirststartwizard.
Fantastic, that looks like the exact solution to my exact problem! Thanks ever so much, I won't be able to try this properly on the machine in question until Monday now but I'm confident this was the cause of my problem and the solution you recommend will fix it.

Thanks very much for the help and the example code :)

(Very useful helper library by the way, really glad I found it!)
OOo 3.0.X on Linux-Other + Windows, OpenSolaris 10
Louis Botterill
Posts: 9
Joined: Thu Dec 04, 2008 12:02 pm

Re: [Java solution] "no office executable found!"

Post by Louis Botterill »

Hi, just to close the loop on this - I've tried this out on my headless box and it's now all working fine :)

so thanks very much for the assistance!

Just one question. Even after disconnecting, two office processes "soffice" and "soffice.bin" remain running - is this normal / expected?

I notice if I run many reports, I don't get any additional process instances, so I think it's stable (not leaking resources), just wanted to check that once soffice is started, it's meant to remain running (which would make sense to me).
OOo 3.0.X on Linux-Other + Windows, OpenSolaris 10
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

Louis Botterill wrote:Even after disconnecting, two office processes "soffice" and "soffice.bin" remain running - is this normal / expected?
Yes, it is normal. And if you don't like it, you can kill OOo. This thread contains a post covering killing OOo.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
lg_tw
Posts: 1
Joined: Thu Jan 08, 2009 11:15 pm

Re: [Java solution] "no office executable found!"

Post by lg_tw »

Hi hol.sten,

thanks for your work! Your utility works really nice when used on Windows Vista and helped me after hours of frustration. However the bootstrap fails on my Mac OS X machine. The office process gets started correctly but the connection attempts fail with "connection refused" and i get stuck in this loop of BootstrapConnector.java.

Code: Select all

 
// wait until office is started
for (int i = 0;; ++i) {
  try {
    xContext = getRemoteContext(xUrlResolver);
    break;
  } catch ( com.sun.star.connection.NoConnectException ex ) {
    // Wait 500 ms, then try to connect again, but do not wait
    // longer than 5 min (= 600 * 500 ms) total:
    if (i == 600) {
      throw new BootstrapException(ex.toString());
    }
    Thread.sleep(500);
  }
}
Only difference in my setup of the two machines is the classpath, which of course respects the different locations of the java_uno.jar, juh.jar and so on. The integration is done using fairly exact your sample code.
I just wanted to ask if you (or someone else reading this) has faced the same problem and can provide some insights or hints.

Thank you in advance, Thomas
OOo 3.0.X on MS Windows Vista + OS X, Windows XP
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

lg_tw wrote:However the bootstrap fails on my Mac OS X machine.
Sorry to read that. I cannot assist you here, because my system isn't running on Mac OS X. But if anyone is delivering such a system to my doorstep, I will look into it ;-)

Thomas, can you tell me, which version of OOo you're using on Windows Vista and which on Mac OS X. Is it the same? Did you try on Mac OS X OOo 3.0.0 or 2.4.x or both versions? If not both, can you try more than just one version of OOo on Mac OS X?
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
dasha311
Posts: 4
Joined: Thu Apr 09, 2009 11:41 am

Re: [Java solution] "no office executable found!"

Post by dasha311 »

my program is :
com.sun.star.uno.XComponentContext xContext = null;
try {
String oooExeFolder = "C:/Program Files/OpenOffice.org 3/program";
xContext = BootstrapSocketConnector.bootstrap(oooExeFolder);
if( xContext != null )
System.out.println("Connected to a running office ...");
}
catch( Exception e) {
e.printStackTrace(System.err);
}

i have improted the bootstrapconnector.jar,but i get the follow error
java.lang.UnsupportedClassVersionError: Bad version number in .class file

I am using Java 1.5.0_8 on xp
OOo 3.0.X on Ms Windows XP
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

dasha311 wrote:i have improted the bootstrapconnector.jar,but i get the follow error
java.lang.UnsupportedClassVersionError: Bad version number in .class file

I am using Java 1.5.0_8 on xp
Can you post the stack trace, too? bootstrapconnector.jar was Created-By: 1.5.0_14 (Sun Microsystems Inc.). So it's unlikely that you get the exception from one of the class files of bootstrapconnector.jar whilst using Java 1.5.0_8 on Windows XP.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
dasha311
Posts: 4
Joined: Thu Apr 09, 2009 11:41 am

Re: [Java solution] "no office executable found!"

Post by dasha311 »

this is my programm's exception:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at com.hz.w2p.main(w2p.java:13)
OOo 3.0.X on Ms Windows XP
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Post by hol.sten »

dasha311 wrote:this is my programm's exception:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
...
at com.hz.w2p.main(w2p.java:13)
And which line of your source code w2p.java is line number 13? That's hard to guess from the program fragment you posted above.

Where are you developing your application? Do you use an IDE? If so, which one?
Do you have multiple JDKs and/or JREs on your computer installed? Which versions are you using for building and for running your application. They cannot be the same.

Googling you'll find a lot of links covering "java.lang.UnsupportedClassVersionError: Bad version number in .class file" errors. Examples:
- http://www.techienuggets.com/Comments?tx=606
- http://lkamal.blogspot.com/2008/04/java ... error.html

My guess is that your problem is not caused by using bootstrapconnector.jar, but from mixing different JDKs on your computer for building and running your application.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
dasha311
Posts: 4
Joined: Thu Apr 09, 2009 11:41 am

Re: [Java solution] "no office executable found!"

Post by dasha311 »

i use the Myeclipse6.0,and the compiler is jdk5.0, this IDE has its own jdk which the version is 1.5.0_11
when i use this jdk, the program has the Exception "java.lang.UnsupportedClassVersionError: Bad version number in .class file"
and i change the jdk version,it aslo has the Exception.

i create a java project .

i see the bootstrapconnector Created-By: 1.5.0_14 (Sun Microsystems Inc.),do i have to use the jdk 1.5.0_14????
OOo 3.0.X on Ms Windows XP
Post Reply