如何在最新的Java LTS 11中运行旧版的Java经典程序?

huangapple go评论86阅读模式
英文:

How to run old school Java programs with latest Java LTS 11?

问题

我想运行西门子LOGO Soft Comfort。

dell@dell-Precision-M6400:~/Hämtningar/Logo 6.1/Linux/tools/Application$ ./LOGOComfort
无法识别的选项:-Xincgc
错误:无法创建Java虚拟机。
错误:发生了致命异常。程序将退出。
dell@dell-Precision-M6400:~/Hämtningar/Logo 6.1/Linux/tools/Application$

这是西门子LOGO软件舒适版6.1,我有许可证。但是我遇到了一个问题。

无法识别的选项:-Xincgc

那么我该如何使最新的Java LTS 11能够与2008年的Java一起工作呢?我假设那是Java SE 6或J2SE 5.0。

使用LOGO软件,它附带了两个文件夹binlib

更新:

我在LOGOComfort.lax文件中删除了-Xincgc,现在我得到了这个:

dell@dell-Precision-M6400:~/Hämtningar/Logo 6.1/Linux/tools/Application$ ./LOGOComfort
此Java应用程序的调用导致了InvocationTargetException。该应用程序现在将退出。(LAX)

堆栈跟踪:
java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at DE.siemens.ad.logo.app.Application.<clinit>(Application.java:141)
at Start.startApplication(Start.java:570)
at Start.main(Start.java:553)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.zerog.lax.LAX.launch(DashoA8113)
at com.zerog.lax.LAX.main(DashoA8113)
原因是:java.lang.ClassNotFoundException: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 18 more
此应用程序意外退出:此Java应用程序的调用导致了InvocationTargetException。该应用程序现在将退出。(LAX)
dell@dell-Precision-M6400:~/Hämtningar/Logo 6.1/Linux/tools/Application$

更新:

解决方案:

  1. 删除 -Xincgc
  2. 使用Java 8。它需要Swing。Java 11不使用Swing。
英文:

I want to run Siemens LOGO Soft Comfort.

dell@dell-Precision-M6400:~/H&#228;mtningar/Logo 6.1/Linux/tools/Application$ ./LOGOComfort 
Unrecognized option: -Xincgc
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
dell@dell-Precision-M6400:~/H&#228;mtningar/Logo 6.1/Linux/tools/Application$ 

This is Siemens LOGO soft comfort 6.1 and I have a license for that. But I have an issue.

Unrecognized option: -Xincgc

So how can I do so latest Java LTS 11 can work with Java from 2008? I assume that is Java SE 6 or J2SE 5.0.

With LOGO software, it comes with two folders bin and lib

如何在最新的Java LTS 11中运行旧版的Java经典程序?

如何在最新的Java LTS 11中运行旧版的Java经典程序?

Update:

I removed the -Xincgc in LOGOComfort.lax file and now I got this

dell@dell-Precision-M6400:~/H&#228;mtningar/Logo 6.1/Linux/tools/Application$ ./LOGOComfort 
Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)

Stack Trace:
java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:800)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:698)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:621)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:579)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at DE.siemens.ad.logo.app.Application.&lt;clinit&gt;(Application.java:141)
	at Start.startApplication(Start.java:570)
	at Start.main(Start.java:553)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.zerog.lax.LAX.launch(DashoA8113)
	at com.zerog.lax.LAX.main(DashoA8113)
Caused by: java.lang.ClassNotFoundException: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 18 more
This Application has Unexpectedly Quit: Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX)
dell@dell-Precision-M6400:~/H&#228;mtningar/Logo 6.1/Linux/tools/Application$ 

Update:

Solution:

  1. Remove -Xincgc
  2. Use Java 8 instead. It requries Swing. Java 11 does not use Swing

答案1

得分: 3

打开名为'LOGOComfort'的文件,因为它很可能是一个Shell脚本。找到-Xincgc选项并将其移除。

如果内容难以理解,安装Java 6,它仍保留了被移除的-Xincgc选项。

如果以上不可行,可以创建一个虚假的Java:制作一个脚本,放在“真实”Java位置,它的作用是扫描所有命令行参数,从中删除-Xincgc,然后将剩余部分原封不动地传递给真正的Java。这是一种疯狂的方法,可能会影响其他功能,但很可能能够“修复”这个问题。我强烈建议您首先尝试前两个选项。

对于Java 11+,无法使用-Xincgc选项。

英文:

open the file 'LOGOComfort', as it is likely a shell script. Find the -Xincgc option and remove it.

If it's gobbledygook, install a java6, which does have the now removed -Xincgc option.

If that's not an option, make a fake java: Make a script that rests at the 'real' java location, and all it does is scan for all command line args, strip -Xincgc from it, and pass the rest through unmolested to the real java. This is a crazy hack and is likely to break other things, but it will probably 'fix' this. I strongly recommend you go with one of the first 2 options first.

There is no way to tell java 11+: Can you 'support' the -Xincgc option.

答案2

得分: 2

错误消息表示无法找到与Windows关联的外观配置文件。

> java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel

显然,该应用程序过去是针对Windows设计的。也许脚本更改了外观配置文件,但如果不查看它,我无法告诉您。

最好的办法是在Windows计算机上尝试一下,看看是否能进一步进行。如果不能,那么您将不得不尝试在支持该配置文件的旧版JRE(例如JRE 6)上运行。

英文:

The error message is saying that it can't find the look and feel profile associated with Windows.

> java.lang.NoClassDefFoundError: com/sun/java/swing/plaf/windows/WindowsLookAndFeel

Clearly, this app was intended for Windows in the past. Maybe the script changes the look and feel profile, but I couldn't tell you without looking at it.

Best bet is try this on a Windows machine and see if it goes any further. If not then you'll have to try it with an older JRE that supports that, such as JRE 6.

答案3

得分: 1

我知道这是一个旧问题,但我仍然有一个可能有效的解决方案(对我有效)。您需要使该应用程序的Java可执行,使用以下命令:

chmod a+x $PATH_TO_LOGO/Application_64/jre/bin/java
英文:

I know this is a old question, but I still have a solution that may work (it worked for me). You need to make the application java executable by

chmod a+x $PATH_TO_LOGO/Application_64/jre/bin/java

huangapple
  • 本文由 发表于 2020年9月4日 19:37:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/63740437.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定