Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get distribution to work on Windows #5

Closed
SirClickALot opened this issue Jun 6, 2020 · 19 comments
Closed

Cannot get distribution to work on Windows #5

SirClickALot opened this issue Jun 6, 2020 · 19 comments

Comments

@SirClickALot
Copy link

Hello,

This looks great for what I am trying to do but for some reason, I cannot get the distribution to work on my Windows 10 Pro (Intel(R) Core(TM) i5-6300U CPU © 2.40GHz 2.50 GHz 8.00 GB)

I have expanded the latest distribution archive into a local folder as directed.
I am able to run multiple other Java based projects but on trying to run the .exe on this one I get a message...

"Java Virtual Machine Launcher
Error: A JNI error has occurred, please check your installation
and try again"

I wondered if you might have any suggestions.

Thank you

@hneemann
Copy link
Owner

hneemann commented Jun 6, 2020

Hmm! Neither the simulator nor the assembler use the JNI. Therefore it can only be a problem with the Java installation. Have you ever tried to run the program from the command line?

java -jar Assembler.jar

@hneemann
Copy link
Owner

hneemann commented Jun 6, 2020

Maybe it is this or a similar problem?

@SirClickALot
Copy link
Author

There is no Assembler.jar in the local asm3 directory.
I have :
"C:\local\asm3\examples"
"C:\local\asm3\asm3.exe"
"C:\local\asm3\asm3.jar"
"C:\local\asm3\instructions.pdf"
"C:\local\asm3\Version.txt"

When I issue:
java -jar asm3.jar

java.lang.UnsupportedClassVersionError: de/neemann/assembler/gui/Main has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0
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)

@hneemann
Copy link
Owner

hneemann commented Jun 6, 2020

Yes, the name of the jar file is "asm3.jar".

The error message is due to the fact that i had to migrate to JDK 9 due to problems with checkstyle.
If a program is compiled with the JDK 9 it is not possible to start it with a JRE 8.
I didn't expect this to be a problem as the JDK 8 is already 6 years old. Most users will use newer versions anyway. And using a newer JDK is always possible.

@jnoche
Copy link

jnoche commented Mar 3, 2021

I'm having the same problem as @SirClickALot. Note that I am not a programmer, and so am unfamiliar with Java.

I'm running Windows 10 and if I type "java -showversion" on my command prompt, it says "java version "1.8.0_281" Java(TM) SE Runtime Environment (build 1.8.0_281-b09)." I am able to run Digital v0.26, but when I try to run asm3.exe, I get exactly the same error as SirClickALot.

I install Java SE Development Kit 15.0.1. (It doesn't remove Java 1.8.0.) Digital works, but asm3 doesn't. If I type "java -showversion" on my command prompt, it says "java version "1.8.0_281"."

I uninstall Java 1.8.0. asm3 now works, but Digital now doesn't. Digital shows an error window "This application requires a Java Runtime Environment 1.8.0" and clicking OK leads to the installation of Java 1.8.0.

Reinstalling Java 1.8.0 leads me back to the beginning, with Digital working and asm3 not working.

Mr. Neemann, could you tell me what exactly is your set-up so that you are able to run Digital and asm3 at the same time?

@hneemann
Copy link
Owner

hneemann commented Mar 3, 2021

There is maybe a problem in the Digital.exe that starts Digital on a Windows machine. There is already a open issue in the Digital issue tracker. I'm on it, but since I don't use Windows myself and haven't even installed it, it takes a little longer to fix. But the Digital.exe is just a convenient wrapper that allows launching when Java is not correctly associated with jar files.
What always works, and also is the "normal" way to start a java program is

java -jar [name of jar]

this means that you can start both applikations like

java -jar Digital.jar

java -jar asm3.jar

If your system is setup correctly it should also be possible to start the files by simpliy double clicking on the jar files.

@jnoche
Copy link

jnoche commented Mar 3, 2021

Thank you very much for your prompt response. You are correct that digital.exe in Windows is the problem.

I uninstalled Java 1.8.0. So now if I type "java -showversion" on my command prompt, it says "java version "15.0.1" 2020-10-20." Now when I click on asm3.jar, it works, and when I click on digital.jar, it works. Digital does now look a little different (the components now seem to appear in a lower resolution). But the two programs are now working at the same time. (Perhaps in the future, the error with digital.exe in Windows will be fixed.)

(I am directly mentioning @SirClickALot so that he knows that a solution to the problem has been found.)

Thank you again!

@hneemann
Copy link
Owner

hneemann commented Mar 3, 2021

The whole problem arises only because there are some ZIP programs for Windows out there that link themselves to jar files during installation. (Technically a jar file is a zip file) Then Java programs don't start anymore, but instead the zip program asks where to unpack the jar file. Just to avoid this, there is a file Digital.exe, which still works when a zip program has linked itself to jar files.

Which jdk do you have installed?

@jnoche
Copy link

jnoche commented Mar 3, 2021

I used to have Java 1.8.0 installed, but now I only have Java 15.0.1 installed.

I'm using BreeZip 1.3.18 and although it is set to open zip files, it is not set to open jar files. (My jar files have a Java icon, not a BreeZip icon.)

I just performed an experiment. When I downloaded and unzipped Digital v0.26.1 (a few days ago, I think), I had only Java 1.8.0 installed. But now that I have only Java 15.0.1, I downloaded and unzipped Digital v0.26.1 again. digital.jar still works when I click on it, but clicking on digital.exe still gives the same error "This application requires a Java Runtime Environment 1.8.0."

@hneemann
Copy link
Owner

hneemann commented Mar 3, 2021

There are several java 15 versions out there, Oracle Java, OpenJDK or AdoptOpenJDK.

Could you please post the complete console output of java -version?

@jnoche
Copy link

jnoche commented Mar 3, 2021

java version "15.0.1" 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)

