首页 > 系统相关 >Eclipse: export project such that Windows and Mac can both run it (SWT)

Eclipse: export project such that Windows and Mac can both run it (SWT)

时间:2023-11-06 12:03:56浏览次数:58  
标签:both run Windows eclipse library org java root swt

 [root@localhost aimin]# java -jar TASTS.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
    no swt-win32-4930r7 in java.library.path
    no swt-win32 in java.library.path
    Can't load library: /root/.swt/lib/linux/x86_64/libswt-win32-4930r7.so
    Can't load library: /root/.swt/lib/linux/x86_64/libswt-win32.so

    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:344)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:256)
    at org.eclipse.swt.internal.C.<clinit>(C.java:19)
    at org.eclipse.swt.widgets.Display.<clinit>(Display.java:145)
    at MainForm.main(MainForm.java:10)
[root@localhost aimin]#
--------------------

[root@localhost aimin]# java -jar TASTS-linux64.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
    no swt-pi4-gtk-4934r6 in java.library.path
    no swt-pi4-gtk in java.library.path
    Can't load library: /root/.swt/lib/linux/x86_64/libswt-pi4-gtk-4934r6.so
    Can't load library: /root/.swt/lib/linux/x86_64/libswt-pi4-gtk.so

    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:342)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:256)
    at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:90)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:209)
    at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:155)
    at org.eclipse.swt.widgets.Display.<clinit>(Display.java:164)
    at MainForm.main(MainForm.java:10)
-----------------------

[root@localhost aimin]# ls /root/.swt/lib/linux/x86_64/
libswt-gtk-4934r6.so  libswt-pi3-gtk-4934r6.so

---------------

You appear to be running a SWT application. On macOS you must specify the -XstartOnFirstThread option when running the jar to run SWT correctly:

jar -XstartOnFirstThread -jar xxxx.jar

SWT applications also have a native library which is different for each platform.

---------------

You have to add the correct SWT.jar to the classpath. You can download them here. (https://www.eclipse.org/swt/)

If you are deploying for Windows, you will have to bundle the swt jar for Windows (either 32bit or 64bit depending on the system).

If you want to create an application that runs on all platforms, have a look at this post:

Create cross platform Java SWT Application (https://stackoverflow.com/questions/2706222/create-cross-platform-java-swt-application/3204032#3204032)

---------------

 

REF

https://stackoverflow.com/questions/2706222/create-cross-platform-java-swt-application/3204032#3204032

https://stackoverflow.com/questions/16567936/swt-running-an-application-developed-on-osx-in-windows

https://stackoverflow.com/questions/42777000/eclipse-export-project-such-that-windows-and-mac-can-both-run-it

 https://stackoverflow.com/questions/3959556/problems-with-loading-resources-during-execution

http://mchr3k.github.io/swtjar/

 



标签:both,run,Windows,eclipse,library,org,java,root,swt
From: https://blog.51cto.com/emanlee/8203539

相关文章

  • windows文件搜索;文件预览;全文搜索,只需myso就够了
    简介  现在提到windows文件搜索,大家可能会想到Everything、Listary、AnyTXT这三款工具,它们各有自己的专长,不能相互替代,需要安装至少两款才能高效的搜索电脑文件。现在向大家推荐一款集这三家之所长的搜索工具myso,仅需安装myso就可以高效的搜索电脑文件。  介绍myso前,先简单......
  • Shell系列---【常用脚本之---java启动脚本:run.sh】
    run.sh#!/bin/sh-lapplication=node_exporterPORT=1888CUR_IP=${hostname-I|awk'{print$1}'}command="/opt/app/middles/node_exporter/node_exporter--web.listen-address=:$PORT"#停止stop(){ echo"=============================......
  • windows10测试时如何构造大图片(如超过8M+的图片)
    1.原图片(大小40k) 2.选怎一个容量大的文件如视频文件8M+ 3.使用copy命令进行扩容(cmd命令行操作):copytest01.jpg/b+8M.MP4test01_8M.jpg 4.完成后查看图片大小(8M+) ps:如果文件容量未变化,记得排查一下,使用的文件与视频名字内均无特殊字符......
  • SATA基础+更改终端颜色+PCI.ids位置+Linux和Windows的scanf+C语言C++的局部变量与全局
    SATA基础https://zhuanlan.zhihu.com/p/554251608物理信号物理层功能时钟恢复:对于高频传输,一般是采用差分信号传输,并且没有单独的时钟,时钟存在于编码内部串并转换:对于高频传输,串联信号可以做到更高的频率。字节对其:8/10编码转换的10bit对其链路层、传输层链路层和传输......
  • 新 Windows 电脑开发环境配置
    ssh基于ED25519算法ssh-keygen-ted25519基础软件7zipGeekUninstallerVsCodeIntelliJIDEADataGripNavicat语雀坚果云EverythingNotePad++Java开发环境JDKinjdk.cn系统变量增加JAVA_HOMEpath增加%JAVA_HOME%\binpath增加%JAVA_HOME%\jre\bin系统变量......
  • Windows ObjectType Hook 之 OkayToCloseProcedure
    1、背景  ObjectTypeHook是基于ObjectType的一种深入的Hook,比起常用的SSDTHook更为深入。  有关ObjectType的分析见文章《Windows驱动开发学习记录-ObjectTypeHook之ObjectType结构相关分析》。  这里进行的Hook为其中之一的OkayToCloseProcedure。文......
  • Windows下,Jar包启动时,自定义cmd窗口名称
    新建bat文件;输入并替换内容; @echoofftitleAPI_XXXX-%date%-%time%-%cd%)java-Dfile.encoding=utf-8 -jar-Xms1024m-Xmx2048m-XX:PermSize=128M-XX:MaxPermSize=256M-Xdebug-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=6002XXXX.jar ......
  • 如何做到像坚果云这样自定义 Windows 文件资源管理器的 UI?
    要像坚果云那样自定义Windows文件资源管理器的UI,你可以尝试以下几个步骤:开发一个Shell扩展:使用WindowsShell编程,你可以开发一个Shell扩展程序,它可以插入到Windows文件资源管理器中,并扩展其功能。可以使用编程语言,如C++或C#来编写Shell扩展。注册Shell扩展:一旦你开发完成Shell扩展,......
  • Windows系统 C/C++程序编译后首次执行时间很长 断网则正常执行 的解决方法
    Windows系统C/C++程序编译后首次执行时间很长断网则正常执行的解决方法问题描述运行环境:Win10、Win11或其他Win环境。在各类IDE(包括但不限于VC6/VisualStuido等)编译任意C/C++源码(无论该程序有多简单),首次运行时间异常地长,即在黑窗口无任何输出。等待一段时间后有程序正......
  • Gitlab加入LDAP认证 (windows AD)<03>
    环境信息:主机名称IP角色AD-Server192.168.61.237AD服务器gitlab192.168.61.112AD服务器[root@gitlab~]#curl-shttps://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh|sudobash[root@gitlab~]#yum-yinstallgitlab......