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

Exception in thread main error in Ubuntu 20.04 Focal Fossa. #8

Open
SonicFan2020-best opened this issue Jan 18, 2022 · 7 comments
Open

Comments

@SonicFan2020-best
Copy link

I'm trying to make a program that uses your emulator to emulate Windows 95.

But on Ubuntu 20.04 Focal Fossa, I get this error message:

Exception in thread "main" java.lang.IllegalStateException at org.jpc.j2se.JPCApplication.getResources(JPCApplication.java:593) at org.jpc.j2se.JPCApplication.<init>(JPCApplication.java:205) at org.jpc.j2se.JPCApplication.main(JPCApplication.java:766)

How do I fix this?

@ianopolous
Copy link
Owner

The resources need to be in the class path. This includes for example the bios image.

@SonicFan2020-best
Copy link
Author

The resources need to be in the class path. This includes for example the bios image.

wait you think i builded the emulator.

oh i should try that

@SonicFan2020-best
Copy link
Author

alright lets try it

@SonicFan2020-best
Copy link
Author

well didnt work :(

@SonicFan2020-best
Copy link
Author

Nice. Even more errors.
The errors

@pengan1987
Copy link

It seems like current build of JPC is not working on JDK11 or later, if I run it with JDK1.8 it's running fine.

@thurisaz-org
Copy link

thurisaz-org commented Sep 26, 2022

The problem is that Java 9 changed the class loader to no longer be a URLClassLoader
A custom ClassLoader may need to be written to get it working on the current Java
https://stackoverflow.com/questions/46694600/java-9-compatability-issue-with-classloader-getsystemclassloader

Edit:
A Solution is pretty simple.
Around like 523 to 525 should be replaced to the code below or whatever is more kosher

        /*if (!(cl instanceof URLClassLoader)) {
            throw new IllegalStateException();
        }*/
        URL[] urls = new URL[0];
        try {
            urls = Collections.list(cl.getResources("")).toArray(urls);
        } catch (IOException ex) {
            Logger.getLogger(JPCApplication.class.getName()).log(Level.SEVERE, null, ex);
        }       

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