@hneemann
Copy link
Owner

hneemann commented Mar 3, 2021

Oops! My fault! What I meant was:

java -XshowSettings:properties -version

@jnoche
Copy link

jnoche commented Mar 3, 2021

Property settings:
file.encoding = Cp1252
file.separator = \
java.class.path =
java.class.version = 59.0
java.home = C:\Program Files\Java\jdk-15.0.1
java.io.tmpdir = C:\Users\JOELNO~1\AppData\Local\Temp\
java.library.path = C:\Program Files\Java\jdk-15.0.1\bin
C:\WINDOWS\Sun\Java\bin
C:\WINDOWS\system32
C:\WINDOWS
C:\Program Files\Common Files\Oracle\Java\javapath
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\
C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\
C:\windows\system32
C:\windows
C:\windows\System32\Wbem
C:\windows\System32\WindowsPowerShell\v1.0\
C:\windows\System32\OpenSSH\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\Intel\WiFi\bin\
C:\Program Files\Common Files\Intel\WirelessCommon\
C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Users\Joel Noche\AppData\Local\Microsoft\WindowsApps
C:\Users\Joel Noche\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64\
.
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 15.0.1+9-18
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 15
java.vendor = Oracle Corporation
java.vendor.url = https://java.oracle.com/
java.vendor.url.bug = https://bugreport.java.com/bugreport/
java.version = 15.0.1
java.version.date = 2020-10-20
java.vm.compressedOopsMode = 32-bit
java.vm.info = mixed mode, sharing
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 15
java.vm.vendor = Oracle Corporation
java.vm.version = 15.0.1+9-18
jdk.debug = release
line.separator = \r \n
os.arch = amd64
os.name = Windows 10
os.version = 10.0
path.separator = ;
sun.arch.data.model = 64
sun.boot.library.path = C:\Program Files\Java\jdk-15.0.1\bin
sun.cpu.endian = little
sun.cpu.isalist = amd64
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = Cp1252
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
sun.os.patch.level =
sun.stderr.encoding = cp437
user.country = PH
user.dir = C:\Users\Joel Noche
user.home = C:\Users\Joel Noche
user.language = en
user.name = Joel Noche
user.script =
user.variant =

java version "15.0.1" 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)

@rcrist
Copy link

rcrist commented Mar 17, 2021

I was able to solve the issue after reading through the previous comments. I can run Assembler from a different Java SDK (12.0) and Digital still runs under Java 1.8. I put a copy of the asm3.jar file in the 12.0 SDK/bin directory, created a shortcut which runs the command java -jar asm3.jar, and changed the icon to the asm3.exe icon. Seems to be working.

@hneemann
Copy link
Owner

@rcrist
There is no need to install multiple JDKs/JREs.
Digital as well as the assembler are runnung on all java versions newer or equal to 1.9
If there is no crazy zip tool installed that messed up the Java installation, clicking on Digital.jar or asm3.jar should launch the applications.

@SirClickALot
Copy link
Author

I am trying this again now some 18m months after my initial post and I still cannot run asm3 on Windows.

I've read through all the various responses above and do indeed make good sense but I think the problem really does stem from some kind of Java version incompatibility issue when using Windows.

