Can't run default client with .bat file after building it

Forum for alternative clients, mods & discussions on the same.

Can't run default client with .bat file after building it

Postby Nightdawg » Wed Jul 13, 2022 10:39 pm

Nvm I was using the wrong folder
Image

I use the "Run" ant build script, it works, the client opens.

I try to use a bat file to start the client, I get this error:
[hide]
Code: Select all
Exception in thread "Haven main thread" java.lang.Error: java.lang.reflect.InvocationTargetException
        at haven.MainFrame.javabughack(MainFrame.java:384)
        at haven.MainFrame.main2(MainFrame.java:393)
        at haven.MainFrame.lambda$main$0(MainFrame.java:443)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException
        at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1371)
        at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1346)
        at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
        at haven.MainFrame.javabughack(MainFrame.java:375)
        ... 3 more
Caused by: java.lang.ExceptionInInitializerError
        at haven.LoginScreen.<clinit>(LoginScreen.java:34)
        at haven.MainFrame$5.run(MainFrame.java:378)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: haven.Resource$NoSuchResourceException: Failed to load resource ui/fraktur (v-1)
        at haven.Resource$Pool$Queued.get(Resource.java:506)
        at haven.Resource$Pool$Queued.get(Resource.java:472)
        at haven.Loading.waitforint(Loading.java:119)
        at haven.Loading.waitfor(Loading.java:131)
        at haven.Resource$Pool.loadwait(Resource.java:775)
        at haven.Resource$Pool.loadwait(Resource.java:779)
        at haven.Text.<clinit>(Text.java:39)
        ... 15 more
Caused by: haven.Resource$LoadException: Load error in resource ui/fraktur(v-1), from local res source (res)
        at haven.Resource$Pool.handle(Resource.java:567)
        at haven.Resource$Pool.access$1200(Resource.java:449)
        at haven.Resource$Pool$Loader.run(Resource.java:697)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.FileNotFoundException: Could not find resource locally: /res/ui/fraktur.res
        at haven.Resource$JarSource.get(Resource.java:287)
        at haven.Resource$Pool.handle(Resource.java:552)
        ... 3 more

I replace the retarded font, build it again, I GET THIS ERROR:
[hide]
Code: Select all
Exception in thread "Haven main thread" java.lang.Error: java.lang.reflect.InvocationTargetException
        at haven.MainFrame.javabughack(MainFrame.java:384)
        at haven.MainFrame.main2(MainFrame.java:393)
        at haven.MainFrame.lambda$main$0(MainFrame.java:443)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException
        at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1371)
        at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1346)
        at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
        at haven.MainFrame.javabughack(MainFrame.java:375)
        ... 3 more
Caused by: java.lang.ExceptionInInitializerError
        at haven.MainFrame$5.run(MainFrame.java:378)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: haven.Resource$NoSuchResourceException: Failed to load resource gfx/loginscr (v-1)
        at haven.Resource$Pool$Queued.get(Resource.java:506)
        at haven.Resource$Pool$Queued.get(Resource.java:472)
        at haven.Loading.waitforint(Loading.java:119)
        at haven.Loading.waitfor(Loading.java:131)
        at haven.Resource$Pool.loadwait(Resource.java:775)
        at haven.Resource$Pool.loadwait(Resource.java:779)
        at haven.Resource.loadrimg(Resource.java:1860)
        at haven.Resource.loadtex(Resource.java:1872)
        at haven.LoginScreen.<clinit>(LoginScreen.java:36)
        ... 14 more
Caused by: haven.Resource$LoadException: Load error in resource gfx/loginscr(v-1), from local res source (res)
        at haven.Resource$Pool.handle(Resource.java:567)
        at haven.Resource$Pool.access$1200(Resource.java:449)
        at haven.Resource$Pool$Loader.run(Resource.java:697)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.FileNotFoundException: Could not find resource locally: /res/gfx/loginscr.res
        at haven.Resource$JarSource.get(Resource.java:287)
        at haven.Resource$Pool.handle(Resource.java:552)
        ... 3 more

I use this in IntelliJ's terminal:
Code: Select all
java -cp bin/hafen.jar haven.Resource find-updates

Nothing happens.

I try this:
Code: Select all
java -cp bin/hafen.jar haven.Resource get-code ui/fraktur

I get this: get-code: no source code found in resource: ui/fraktur

Wtf am I doing wrong? Where are all of these res files? Why are they not here by default? Why does the client have these res files when I use the "run" ant builder script thing but not when I use a .bat file?
I literally cloned loftar's repository and modified nothing.

I'm frustrated, I know I'm an idiot, but PLEASE someone just tell me what I'm doing wrong.
Thanks
Last edited by Nightdawg on Thu Jul 14, 2022 12:35 am, edited 2 times in total.
if you're reading this, you're a nerd.
Image
User avatar
Nightdawg
 
Posts: 1766
Joined: Fri Feb 28, 2020 12:31 am
Location: In your pepper farm

Re: Can't run default client with .bat file after building i

Postby Mashadar » Thu Jul 14, 2022 12:13 am

I'm not sure why you get the exception, I can only guess that there is something weird about the bat file or there's some conflict with the Java version you have.
If a simple java -jar hafen.jar in the bin folder produces the same error, there's something wrong and perhaps you can try a different Java version. I currently use OpenJDK 11, which works fine for Haven.

As for the new resource commands, my understanding is the following:
The "find-updates" command only updates source files that you previously fetched with "get-code" and the get-code command only works for resources that actually contain Java source code.
So for normal resources that only contain textures/meshes/fonts but no code (which is the case for ui/fraktur), you need an external resource tool that can extract and repack the resource files.
After replacing the font in the resource file, you can then place it in one of the res files, like builtin-res.jar.
Though for that particular font, you can just replace the fraktur line in Text.java, so you don't even need to bother with the res file.
User avatar
Mashadar
 
Posts: 362
Joined: Thu Jan 20, 2011 9:34 am

Re: Can't run default client with .bat file after building i

Postby Nightdawg » Thu Jul 14, 2022 12:30 am

Mashadar wrote:I'm not sure why you get the exception, I can only guess that there is something weird about the bat file or there's some conflict with the Java version you have.
If a simple java -jar hafen.jar in the bin folder produces the same error, there's something wrong and perhaps you can try a different Java version. I currently use OpenJDK 11, which works fine for Haven.

As for the new resource commands, my understanding is the following:
The "find-updates" command only updates source files that you previously fetched with "get-code" and the get-code command only works for resources that actually contain Java source code.
So for normal resources that only contain textures/meshes/fonts but no code (which is the case for ui/fraktur), you need an external resource tool that can extract and repack the resource files.
After replacing the font in the resource file, you can then place it in one of the res files, like builtin-res.jar.
Though for that particular font, you can just replace the fraktur line in Text.java, so you don't even need to bother with the res file.



OH hold on, I have to use the "bin" folder?

lmaoooo shit

I was using the "build" folder.

thanks
if you're reading this, you're a nerd.
Image
User avatar
Nightdawg
 
Posts: 1766
Joined: Fri Feb 28, 2020 12:31 am
Location: In your pepper farm

Re: Can't run default client with .bat file after building i

Postby Mashadar » Thu Jul 14, 2022 1:01 am

As for where to get the resources... any resource file that isn't packaged with the client is fetched at runtime from the Haven servers. So you can also do that manually, for example:
https://game.havenandhearth.com/render/ ... raktur.res

Doing it manually would be a bit of a pain, so I guess it's best to have a tool do that. People have posted resource tools at various points - I never looked at any of them, but maybe some of them are still around and potentially useful for this.
I'll also release a graphical resource editor at some point, since I'm hoping I can encourage people to help improve some assets in a quest to make the game look better.
User avatar
Mashadar
 
Posts: 362
Joined: Thu Jan 20, 2011 9:34 am

Re: Can't run default client with .bat file after building i

Postby bumfrog » Thu Jul 14, 2022 4:33 am

bro y r u playin hafen rn?

cringe!
User avatar
bumfrog
Under curfew
 
Posts: 429
Joined: Wed Mar 24, 2021 12:47 am


Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 11 guests