Running JAVA Programs with additional -cp in ubuntu - java

I'm attempting to run CPUSIM under ubuntu 16.4
java -cp .:richtextfx-fat-0.6.10.jar:reactfx-2.0-MR.jar
-jar CPUSim-4.0.11.jar
Is the line the readme file says to enter in, when i try using that line the program fails. I'm not that versed with java or runtime stuff under ubuntu. I'm trying to run it in a terminal that's in the file directory where i unzipped the file.
Any tips on using -cp with java in a terminal?

Related

How to run or build a java program using wsl 2

I am trying to use wsl 2 to run java programs, and I will be writing the code in sublime text 3. I have already installed java in wsl 2, but don't know how to run a program through it built in sublime.
First, copy the java file to the linux system, the windows disk can be copied from the mnt directory
Make sure you have successfully installed the Java environment
Use the javac command to compile the .java file,
Use java command to execute .class file

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...?

java command line compilation

I have a simple, single file java program that relies on a single static jar. The java code and the jar reside in the same directory. For this one-off solution I don't want to bring in the weight of ant or maven, and just want to compile it directly.
On my dev box, the following compiles and runs my code fine:
javac -cp ".;dependency.jar" File.java
java -cp ".;dependency.jar" File
However, on my test box, the java command fails, and I get the following output:
Error: Could not find or load main class File
If I change my classpath arg to -cp "." I get the following output:
Exception in thread "main" java.lang.ClassNotFoundException: dependency
My dev box is 64-bit Windows/Cygwin and java version 1.7.0_55. My test box is 64-bit Linux and java version 1.7.0_45.
What is going wrong on my test box?
The classpath separator character is different on Linux (and on Unix) than it is on Windows. It's ; on Windows, but it's : on Linux (and Unix).
Try this on Linux:
javac -cp ".:dependency.jar" File.java
java -cp ".:dependency.jar" File

java virtual machine launcher error: unable to access jarfile

I have downloaded a program to run on windows XP.
According to the instructions, opening the .bat file that includes the command that calls the .jar file would be enough.
Yet the program does not open.
In a friend's computer the program does open.
I have set correctly the java-related environment variables. Java works fine. I have associated .jar files with java sdk.
When calling the command
javaw -Xms128M -Xmx512M -jar filename.jar from cmd
I get a java virtual machine launcher
error: unable to access jarfile
Then I called the same command while being on the folder where the jar is, I have no error, but still the gui of the program does not open.
Any ideas?
On windows support the suggest unistalling and manually re-installing java, but java works fine in any other app.
Try some of the following:
Run directly from the .exe, so "C:...\jre\javaw.exe" -jar
Try java -jar instead of javaw -jar.
Try moving the file. It could be in a permissions sensitive directory.
Also, if the program was compiled using a 64-bit JDK, it might require a 64-bit JRE to run. In that case, you'd need to have a 64-bit OS/JRE to run it.

Ubuntu System Start-up: What command to insert to run java app?

In Ubuntu 10.10, System/Preferences/Startup Applications, I am trying to add a .jar program. If the program sits in home/john/this-folder/app.jar, what would I put in the command line for it to run on start-up?
java -jar /home/john/this-folder/app.jar [optional arg if any]
java - the Java application launcher
Note that you need to include jar in classpath if you java app needs dependecies.
You do that by:
java -jar /yourApp.jar -cp /home/zzz/libs/

Categories

Resources