Home » Eclipse Projects » Equinox » Does not run under linux?
Does not run under linux? [message #64148] |
Wed, 29 March 2006 09:24 |
Eclipse User |
|
|
|
Originally posted by: fy.wang.163.com
I used Eclipse 3.2M5 on windows xp and ubuntu 5.10.
I make a bundle with the activator and it runs fine under windows xp,but
when i run it under linux, it complain classnotfound:
org/eclipse/swt/widgets/Layout.
I export the project as a jar file,and make a directroy:
bin--
|-configuration-
|-config.ini
|-osgi.jar ;copied from eclipse and renamed to osgi.jar
|-YctTerminalLogin_1.0.0.jar;the jar file exported from eclipse project
|-two swt.jar file copied from eclipse
and under linux, i have the same directroy and a suitable jar files copy
from eclipse.
I use this command line:
java -jar osgi.jar -console
Everything seems good under windows xp but bad under linux.
sometime it runs good under ide,but fails when i export it out.
and help?
the config.ini:
osgi.clean=true
eclipse.ignoreApp=true
osgi.noShutdown=true
osgi.bundles.defaultStrtLevel=4
osgi.bundles=org.eclipse.swt.win32.win32.x86_3.2.0.v3224.jar ,org.eclipse.swt_3.2.0.v3224m.jar,reference:file:YctTerminalLogin_1.0.0.jar@2:start
the activator file:
package com.ection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleException;
import org.osgi.framework.BundleListener;
public class Activator implements BundleActivator, BundleListener{
private static final String MAIN_PATH= "reference:file:main/";
private static final String FUNCTIONS_PATH= "reference:file:plugins/";
private static final String ECTIONMAIN = "YctTerminalMain_1.0.0.jar";
private static final String ECTIONTOOLS = "EctionTools_1.0.0.jar";
private static final String ECTIONCONVERT= "TerminalConverter_1.0.0.jar";
Bundle consoleBundle;
private Shell shell;
private Display display;
private String userName;
private String password;
Text userNameInput;
Text passwordInput;
Button okBtn;
public void start(final BundleContext context) throws Exception {
Thread mainThread = new Thread(){
public void run(){
display = Display.getDefault();
shell = new Shell(SWT.NONE);
shell.setSize(800, 600);
shell.setLocation(0,0);
shell.setText("SWT Application");
shell.setLayout(new FormLayout());
final Composite composite = new Composite(shell, SWT.BORDER );
final GridLayout gridLayout = new GridLayout();
gridLayout.makeColumnsEqualWidth = true;
gridLayout.verticalSpacing = 15;
gridLayout.numColumns = 4;
composite.setLayout(gridLayout);
final FormData formData = new FormData();
formData.bottom = new FormAttachment(60, 0);
formData.right = new FormAttachment(79, 0);
formData.top = new FormAttachment(30, 0);
formData.left = new FormAttachment(19, 0);
composite.setLayoutData(formData);
final Label label = new Label(composite, SWT.NONE);
final GridData gridData_4 = new GridData(GridData.FILL, GridData.CENTER,
false, false);
gridData_4.widthHint = 75;
label.setLayoutData(gridData_4);
label.setText("UserName:");
userNameInput = new Text(composite, SWT.BORDER);
final GridData gridData = new GridData(GridData.FILL, GridData.FILL,
true, false, 3, 1);
gridData.heightHint = 27;
userNameInput.setLayoutData(gridData);
final Label label_1 = new Label(composite, SWT.NONE);
final GridData gridData_5 = new GridData(GridData.FILL, GridData.CENTER,
false, false);
gridData_5.widthHint = 74;
label_1.setLayoutData(gridData_5);
label_1.setText("Password:");
passwordInput = new Text(composite, SWT.PASSWORD | SWT.BORDER);
final GridData gridData_1 = new GridData(GridData.FILL, GridData.FILL,
true, false, 3, 1);
gridData_1.heightHint = 30;
passwordInput.setLayoutData(gridData_1);
final Label LoginInfoDisp = new Label(composite, SWT.CENTER);
LoginInfoDisp.setAlignment(SWT.CENTER);
final GridData gridData_2 = new GridData(GridData.FILL, GridData.CENTER,
false, false, 2, 1);
gridData_2.heightHint = 26;
LoginInfoDisp.setLayoutData(gridData_2);
final Button cancelBtn = new Button(composite, SWT.NONE);
cancelBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
MessageBox dialog = new
MessageBox(shell,SWT.YES|SWT.NO|SWT.ICON_QUESTION);
dialog.setMessage("Are you sure?");
dialog.setText("Exit");
if(dialog.open()==SWT.YES)shell.dispose();
}
});
cancelBtn.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
false, false));
cancelBtn.setText("Exit");
okBtn = new Button(composite, SWT.NONE);
okBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
userName = userNameInput.getText().trim();
password = passwordInput.getText().trim();
userNameInput.setText("");
passwordInput.setText("");
processLogin(context);
}
});
final GridData gridData_3 = new GridData(GridData.FILL, GridData.FILL,
false, false);
gridData_3.heightHint = 35;
okBtn.setLayoutData(gridData_3);
okBtn.setText("
|
|
|
Re: Does not run under linux? [message #64174 is a reply to message #64148] |
Wed, 29 March 2006 16:10 |
Danail Nachev Messages: 36 Registered: July 2009 |
Member |
|
|
Hi, Kavin
Have you replaced the SWT native jar with the proper one for Linux. I
suppose that you forgot to switch them and because the win32 one
requires win32 environment (of course), the classes from it aren't
loaded which leads to ClassNotFound.
Danail
kavin wrote:
> I used Eclipse 3.2M5 on windows xp and ubuntu 5.10.
>
> I make a bundle with the activator and it runs fine under windows xp,but
> when i run it under linux, it complain classnotfound:
> org/eclipse/swt/widgets/Layout.
>
> I export the project as a jar file,and make a directroy:
>
> bin--
> |-configuration-
> |-config.ini
> |-osgi.jar ;copied from eclipse and renamed to osgi.jar
> |-YctTerminalLogin_1.0.0.jar;the jar file exported from eclipse project
> |-two swt.jar file copied from eclipse
>
> and under linux, i have the same directroy and a suitable jar files copy
> from eclipse.
>
> I use this command line:
> java -jar osgi.jar -console
>
> Everything seems good under windows xp but bad under linux.
> sometime it runs good under ide,but fails when i export it out.
>
> and help?
>
> the config.ini:
>
> osgi.clean=true
> eclipse.ignoreApp=true
> osgi.noShutdown=true
> osgi.bundles.defaultStrtLevel=4
> osgi.bundles=org.eclipse.swt.win32.win32.x86_3.2.0.v3224.jar ,org.eclipse.swt_3.2.0.v3224m.jar,reference:file:YctTerminalLogin_1.0.0.jar@2:start
>
>
>
>
> the activator file:
>
> package com.ection;
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.events.SelectionAdapter;
> import org.eclipse.swt.events.SelectionEvent;
> import org.eclipse.swt.layout.FormAttachment;
> import org.eclipse.swt.layout.FormData;
> import org.eclipse.swt.layout.FormLayout;
> import org.eclipse.swt.layout.GridData;
> import org.eclipse.swt.layout.GridLayout;
> import org.eclipse.swt.widgets.Button;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.widgets.MessageBox;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Text;
> import org.osgi.framework.Bundle;
> import org.osgi.framework.BundleActivator;
> import org.osgi.framework.BundleContext;
> import org.osgi.framework.BundleEvent;
> import org.osgi.framework.BundleException;
> import org.osgi.framework.BundleListener;
>
>
> public class Activator implements BundleActivator, BundleListener{
> private static final String MAIN_PATH= "reference:file:main/";
> private static final String FUNCTIONS_PATH= "reference:file:plugins/";
> private static final String ECTIONMAIN = "YctTerminalMain_1.0.0.jar";
> private static final String ECTIONTOOLS = "EctionTools_1.0.0.jar";
> private static final String ECTIONCONVERT= "TerminalConverter_1.0.0.jar";
> Bundle consoleBundle;
> private Shell shell;
> private Display display;
> private String userName;
> private String password;
>
> Text userNameInput;
> Text passwordInput;
> Button okBtn;
> public void start(final BundleContext context) throws Exception {
>
> Thread mainThread = new Thread(){
> public void run(){
> display = Display.getDefault();
> shell = new Shell(SWT.NONE);
>
> shell.setSize(800, 600);
> shell.setLocation(0,0);
> shell.setText("SWT Application");
> shell.setLayout(new FormLayout());
>
> final Composite composite = new Composite(shell, SWT.BORDER );
> final GridLayout gridLayout = new GridLayout();
> gridLayout.makeColumnsEqualWidth = true;
> gridLayout.verticalSpacing = 15;
> gridLayout.numColumns = 4;
> composite.setLayout(gridLayout);
> final FormData formData = new FormData();
> formData.bottom = new FormAttachment(60, 0);
> formData.right = new FormAttachment(79, 0);
> formData.top = new FormAttachment(30, 0);
> formData.left = new FormAttachment(19, 0);
> composite.setLayoutData(formData);
>
> final Label label = new Label(composite, SWT.NONE);
> final GridData gridData_4 = new GridData(GridData.FILL, GridData.CENTER,
> false, false);
> gridData_4.widthHint = 75;
> label.setLayoutData(gridData_4);
> label.setText("UserName:");
>
> userNameInput = new Text(composite, SWT.BORDER);
> final GridData gridData = new GridData(GridData.FILL, GridData.FILL,
> true, false, 3, 1);
> gridData.heightHint = 27;
> userNameInput.setLayoutData(gridData);
>
> final Label label_1 = new Label(composite, SWT.NONE);
> final GridData gridData_5 = new GridData(GridData.FILL, GridData.CENTER,
> false, false);
> gridData_5.widthHint = 74;
> label_1.setLayoutData(gridData_5);
> label_1.setText("Password:");
>
> passwordInput = new Text(composite, SWT.PASSWORD | SWT.BORDER);
> final GridData gridData_1 = new GridData(GridData.FILL, GridData.FILL,
> true, false, 3, 1);
> gridData_1.heightHint = 30;
> passwordInput.setLayoutData(gridData_1);
>
> final Label LoginInfoDisp = new Label(composite, SWT.CENTER);
> LoginInfoDisp.setAlignment(SWT.CENTER);
> final GridData gridData_2 = new GridData(GridData.FILL, GridData.CENTER,
> false, false, 2, 1);
> gridData_2.heightHint = 26;
> LoginInfoDisp.setLayoutData(gridData_2);
> final Button cancelBtn = new Button(composite, SWT.NONE);
> cancelBtn.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(SelectionEvent e) {
> MessageBox dialog = new
> MessageBox(shell,SWT.YES|SWT.NO|SWT.ICON_QUESTION);
> dialog.setMessage("Are you sure?");
> dialog.setText("Exit");
> if(dialog.open()==SWT.YES)shell.dispose();
>
> }
> });
> cancelBtn.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
> false, false));
> cancelBtn.setText("Exit");
>
> okBtn = new Button(composite, SWT.NONE);
> okBtn.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(SelectionEvent e) {
> userName = userNameInput.getText().trim();
> password = passwordInput.getText().trim();
>
> userNameInput.setText("");
> passwordInput.setText("");
> processLogin(context);
> }
>
> });
> final GridData gridData_3 = new GridData(GridData.FILL, GridData.FILL,
> false, false);
> gridData_3.heightHint = 35;
> okBtn.setLayoutData(gridData_3);
> okBtn.setText("µЗВј");
>
> shell.open();
>
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
> try {
> context.getBundle(0).stop();
> } catch (BundleException e) {
> e.printStackTrace();
> }
> }
> };
> mainThread.start(); }
>
> public void stop(BundleContext context) throws Exception {
> if(shell==null){
> context.getBundle(0).stop();
> System.exit(0);
> return;
> }
> if(!shell.isDisposed()){
> display.syncExec(new Runnable(){public void run(){shell.dispose();}});
>
> }
> while(!shell.isDisposed()){
> System.out.println("");
> Thread.sleep(500);
> }
> System.exit(0);
>
> }
> private void errorExit(final BundleContext context,final String
> caption,final String text){
> display.syncExec(new Runnable(){
> public void run() {
> MessageBox mb = new MessageBox(shell,SWT.ICON_ERROR);
> mb.setMessage(text);
> mb.setText(caption);
> mb.open();
> try {
> context.getBundle(0).stop();
> } catch (BundleException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> System.exit(-1);
> }});
>
> }
>
>
> private void processLogin(final BundleContext context) {
>
> }
>
> public void bundleChanged(BundleEvent event) {
> // TODO Auto-generated method stub
>
> }
> }
>
>
|
|
|
Re: Does not run under linux? [message #64205 is a reply to message #64148] |
Wed, 29 March 2006 17:32 |
Eclipse User |
|
|
|
Originally posted by: alex_blewitt.yahoo.com
osgi.bundles=org.eclipse.swt.win32.win32.x86_3.2.0.v3224.jar
You shouldn't have this bundle in here; it's specific to win32. It may be trying to start that bundle fragment up and giving you the error. You shouldn't even need the SWT bundle there; you should let the main bundle determine what it needs, and importantly, load the right version of SWT for your platform.
Alex
|
|
| |
Goto Forum:
Current Time: Fri Dec 27 00:11:28 GMT 2024
Powered by FUDForum. Page generated in 0.03459 seconds
|