Linux Java cp command - java

I'm on linux centos6 I run this command successfully :
java -cp "com.opendoorlogistics.connect.jar:com.opendoorlogistics.studio.jar" com.opendoorlogistics.connect.CommandLine -rb batchfile.odlbat
all the jars and the batch file are in the same folder.
If I move the 'com.opendoorlogistics.connect.jar' the 'com.opendoorlogistics.studio.jar' and the 'batchfile.odlbat' to a folder called myfiles what are the paths I need to add to my command to continue running it successfully?
Thanks

Related

How can I make executable file from jar with embedded JVM?

For example, I have someFile.jar. I can run it simply using java -jar someFile.jar.
But I want to create some files (for example .deb file) to install this jar to another machine. This machine may not have jre15 which is required for running this jar. So I want to create some executable file that will contain jar and JVM
I tried to use jpackage --name testName --input . --main-jar someFile.jar --linux-shortcut. This command generates `.deb file but it won't create terminal command testName (to run this jar) but it creates a desktop app that I can run as an application but no one terminal command created. So, how can I create a deb file from the jar with embedded JVM to be able to run it as a command from terminal?
Investigate the content of the deb, or investigate the filesystem once the package is installed. Per default you should find it in /opt/. Underneath that you find a bin directory with only one file. That is the one you can invoke from command line.
JPackage also creates a launcher, which resides in /opt//lib/*.desktop. Check that text and you see that the executable is just the file in the bin directory, which means the GUI will run that exact command when the icon is clicked.

Cannot Find Javax.Comm.Properties in Ubuntu 13.04

I have developed an application which results serial ports in combobox, but when I am running .jar file of my application using command terminal using command:
Java -jar Serial_Send.jar //where Serial_Send is name of my jar file
It is resulting into an error Cannot find javax.comm.properties.
But javax.comm.properties file is present in java_home/jre/lib directory.
What else I have to do in order to resolve this.
Try the following command:
java -jar -Djava.class.path=java_home/jre/lib Serial_Send.jar
This will put the lib directory in class path of program explicitly.

command line: Unable to access jarfile eps2pgf.jar

I'm working with a Mac OSX version 10.9.5 and I am a complete newbie to using the command line and running java files in it.
I just downloaded the eps2pgf folder, I unzipped it and I downloaded JDK8.
However when I try to run the command (thats given in the manual) in my Terminal, I get the following error:
Unable to access jarfile eps2pgf.jar
The exact command I use is:
java -jar eps2pgf.jar Bifurcatiediagram.eps -o Bifurcatiediagram.pgf
So in total the command before I run it is (with what is automatically there as well):
mbpvanasteyaert:~ Aranka$ java -jar eps2pgf.jar Bifurcatiediagram.eps -o Bifurcatiediagram.pgf
What am I doing wrong? Should the eps2pgf unzipped folder be in a specific folder/directory or...?

Running .jar file - Double click vs. command line execution

I have a java desktop application that contains the following code:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
System.out.println("check1");
int intResult = compiler.run(System.in, System.out, foutErrorFile, strvalidatePath);
System.out.println("check2");
When I run the corresponding .jar file of this application by executing "java -jar name.jar", both check1 and check2 gets printed and app works fine.
But when i try to run the jar by double clicking the .jar file, I found that ToolProvider.getSystemJavaCompiler() is returning null. "check2" does not get printed. I dont get proper result from compiler.run().
I did modify the registry entry "\HKEY_CLASSES_ROOT\jarfile\shell\open\command" from
"C:\Program Files\Java\jre1.6.0\bin\javaw.exe" -jar "%1" %* to
"C:\Program Files\Java\jre1.6.0\bin\java.exe" -jar "%1" %*.
This way I'm able to see the console when the app is running.
So why is my program (which runs fine while run using java -jar command) malfunctioning when I run the .jar file by double-clicking?
I got my problem solved. While double-clicking, the command that gets executed is the one specified in registry entry. In my case the registry entry "\HKEY_CLASSES_ROOT\jarfile\shell\open\command" is:
"C:\Program Files\Java\jre7\bin\javaw.exe" -jar "%1" %*
This means its uses the javaw.exe app in the JRE directory to execute the program. My JRE directory lacked one .jar file named Tools.jar in its lib folder. This was essential to acquire the compiler during the program execution.
I copied the missing jar file from the JDK directory lib folder to the same in JRE directory. This solved my problem. Thank you to all for helping.
I think the best way is create a .bat file who calls java -jar name.jar

Java: Unable to access jarfile when running as an admin

I have a jar file named test.jar, which I am running with a batch script from the same folder.
Here's the batch code:
java -jar test.jar
pause
The jar itself works with no problems, and I can run it just fine.
However, if I try to run the batch file as an administrator (by right clicking it and choosing "Run as Administrator"), I get the following error:
Error: Unable to access jarfile test.jar
I'm using Windows 8.1, but this also happened on a machine running Windows 7.
What can I do to be able to run this as an Administrator?
i had the same problem that you and i solved it by changing
java -jar test.jar
to
java -jar %~dp0test.jar
%~dp0 holds the directory of your bat file (AFAIK) so %~dp0 will give Java the full path to the jar file solving the problem.
You could also ad a temp path to java
path=C:\Program Files\Java\jre1.8.0_40\bin
Java script
path=

Categories

Resources