I can confirm the following that I hope is useful to help solve this issue:

  1. A can double-click on Digital.jar in Windows (11 in my case) and everything runs perfectly fine.
    (Likewise via the .exe wrapper too)
  2. A can essentially do the same on my Linux machine without any issue
  3. But when trying to run the asm3 as a .jar or via the .exe wrapper I too consistently get the error...

Java Virtual Machine Launcher Error: A JNI error has occurred, please check your installation and try again

I was hoping to the use the combination of Digital and ASM3 in Windows when teaching the elements of Assembly language to young student so it would be most useful if someone can help solve this issue for us all.

I am using Java version ....
Version 8 Update 301 (build 1.8.0_301-bQ9)

@SirClickALot
Copy link
Author

SirClickALot commented Jan 11, 2022

RE the above ^^^^, my full Java info is...

`
$ java -XshowSettings:properties -version
Property settings:
awt.toolkit = sun.awt.windows.WToolkit
file.encoding = Cp1252
file.encoding.pkg = sun.io
file.separator =
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.awt.printerjob = sun.awt.windows.WPrinterJob
java.class.path = .
java.class.version = 52.0
java.endorsed.dirs = C:\Program Files\Java\jre1.8.0_301\lib\endorsed
java.ext.dirs = C:\Program Files\Java\jre1.8.0_301\lib\ext
C:\WINDOWS\Sun\Java\lib\ext
java.home = C:\Program Files\Java\jre1.8.0_301
java.io.tmpdir = C:\Users\nick\AppData\Local\Temp
java.library.path = C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\WINDOWS\Sun\Java\bin
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.8.0_301-b09
java.specification.name = Java Platform API Specification
java.specification.vendor = Oracle Corporation
java.specification.version = 1.8
java.vendor = Oracle Corporation
java.vendor.url = http://java.oracle.com/
java.vendor.url.bug = http://bugreport.sun.com/bugreport/
java.version = 1.8.0_301
java.vm.info = mixed mode
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name = Java Virtual Machine Specification
java.vm.specification.vendor = Oracle Corporation
java.vm.specification.version = 1.8
java.vm.vendor = Oracle Corporation
java.vm.version = 25.301-b09
line.separator = \r \n
os.arch = amd64
os.name = Windows 10
os.version = 10.0
path.separator = ;
sun.arch.data.model = 64
sun.boot.class.path = C:\Program Files\Java\jre1.8.0_301\lib\resources.jar
C:\Program Files\Java\jre1.8.0_301\lib\rt.jar
C:\Program Files\Java\jre1.8.0_301\lib\sunrsasign.jar
C:\Program Files\Java\jre1.8.0_301\lib\jsse.jar
C:\Program Files\Java\jre1.8.0_301\lib\jce.jar
C:\Program Files\Java\jre1.8.0_301\lib\charsets.jar
C:\Program Files\Java\jre1.8.0_301\lib\jfr.jar
C:\Program Files\Java\jre1.8.0_301\classes
sun.boot.library.path = C:\Program Files\Java\jre1.8.0_301\bin
sun.cpu.endian = little
sun.cpu.isalist = amd64
sun.desktop = windows
sun.io.unicode.encoding = UnicodeLittle
sun.java.launcher = SUN_STANDARD
sun.jnu.encoding = Cp1252
sun.management.compiler = HotSpot 64-Bit Tiered Compilers
sun.os.patch.level =
sun.stderr.encoding = cp850
sun.stdout.encoding = cp850
user.country = GB
user.dir = C:\Users\nick\Sites
user.home = C:\Users\nick
user.language = en
user.name = nick
user.script =
user.timezone =
user.variant =

java version "1.8.0_301"
Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.301-b09, mixed mode)
`

@hneemann
Copy link
Owner

Hmm!
I don't know what is happening here, but it still seems like there is something wrong with the Java installation.
This problem seems to occur for example when different JRE/JDK versions are installed and these installations do interfere.
It is also a Java 1.8 installation, and the assembler was compiled with Java 1.9. Even if the JNI problem is fixed, I would expect a corresponding new error message.
I would try to remove all java installations and then install Java 16 or Java 17.

@SirClickALot
Copy link
Author

Thanks @hneemann!

I think I understand now; when I looking around the web for ONLY the JRE (as opposed to the full JDK) , I am repeatedly directed back to https://www.java.com/en/download/ where I only seem to have access to JRE 8. However, following your recommended link () I now have Java 16 in place, I can straight away run the Assembler. Great stuff!

Next hitch is actually how to use it; I'm not sure that you instructions are complete/up-to-date or just plain clear enough for a baboon like me! I've detailed my questions in a another issue -> #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants