Unable to run .jar (Java File) from network drive

We are trying to run a .jar file from a network location and we keep getting the error "Error: Unable to access jarfile".  We have tried linux and window shares so it is not a rights issue. We can not copy it over to run it because all the files with it are huge. Here is the command we are trying. I understand that the .jar file is trying to run on the network drive is there a way around this? Thanks!

 java -Xmx768m -jar "\\fs1\groups\bios\program1.jar" -b \\192.168.15.20\Transfer\run.xml

Open in new window


-Windows Pro 10 x64
LVL 8
ITSysTechSenior Systems AdministratorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
What happens when you do this?

copy "\\fs1\groups\bios\program1.jar"  .

Open in new window

ITSysTechSenior Systems AdministratorAuthor Commented:
It works and says "1 file(s) copied"
CEHJCommented:
OK. I can only think that copy/cmd.exe is SMB-aware and java.exe is not. You might have to map that network share to a drive letter and use a path with that in it
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Shaun VermaakTechnical SpecialistCommented:
Does this work is a batch
@echo off
copy "\\fs1\groups\bios\program1.jar" %temp% /y
copy "\\192.168.15.20\Transfer\run.xml" %temp% /y
java -Xmx768m -jar "%temp%\program1.jar" -b "%temp%\Transfer\run.xml"

Open in new window

ITSysTechSenior Systems AdministratorAuthor Commented:
Thanks for the code Shaun. However, It didn't seem to work for some reason. I received a different error though.

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/Layout
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.privateGetMethodRecursive(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.core.Layout
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)

Open in new window

CEHJCommented:
It did work (i've already proved you can copy files). Or you wouldn't have that error. You're missing jar dependencies
Shaun VermaakTechnical SpecialistCommented:
Perhaps
@echo off
robocopy "\\fs1\groups\bios\" "%temp%" /e
copy "\\192.168.15.20\Transfer\run.xml" %temp% /y
java -Xmx768m -jar "%temp%\program1.jar" -b "%temp%\Transfer\run.xml"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.